On Thu, May 22, 2008 at 12:32 PM, Dutton, Sam <[EMAIL PROTECTED]> wrote: > I've noticed that the value of math.pi -- just entering it at the interactive > prompt -- is returned as 3.1415926535897931, whereas (as every pi-obsessive > knows) the value is 3.1415926535897932... (Note the 2 at the end.) > > Is this a precision issue, or from the underlying C, or something else? How > is math.pi calculated?
I believe this is an issue with the precision of IEEE floating point numbers[1]. Those are the types of numbers used by the hardware floating point processor on your CPU. I'm not an expert, by any stretch of the imagination, but I believe you have two choices to represent pi as an IEEE double precision float: 3.1415926535897931 (stored as 0x400921FB54442D18) or 3.1415926535897936 (stored as 0x400921FB54442D19) 1: http://en.wikipedia.org/wiki/IEEE_floating-point_standard -- Jerry -- http://mail.python.org/mailman/listinfo/python-list