[Numpy-discussion] arange and floating point arguments
Robert Kern
robert.kern@gmail....
Fri Sep 14 16:51:27 CDT 2007
Joris De Ridder wrote:
>
>> the question is how to reduce user astonishment.
>
> IMHO this is exactly the point. There seems to be two questions here:
> 1) do we want to reduce user astonishment, and 2) if yes, how could
> we do this? Not everyone seems to be convinced of the first question,
> replying that in many cases linspace() could well replace arange().
> In many cases, yes, but not all. For some cases arange() has its
> legitimate use, even for floating point, and in these cases you may
> get bitten by the inexact number representation. If Matlab seems to
> be able to avoid surprises, why not numpy?
Here's the thing: binary floating point is intrinsically surprising to people
who are only accustomed to decimal. The way to not be surprised is to not use
binary floating point. You can hide some of the surprises, but not all of them.
When you do try to hide them, all you are doing is creating complicated, ad hoc
behavior that is also difficult to predict; for those who have become accustomed
to binary floating point's behavior, it's not clear what the "unastonishing"
behavior is supposed to be, but binary floating point's is well-defined.
Binary floating point is a useful tool for many things. I'm not interested in
making numpy something that hides that tool's behavior in order to force it into
a use it is not appropriate for.
--
Robert Kern
"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 Numpy-discussion
mailing list