[Python-Dev] Numerical robustness, IEEE etc.
Aahz
aahz at pythoncraft.com
Wed Jun 21 15:07:35 CEST 2006
On Wed, Jun 21, 2006, Nick Coghlan wrote:
> Facundo Batista wrote:
>>
>> BTW, prove me Decimal is not fast enough, ;)
>
> C:\Python24>python -m timeit -s "x = 1.0" "x+x"
> 10000000 loops, best of 3: 0.137 usec per loop
>
> C:\Python24>python -m timeit -s "from decimal import Decimal as d; x = d(1)" "x+x"
> 10000 loops, best of 3: 48.3 usec per loop
>
> I don't really know my definition of 'fast enough to be the basic
> floating point type', but I'm pretty sure that a couple of orders of
> magnitude slower isn't it. I guess I'll find out what my definition is
> if the C implementation manages to get there ;)
Why isn't that fast enough? Relative speed is *not* the issue when
talking about real-world applications. More to the point, the
expectation is that the C implementation of Decimal will have faster
conversion to/from string, which in many real world applications forms a
significant part of the processing load.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"I saw `cout' being shifted "Hello world" times to the left and stopped
right there." --Steve Gonedes
More information about the Python-Dev
mailing list