FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 11-05-2010, 03:40 PM
Arthur Bela
 
Default how to generate pi in c

Does anyone has a "generate-pi.c" source code?

Thanks.. :


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTinw53oS6ZRdwMNYVmx6mO5fWf_jEtvdw4L9g3un@mail .gmail.com">http://lists.debian.org/AANLkTinw53oS6ZRdwMNYVmx6mO5fWf_jEtvdw4L9g3un@mail .gmail.com
 
Old 11-05-2010, 03:40 PM
Arthur Bela
 
Default how to generate pi in c

Does anyone has a "generate-pi.c" source code?

Thanks.. :

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-05-2010, 03:40 PM
Arthur Bela
 
Default how to generate pi in c

Does anyone has a "generate-pi.c" source code?

Thanks.. :
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-05-2010, 03:49 PM
Andrew Haley
 
Default how to generate pi in c

On 11/05/2010 04:40 PM, Arthur Bela wrote:
> Does anyone has a "generate-pi.c" source code?

Lots of people do. You'll have to be a bit more specific about
what you actually want. I guess it's more than

4*atan(1.0)

Andrew.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-05-2010, 03:53 PM
"Bryn M. Reeves"
 
Default how to generate pi in c

On 11/05/2010 04:40 PM, Arthur Bela wrote:
> Does anyone has a "generate-pi.c" source code?
>
> Thanks.. :

Any book on numerical algorithms should give you a good run down on how you can
implement this in general. If you're not looking to get too deep into this then
Wikipedia has an article that discusses historical and current methods for
evaluating Pi to a certain degree of accuracy:

http://en.wikipedia.org/wiki/Pi

If you just need the value then the standard C maths library supplies
pre-defined mathematical constants that you can use in your programs:

http://www.gnu.org/s/libc/manual/html_node/Mathematical-Constants.html
http://www.gnu.org/s/libc/manual/html_node/Trig-Functions.html

If none of these satisfies your needs then you'll need to explain what you want
to do with the pi generator in a bit more detail.

Regards,
Bryn.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-05-2010, 03:55 PM
JD
 
Default how to generate pi in c

On 11/05/2010 09:40 AM, Arthur Bela wrote:
> Does anyone has a "generate-pi.c" source code?
>
> Thanks.. :
I do not have that specific file, but this might help you

Calculate pi to 800 digits in 160 characters of code. Written by Dik T.
Winter at CWI.

int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-cf[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)for(b=c;d+=f[b]*a,
f[b]=d%--g,d/=g--,--b;d*=b);}

See
http://www.di-mgt.com.au/cprog.html
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-05-2010, 03:58 PM
Jim Davis
 
Default how to generate pi in c

On Fri, Nov 5, 2010 at 9:40 AM, Arthur Bela <jozsi.avadkan@gmail.com> wrote:
> Does anyone has a "generate-pi.c" source code?

a[52514],b,c=52514,d,e,f=1e4,g,h;main(){for(;b=c-=14;h=printf("%04d",
e+d/f))for(e=d%=f;g=--b*2;d/=g)d=d*b+f*(h?a[b]:f/5),a[b]=d%--g;}

...though that's only good for the first 15,000 digits. You probably
need to be more specific about what you're looking for; the literature
on generating digits of pi is pretty extensive. Cf.
http://www.comlab.ox.ac.uk/jeremy.gibbons/publications/spigot.pdf
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-05-2010, 04:08 PM
Nils Kassube
 
Default how to generate pi in c

Arthur Bela wrote:
> Does anyone has a "generate-pi.c" source code?

Do you want us do do your homework?


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-05-2010, 04:10 PM
Volkan YAZICI
 
Default how to generate pi in c

On Fri, 5 Nov 2010, Arthur Bela <jozsi.avadkan@gmail.com> writes:
> Does anyone has a "generate-pi.c" source code?

Answer to your homework is here[1]. Also you can find a couple million
digits of pi as a text file on the web.


Regards.

[1] http://en.wikipedia.org/wiki/Pi#Estimating_.CF.80


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87iq0br91g.fsf@alamut.ozu.edu.tr">http://lists.debian.org/87iq0br91g.fsf@alamut.ozu.edu.tr
 
Old 11-05-2010, 04:16 PM
Alan Cox
 
Default how to generate pi in c

On Fri, 5 Nov 2010 17:40:34 +0100
Arthur Bela <jozsi.avadkan@gmail.com> wrote:

> Does anyone has a "generate-pi.c" source code?

bsd-games has a pi tool for some reason
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 

Thread Tools




All times are GMT. The time now is 12:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org