Decimal vs float
Tim Peters
tim.peters at gmail.com
Sat Jan 21 12:24:52 EST 2006
[Kay Schluehr]
> I concur and I wonder why CAS like e.g. Maple that represent floating
> point numbers using two integers [1] are neither awkward to use nor
> inefficient.
My guess is that it's because you never timed the difference in Maple
-- or, perhaps, that you did, but misinterpreted the results. You
don't give any data, so it's hard to guess which.
BTW, why do you think Maple's developers added the UseHardwareFloats option?
> According to the Python numeric experts one has to pay a
> high tradeoff between speed and accuracy. But as it seems it just
> compares two Python implementations ( float / decimal ) and does not
> compare those to approaches in other scientific computing systems.
It's easy to find papers comparing the speed of HW and SW floating
point in Maple. Have you done that, Kay? For example, read:
"Symbolic and Numeric Scientific Computation in Maple"
K.O. Geddes, H.Q. Le
http://www.scg.uwaterloo.ca/~kogeddes/papers/ICAAA02.ps
Keith Geddes is a key figure in Maple's history and development, and
can hardly be accused of being a Python apologist ;-) Note that
Example 1.5 there shows a _factor_ of 47 speed gain from using HW
instead of SW floats in Maple, when solving a reasonably large system
of linear equations. So I'll ask again ;-): why do you think Maple's
developers added the UseHardwareFloats option?
While that paper mentions the facility only briefly, Geddes and Zheng
give detailed analyses of the tradeoffs in Maple here:
"Exploiting Fast Hardware Floating Point in High Precision Computation"
http://www.scg.uwaterloo.ca/~kogeddes/papers/TR200241.ps
If you're uncomfortable reading technical papers, one bottom line is
that they show that the time required by Maple to do a floating-point
multiplication in software "is at least 1000 times larger" than doing
the same with UseHardwareFloats set to true (and Digits:=15 in both
cases).
> By the way one can also learn from Maple how accuracy can be adjusted
> practically. I never heard users complaining about that.
It's easy to change the number of digits of precision in Python's
decimal module.
> ...
More information about the Python-list
mailing list