On 23 Oct 2011 at 19:54, Toby Thain wrote:
I was talking about fixed point, which is why I
wrote "fixed point".
The contextual examples are Fred's pennies or SQL's DECIMAL.
Regardless, I was referring to the old, almost forgotten "floating
decimal point" sometimes found on old calculators and in early
computer programs. There, the point moves anywhere within the
significand, but not outside of it.
For example, if you have a 4 digit device, a floating point can
express values between .0001 and 9999. No exponent to extend the
range of absolute values. Fixed point, in the same sense only means
that the decimal point is anchored to a particular position; e.g.,
12.34 is a fixed-point number with the point fixed between the two
high-order digits and the two low-order digits.
It's a shame that just about all the web has on "floating point" is
about exponential/scientifc notation, which is not strictly the same--
including the screwball notion that "fixed point" somehow means
"integer".
Taking a reductionist view, both fixed point and floating point are ways
of interpreting a similar *pair* of integers - mantissa and exponent.
This is the clarifying detail that so often eludes the common programmer.
"Fixedness" is just a convention that may be enforced (e.g. by DECIMAL,
or a hard coded decimal point as in Fred's example). IMHO the
inconvenience of IEEE-754 FP for counting pennies is more to do with the
denominator base not being 10 - sometimes combined with ignorance about
the number of significant figures obtained in the two common IEEE formats.
--T