[Matrix-SIG] Numeric Nits

Konrad Hinsen hinsen@cnrs-orleans.fr
Fri, 25 Jun 1999 12:04:35 +0200


> > - Support of different precisions in a portable way (see above).
> 
> Though this would certainly be desirable for numerical work, does it
> endanger in any way the ability to request a fixed-bitlength type? For

No. As an alternative for requesting a particular precision, you
could request a particular storage size.

> > - integration of all number-like data types into a single
> >   data type, with integers, floats, etc. being only different
> >   internal representations of numbers. That would remove oddities
> >   such as 1/2 == 0 (the single most surprising feature in Python
> >   for newcomers in my opinion).
> 
> I admit I fail to see why aforementioned integration of all number-like
> data types would remove the "oddity" that 1/2 == 0, but I humbly submit

Not directly. But the main argument for requiring 1/2 to be zero has
always been that an operation between two objects of integer type should
return a result of the same type. Removing that argument is a first
step towards sanity ;-)

> that this is what all Fortran and C programmers have come to accept (and
> often take advantage of!) and so I see it as a feature rather than a bug. 

To quote a visiting graduate student who has recently started Python
after previous Fortran experience, and who spent three days searching
for a bug that turned out to be an integer division problem:
"I knew this problem from Fortran, but Python is a so much nicer
language that I was sure they had fixed this."

During the last year I have worked with three students who started with
Python, and the only problem that all of them encountered and considered
unreasonable was integer division.

Of course an integer division operation should exist, but it should not
be the one associated with the general division operator.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------