Arjen,
There is no precise conversion from base 2/4/8/16 representation to base
5/10 representation when you have digits after the (decimal, binary)
point.
That's why base 2 representation just can't be used.
Can you give an example of this?
Generally, in a base-n numeral system, any fraction can be represented
either as a real number with a finite number of digits after the radix
point, or a real number with an infinitely recurring pattern at the end.
Fractions whose denominator can be expressed in terms of the prime
factors of the base belong to the first set and all other fractions
belong to the second set.
Since 10 has more prime factors than 2, some of the fractions that can
be expressed with a finite number of digits after the point in base-10
fall in the other set in base-2, such as 0.1 ^= 1/10 = 1/2*5 =~ 0.0_0011
in binary (the underscore is meant to mark the beginning of the
recurring portion of the digits after the binary point).
This means that you can't use a binary floating point format such as an
IEEE float to store decimal numbers. I think that's not really what was
suggested, though, as you would usually store a numerator and a
denominator instead of a binary real number. Typically, the denominator
would be a power of ten and chosen so that all the significant digits of
the number are contained in the numerator. In other words, you store a
string of digits and the position of the decimal point. When you do
this, the whole problem goes away.
Daniel
--
Daniel Fischer, MySQL Team Lead Build +46 18174400 ext. 4537
Sun Microsystems GmbH Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering HRB MUC 161028 49.011, 8.376
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp