Rational Numbers
Nick Maclaren
nmm1 at cus.cam.ac.uk
Sun Jan 14 07:04:29 EST 2007
In article <mailman.2705.1168750931.32031.python-list at python.org>,
"Hendrik van Rooyen" <mail at microcorp.co.za> writes:
|>
|> > 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.
|>
|> Ok I will throw in a skewed ball at this point - use integer arithmetic,
|> and work in tenths of cents or pennies or whatever, and don't be too
|> lazy to do your own print formatting...
That's not a skewed ball - that's the traditional way of doing it on
systems that don't have fixed-point hardware (and sometimes even when
they do). Yes, it's dead easy in a language (like Python) that allows
decent encapsulation.
The decimal floating-point brigade grossly exaggerate the difficulty of
doing that, in order to persuade people that their solution is better.
If they admitted the difficulties of using decimal floating-point, and
merely said "but, overall, we think it is a better solution", I would
disagree but say nothing.
Regards,
Nick Maclaren.
More information about the Python-list
mailing list