3.14

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Vicious
Forum Contributor
Posts: 105
Joined: Fri Jun 20, 2003 12:40 pm

3.14

Post by Vicious »

Hey i was jw Just did a lil script http://www.team101.net/divisionscript.php im sure many people have tried it but can I get it to show more then just 3.1428571428571 maybe like a million numbers or so?
User avatar
EvilWalrus
Site Admin
Posts: 209
Joined: Thu Apr 18, 2002 3:21 pm
Location: Springmont, PA USA

Post by EvilWalrus »

Not sure, but pi is actually 3.14159..... your script must have a bug ;)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

maybe you should use a more accurate approximation ;-)
e.g. from http://mathworld.wolfram.com/PiFormulas.html and search for the word "spigot"

or google for "pi spigot"
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post by RFairey »

Does that script just divide using normal php arithmetic? If so, you'll get 14 or 15 decimal places tops - thats a double precision floating point number. You either need to code a clever function that outputs the numbers one by one in a loop, or use the php equivalent of a BigDecimal (Arbitrary precision fp numbers (if there is one))
Post Reply