On Wed, 21 Apr 1999, Tobias Rischer wrote:
>
> On fixed point numbers, it was said that:
>
> > Essentially, this should be implemented simply as an integer, with an
> > automatic scale on the IO routines.
> >
> > Alternatively, simply use an integer, and do the scaling in your
> > middleware! ;)
>
> Just to keep people from stumbling, I'd like to add:
>
> This is good advice, as long as the only calculations done on the
> integers *as integers* (e.g. in a SELECT expression) are + and -
> operations. It will wonderfully fail for "<fixed> * <fixed>" or
> "<fixed> / <fixed>"; these operations need to know about the implied
> scaling.
>
> It is ok to do "<int> * <fixed>", "<fixed> / <int>" etc.
>
> Tobias
>
>
> Personal Statement:
>
> I like the idea of fixed point numbers as the underlying data type for
> DECIMAL(m,n) [or was it NUMERIC?], maybe even a BCD type.
I can't think of any advantages to BCD at all.. someone enlighten me..
>
> I'm not much of a business man, but even I wouldn't like my bank to
> arbitrarily toggle the last digits of my bank account and explain that
> with floating point anomalies caused by the exact sequence of my earning
> and spending money. (I can almost see them telling me I should never
> look for exact equality in an account balance, but rather use some
> appropriate Epsilon! :-)
Yup. The appropriate epsilon is one half of a cent, in general. Someone
told me (I can't substantiate this myself) that most bank accounts
automatically round to the nearest penny/yen/pfennig at the close of
business each day.
Jules
/----------------+-------------------------------+---------------------\
| Jelibean aka | jules@stripped | 6 Evelyn Rd |
| Jules aka | jules@stripped | Richmond, Surrey |
| Julian Bean | jmlb2@stripped | TW9 2TF *UK* |
+----------------+-------------------------------+---------------------+
| War doesn't demonstrate who's right... just who's left. |
| When privacy is outlawed... only the outlaws have privacy. |
\----------------------------------------------------------------------/