[Python-Dev] Expert floats

Batista, Facundo FBatista at uniFON.com.ar
Wed Mar 31 08:16:48 EST 2004


Andrew P. Lentvorski, Jr. wrote:

#- > The only thing Decimal will have against it in the end is 
#- runtime sloth.
#- 
#- While the Decimal implementation is in Python, certainly.
#- 
#- However, I did some floating point calculation timings a 
#- while back, and
#- the Python FP system is slow due to the overhead of working 
#- out types,
#- unpacking the values, and repacking the value.  The actual native
#- calculation is a small portion of that time.
#- 
#- My question is: Is it possible that a C implementation of 
#- Decimal would be
#- almost as fast as native floating point in Python for 
#- reasonable digit
#- lengths and settings? (ie. use native FP as an approximation 
#- and then do
#- some tests to get the last digit right).

While I'll do my best to keep Decimal fast, I'll first make it usable. As
Aahz used to put in his signature, it is easier to optimize correct code
than to correct optimized code.

Anyway, I still don't know how slower is Decimal than built-in binary
floating point.

.	Facundo



More information about the Python-Dev mailing list