[Python-Dev] Expert floats

Ka-Ping Yee python-dev at zesty.ca
Tue Apr 6 09:49:05 EDT 2004


On Tue, 6 Apr 2004, Simon Percivall wrote:
> So how should "2.2 - 1.2 - 1" be represented?
>
> Matlab (Solaris 9):          2.22044604925031e-16
> Octave (MacOS X 10.3):       2.22044604925031e-16
> Python 2.3.3 (MacOS X 10.3): 2.2204460492503131e-16
>
> Is this something you accept since Matlab does it?

I accept it, but not primarily because Matlab does it.

It is fine to show a value different from zero in this case
because the result really is different from zero.  In this case
those digits are necessary to represent the machine number.
In other cases (such as 1.1) they are not.


-- ?!ng



More information about the Python-Dev mailing list