This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: in module math, PI value seems to be wrong after digit 17th
Type: behavior Stage:
Components: None Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: TanaT, mark.dickinson
Priority: normal Keywords:

Created on 2008-07-15 16:13 by TanaT, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg69693 - (view) Author: TanaT (TanaT) Date: 2008-07-15 16:13
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.
msg69694 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-07-15 16:19
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.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47615
2008-07-15 16:19:20mark.dickinsonsetstatus: open -> closed
resolution: not a bug
messages: + msg69694
nosy: + mark.dickinson
2008-07-15 16:13:44TanaTcreate