Issue 3365: in module math, PI value seems to be wrong after digit 17th (original) (raw)
Hello, This is my first Issue creation (I looked for "PI" in issue tracker and found nothing): Please forgive any mistake.
Here is the point : I typed the following commands :
import math print '%1.26f' % math.pi 3.14159265358979311599796347 In fact, PI value is 3,14159265358979323846264338327950288... ^ I don't know if PI value is computed in Python : If it is, this issue is probably already dead ! But if PI is just saved in math library, there could be an improvement.
This is not a bug (though it's commonly reported as such :-) ). Given that not all real numbers can be represented as floats, math.pi is necessarily an approximation to true Pi, and you're printing that approximation out to high precision.
No, pi isn't computed in Python; it's a constant, stored as an IEEE 754 double.