Take a look at FloatMgr.h in the 3.5 SDK include files. It describes the
format of a Double very precisely. It's a floating point number, so it is
capable of representing very small or very large numbers, but round-off
occurs when adding very small and very large numbers. The exponent and
mantissa are in binary, so the mantissa doesn't hold a whole number of
significant digits. There are 52 bits of mantissa (plus a 1 prefix). That's
equivalent to more than 15 decimal digits.
If you want to avoid the performance cost or possible round-off errors of a
floating point representation, you can easily do your own fixed point math
using 32 bit integers. For example, you might use 8 bits of integer part and
24 bits of mantissa. When adding, you don't need to make any adjustments.
When multiplying or dividing by an integer, the same is true. When
multiplying one by another, you need to do some shifting. Of course, you
don't get all the fancy math functions available in MathLib.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html