From: Misha Bergal (mbergal_at_[hidden])
Date: 2003-07-20 16:13:31
"Beman Dawes" <bdawes_at_[hidden]> wrote in message
> >Could you elaborate a little more about the requirements to use fixed
> >instead of floating point. Not being an expert in the area, I don't see
> >many use cases where fixed point would be preferable to floating point.
> >I really would appreciate if you described your ones.
> Start by thinking of everyday financial calculations. Gasoline is priced
Thanks a lot. I will have them in mind.
> If "as accurate as possible" is the requirement, floating point is
> best. But sometimes in business and industry a specific accuracy in terms
> of decimal places and rounding modes is the requirement. Fixed-point is
> better for those situations, IMO.
Something seems to be wrong to me tough. The programming languages
(environments) introduced lately do not implement fixed-point only decimal
C# has Decimal claa
Java has BigDecimal which is floating point + JDBC maps database
decimal(p,n) into it
And here is this paper http://www.dec.usc.es/arith16/papers/paper-107.pdf,
written my Michael Cowlishaw, who is a maintainer of what seems to be a very
comprehensive collection of materials regarding Decimal Arithmetics at
Quoting the paper:
Depending on the language, the scale might be fixed (as in Ada fixed point
, PL/I fixed decimal , or
SQL NUMERIC) or it might be variable, hence providing a simple
floating-point type (as in COBOL
numerics , Rexx strings , Java BigDecimal , Visual Basic
currency, and C# decimal ).
For many applications, a floating scale is especially advantageous. For
example, European regulations [18,19],
dictate that exchange rates must be quoted to 6 digits instead of to a
particular scale. All the digits must be present, even if some trailing
fractional digits are zero.
I believe that we might be on the wrong track here. It seems to me that we
might be doing something obsolete and not needed any more (in form proposed
by the submitter).
It reminds me the Boost.thread library semaphore discussions, where the
A.Terekhov and B.Kempf strongly argued for not including the semaphores in
Boost.Thread library on the basis of that being an obsolete and unsafe
abstraction (please forgive me I am misstating the facts - I haven't
followed the discussion closely enough)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk