This forum is now read-only. Please use our new forums at

Functions, Part I Forum

View Course » View Exercise

1191 points
Submitted by
David Hollowood
about 2 years ago

M_PI in a program

Is it customary for pi to only go out to 11 decimal places? I tried rounding pi to 20 and 11 was as high as it got. I ask just because someone might need more precision in a program.

0 votes


Hi David,

It went out to 13 decimal places for me, but this is an interesting question. I wasn't able to find anything that talked about going out farther, even in the PHP docs. I don't think there is a way to go out past 13 decimal places.
I would kind of like to know what situations you're thinking such precision would be needed, though. 13 decimal places is pretty precise.

2818 points
Submitted by
Zeke Y
about 2 years ago


219ab7f772efb1cd5440659fe629340a?s=140&d=retro David Hollowood about 2 years ago

I'm thinking astronavigation where a hundredth of a degree might be multiplied to the nth and mean the difference between geosynchronous orbit or plunging headlong into a star. I'm no rocket scientist. I have no idea if they even use Pi in their equations. Curiosity due to PiDay and a report that they have determined Pi out to 2 trillion decimal places and my overall-inner geek. Thanks for the response!

5674c6dae39efec455000434_879409444 Zeke Y about 2 years ago

That would be an interesting case, I don't know if they would use Pi either, but I do know that it's about a 1:1000000 chance they would use PHP for it :). Still, it's definitely a very interesting thought!