Boost logo

Boost :

From: Misha Bergal (mbergal_at_[hidden])
Date: 2003-07-20 16:13:31


"Beman Dawes" <bdawes_at_[hidden]> wrote in message
news:4.3.2.7.2.20030720134921.0213ebb0_at_mailhost.esva.net...
> >
> >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
[snipped]
Thanks a lot. I will have them in mind.

>
> If "as accurate as possible" is the requirement, floating point is
probably
> 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
numbers.
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
http://www2.hursley.ibm.com/decimal.

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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk