|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Random code snipets
I've been working on some perty usless code that are more for fun than anything else, but oh well.
Feel free to post some of your own. Here they are... Find Pi Code:
unsigned double float pi;
void main(void)
{
pi = 1;
for(count = 0, top = 2, bottem = 1; count < 10000; count++)
{
pi *= top/bottem;
bottem += 2;
pi *= top/bottem;
top += 2;
}
printf ("pi = %f", pi*2);
}
PHP Code:
|
|
#2
|
|||
|
|||
|
Re: Random code snipets
|
|
#3
|
||||
|
||||
|
Re: Random code snipets
Quote:
Err ... Could you not add these to the repository? Maybe I got the wrong idea, but I thought the repository was supposed to be a place to find *useful* and *robot-related* code (ideally to spark either inspiration or recognition ). These snippets are useless to any team looking for some code for their robot, and hence would only clutter up the repository -- thereby making it a less useful place, as it would be harder to find what you're looking for.I mean, really, the poster did say: Quote:
I realize you are excited about getting a lot of useful code uploaded to the repository ... but more is not necessarily better. Especially if it is more uneccesary or useless code! Remember: quality, not quantity, is what counts ... especially when programming. Perhaps I mistook the purpose of the repository ... but it doesn't seem to me like there is a need for a repository of random, un-related and un-useful pieces of code. |
|
#4
|
|||
|
|||
|
Re: Random code snipets
That's a very poor formula for pi. It converges very, very, very slowly.
Try some of these links for some better formulas: http://www.geocities.com/SiliconValley/Bay/9187/pi.htm http://elephant.linux.net.cn/articles/pi.php?lang=en Chudnovsky's algorithm would be a fine choice. You get 14 digits every iteration of the algorithm. |
|
#5
|
||||
|
||||
|
Re: Random code snipets
New version of random image
PHP Code:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is your most prefered programming language? | Hailfire | Programming | 156 | 19-01-2005 21:42 |
| InfraRed autonomous code ... | mtrawls | Programming | 1 | 11-01-2004 00:25 |
| Does your team use the Default code. | Jeff McCune | General Forum | 2 | 09-01-2003 14:46 |
| How random is random???? | archiver | 1999 | 0 | 23-06-2002 21:59 |
| Patent source code? | Kyle Fenton | Chit-Chat | 3 | 20-10-2001 17:53 |