Rational Numbers

Simon Brunning simon at brunningonline.net
Fri Jan 12 15:00:03 EST 2007


On 12 Jan 2007 19:41:52 GMT, Nick Maclaren <nmm1 at cus.cam.ac.uk> wrote:
> Sigh.  I was hoping not to have that myth perpetrated again.
>
> Financial calculations need decimal FIXED-point, with a precisely
> specified precision.  It is claimed that decimal FLOATING-point
> helps with providing that, but that claim is extremely dubious.
> I can explain the problem in as much detail as you want, but would
> very much rather not.

Sorry, Nick, you might have to. ;-)

I'm not educated in these matters, so I'd genuinely like to know why
you say that. Not educated, but I do have some experience; I've used
both fixed and floating point Decimal types extensively, and I've
found floating types superior. More fiddly, certainly, 'cos you have
to explicitly round back down to the precision that you want when you
want. But explicit is better than implicit - the number of subtle
rounding bugs that I've had to fix 'cos someone didn't realise where
rounding was occurring is, uh, well, it happens from time to time. ;-)

What am I missing?

-- 
Cheers,
Simon B
simon at brunningonline.net



More information about the Python-list mailing list