Re: how to generate pi in c

2010-11-15 Thread Chris Rees
On 11 November 2010 12:06, Wojciech Puchar 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 homework question. Ch

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 Julian Fagir
Hi, just to get more off-topic... ;-) On Mon, 8 Nov 2010 20:01:19 +1100 (EST) Ian Smith 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 seekers of pi-foo

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 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 wrote: > > > > > Does anyone has a "generate-pi.c" source code? > > >

Re: how to generate pi in c

2010-11-09 Thread perryh
Ian Smith 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 wrote: > > > > Does anyone has a "generate-pi.c" source code? > > ... > > > 1 #include > > > 2 #include > > > 3 #include

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 wrote: > > > Does anyone has a "generate-pi.c" source code? > ... > > 1 #include > > 2 #include > > 3 #include > > 4 > > 5 // Change this

Re: how to generate pi in c

2010-11-06 Thread perryh
Julian Fagir wrote: > > Does anyone has a "generate-pi.c" source code? ... > 1 #include > 2 #include > 3 #include > 4 > 5 // Change this for a more accurate result. > 6 long max = 1; > 7 double a, b; > 8 double pi; > 9 long counter; > 10 long i; > 11 > 12 int main

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): a[52514],b,c=52514,d,e,f=1e4,g,h;main(){fo

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 2 #include 3 #include 4 5 // Change this for a more accurate result. 6 long max = 1;

Re: how to generate pi in c

2010-11-05 Thread Ivan Klymenko
В Fri, 5 Nov 2010 13:39:05 -0400 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 > wrote: > > > > No, but a simple search reveals s

Re: how to generate pi in c

2010-11-05 Thread Ivan Klymenko
В Fri, 5 Nov 2010 13:39:05 -0400 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 > wrote: > > > > No, but a simple search reveals s

Re: how to generate pi in c

2010-11-05 Thread Alejandro Imass
On Fri, Nov 5, 2010 at 2:13 PM, Polytropon wrote: > On Fri, 5 Nov 2010 13:39:05 -0400, Alejandro Imass 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, a

Re: how to generate pi in c

2010-11-05 Thread Polytropon
On Fri, 5 Nov 2010 13:39:05 -0400, Alejandro Imass 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_PI3.

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 wrote: > > No, but a simple search reveals some information; > > http://einstein.drexel.edu/courses/Comp_Phys/General/C_basi

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

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"