PEP 327: Decimal Data Type

Anton Vredegoor anton at vredegoor.doge.nl
Fri Feb 6 20:25:21 CET 2004


On 6 Feb 2004 17:03:57 GMT, bokr at oz.net (Bengt Richter) wrote:

>The _meaning_ of numbers that are guaranteed to fall into known exact intervals
>in terms of representing measurements, measurement errors, statistics of the
>errors, etc. is a separate matter from keeping track of exact intervals during
>computation. These concerns should not be confused, IMO, though they inevitably
>arise together in thinking about computing with real-life measurement values.

(Warning, naive hobbyist input, practicality: undefined)

One possible option would be to provide for some kind of random
rounding routine for some of the least significant bits of a floating
point value. The advantage would be that this would also be usable for
DSP-like computations that are used in music programming (volume
adjustments) or in digital video (image rotation). 

I agree with the idea that exact interval tracking is important, but
perhaps this exact interval tracking should be used only during
testing and development of the code. 

It could be that it would be possible to produce code with a fixed
number of least significant bits that are randomly rounded each time
some specific operation makes this necessary (not *all* computations!)
and that the floating point data would stay accurate enough for long
enough to be useable in 99.9 percent of the use cases.

Maybe we need a DSP-float instead of a decimal data type? Decimals
could be used for testing DSP-float implementations.

Anton



More information about the Python-list mailing list