[Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich comparison

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Oct 25 04:51:15 EDT 2000


"Rainer Deyke" <root at rainerdeyke.com> writes:

> Everybody who expected 0.6666667, raise your hands.  Put your hands down.
> Now, everybody who expected 0.6667 raise your hands.  How about those who
> expected 0.66666666666666663 (the "real" result of 2.0/3.0 on my computer)?
> Anybody?
> 
> In all of those cases, the result was truncated or rounded.  2/3=0 is just
> more obvious and predictable about it.

Predictable maybe (if you know the rules), but certainly not obvious.

In my experience, people who start programming expect the arithmetic
of any programming language to work like the pocket calculators they
are used to. Which means they expect 2/3 to be a reasonable
approximation to its true (rational) value, accepting roundoff
problems.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------



More information about the Python-list mailing list