Boost logo

Boost :

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
> point
> >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,
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
[11], PL/I fixed decimal [12], or
SQL NUMERIC) or it might be variable, hence providing a simple
floating-point type (as in COBOL
numerics [13], Rexx strings [14], Java BigDecimal [15], Visual Basic
currency[16], and C# decimal [17]).
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)

Misha Bergal
MetaCommunications Engineering

Boost list run by bdawes at, gregod at, cpdaniel at, john at