Python fails on math
robert.kern at gmail.com
Thu Feb 24 17:40:45 CET 2011
On 2/24/11 5:55 AM, Steven D'Aprano wrote:
> On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote:
>> The IEEE 754 compliant FPU on most machines today, though, has an 80-bit
>> internal representation. If you do a sequence of operations that retain
>> all the intermediate results in the FPU registers, you get 16 more bits
>> of precision than if you store after each operation.
> That's a big if though. Which languages support such a thing? C doubles
> are 64 bit, same as Python.
C double *variables* are, but as John suggests, C compilers are allowed (to my
knowledge) to keep intermediate results of an expression in the larger-precision
FPU registers. The final result does get shoved back into a 64-bit double when
it is at last assigned back to a variable or passed to a function that takes a
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list