[Numpy-discussion] Re: [Matrix-SIG] An Experiment in code-cleanup.
Konrad Hinsen
hinsen at cnrs-orleans.fr
Wed Feb 9 11:17:30 CST 2000
> silently). Consider a function
>
> k0 = 100
> k = 99
> while k < k0:
> ..
> k0 = k
> k = ...
>
> which refines a calculation until the measure k stops decreasing.
> This algorithm may terminate when k is a float, but _fail_ when
> k is a double -- the extra precision may cause the algorithm
I'd call this a buggy implementation. Convergence criteria should be
explicit and not rely on the internal representation of data
types. Neither Python nor C guarantees you any absolute bounds for
precision and value range, and even languages that do (such as Fortran
9x) only promise to give you a data type that is *at least* as big as
your specification.
> programming is all about. Numerical programmers need to know
> how big numbers are, and how much significance they have,
> and optimise calculations accordingly -- sometimes by _using_
> the precision of the working types to advantage.
If you care at all about portability, you shouldn't even think about
this.
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen at 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
-------------------------------------------------------------------------------
More information about the Numpy-discussion
mailing list