Re: how to generate pi in c

2010-11-15 Thread Chris Rees
On 11 November 2010 12:06, Wojciech Puchar woj...@tensor.gdynia.pl wrote: Does anyone has a generate-pi.c source code? atanl(1) Er, arc tan of 1 is pi/4. Try atanl(1)*4, or for a less wasteful instruction try using the constant M_PI Also, forgive me if I'm wrong, but this looks like a

Re: how to generate pi in c

2010-11-11 Thread Wojciech Puchar
Does anyone has a generate-pi.c source code? atanl(1) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: how to generate pi in c

2010-11-09 Thread perryh
Ian Smith smi...@nimnet.asn.au wrote: In freebsd-questions Digest, Vol 335, Issue 11, Message: 4 On Sat, 06 Nov 2010 01:00:34 -0700 per...@pluto.rain.com wrote: Julian Fagir g...@physik.tu-berlin.de wrote: Does anyone has a generate-pi.c source code? ... 1 #include stdlib.h

Re: how to generate pi in c

2010-11-09 Thread Ian Smith
On Tue, 9 Nov 2010, per...@pluto.rain.com wrote: Ian Smith smi...@nimnet.asn.au wrote: In freebsd-questions Digest, Vol 335, Issue 11, Message: 4 On Sat, 06 Nov 2010 01:00:34 -0700 per...@pluto.rain.com wrote: Julian Fagir g...@physik.tu-berlin.de wrote: Does anyone has a

Re: how to generate pi in c

2010-11-09 Thread Julian Fagir
Hi, just to get more off-topic... ;-) On Mon, 8 Nov 2010 20:01:19 +1100 (EST) Ian Smith smi...@nimnet.asn.au wrote: And while a square enclosing a circle, it's hardly squaring the circle: http://en.wikipedia.org/wiki/Squaring_the_circle .. but an interesting read nonetheless for unrequited

Re: how to generate pi in c

2010-11-08 Thread Ian Smith
In freebsd-questions Digest, Vol 335, Issue 11, Message: 4 On Sat, 06 Nov 2010 01:00:34 -0700 per...@pluto.rain.com wrote: Julian Fagir g...@physik.tu-berlin.de wrote: Does anyone has a generate-pi.c source code? ... 1 #include stdlib.h 2 #include string.h 3 #include stdio.h

Re: how to generate pi in c

2010-11-06 Thread perryh
Julian Fagir g...@physik.tu-berlin.de wrote: Does anyone has a generate-pi.c source code? ... 1 #include stdlib.h 2 #include string.h 3 #include stdio.h 4 5 // Change this for a more accurate result. 6 long max = 1; 7 double a, b; 8 double pi; 9 long counter;

how to generate pi in c

2010-11-05 Thread Arthur Bela
Does anyone has a generate-pi.c source code? Thanks.. :D :\ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: how to generate pi in c

2010-11-05 Thread Remko Lodder
No, but a simple search reveals some information; http://einstein.drexel.edu/courses/Comp_Phys/General/C_basics/ On Nov 5, 2010, at 5:40 PM, Arthur Bela wrote: Does anyone has a generate-pi.c source code? Thanks.. :D :\ -- /\ Best regards,| re...@freebsd.org \

Re: how to generate pi in c

2010-11-05 Thread Alejandro Imass
This is how I do it in perl use constant PI = 4 * atan2(1, 1); In C it owuld probably be (using math.h): pi = 4.0*atan(1.0); On Fri, Nov 5, 2010 at 1:15 PM, Remko Lodder re...@elvandar.org wrote: No, but a simple search reveals some information;

Re: how to generate pi in c

2010-11-05 Thread Polytropon
On Fri, 5 Nov 2010 13:39:05 -0400, Alejandro Imass a...@p2ee.org wrote: This is how I do it in perl use constant PI = 4 * atan2(1, 1); In C it owuld probably be (using math.h): pi = 4.0*atan(1.0); Or use M_PI from /usr/include/math.h, as we already #include'd it. :-) #define M_PI

Re: how to generate pi in c

2010-11-05 Thread Alejandro Imass
On Fri, Nov 5, 2010 at 2:13 PM, Polytropon free...@edvax.de wrote: On Fri, 5 Nov 2010 13:39:05 -0400, Alejandro Imass a...@p2ee.org wrote: This is how I do it in perl use constant PI = 4 * atan2(1, 1); In C it owuld probably be (using math.h): pi = 4.0*atan(1.0); Or use M_PI from

Re: how to generate pi in c

2010-11-05 Thread Ivan Klymenko
В Fri, 5 Nov 2010 13:39:05 -0400 Alejandro Imass a...@p2ee.org пишет: This is how I do it in perl use constant PI = 4 * atan2(1, 1); In C it owuld probably be (using math.h): pi = 4.0*atan(1.0); On Fri, Nov 5, 2010 at 1:15 PM, Remko Lodder re...@elvandar.org wrote: No, but a

Re: how to generate pi in c

2010-11-05 Thread Ivan Klymenko
В Fri, 5 Nov 2010 13:39:05 -0400 Alejandro Imass a...@p2ee.org пишет: This is how I do it in perl use constant PI = 4 * atan2(1, 1); In C it owuld probably be (using math.h): pi = 4.0*atan(1.0); On Fri, Nov 5, 2010 at 1:15 PM, Remko Lodder re...@elvandar.org wrote: No, but a

Re: how to generate pi in c

2010-11-05 Thread Julian Fagir
Hi, Does anyone has a generate-pi.c source code? The solution of Ivan Klymenko is surely much more suffisticated, but as I wrote this down, I just want to publish it... ;-) 1 #include stdlib.h 2 #include string.h 3 #include stdio.h 4 5 // Change this for a more accurate result. 6

Re: how to generate pi in c

2010-11-05 Thread Alex Stangl
On Fri, Nov 05, 2010 at 05:40:39PM +0100, Arthur Bela wrote: Does anyone has a generate-pi.c source code? Search for pi spigot algorithm. Here is a tiny C program from Jeremy Gibbon's Unbounded Spigot paper (due to Dik Winter and Achim Flammenkamp):