On Feb 19, 2013, at 7:58 PM, Luca Morandini <lmorandini@ieee.org> wrote:
> Well, it is not a matter of precision as it may be enough for most purposes but
> of external representation: every user would expect to get back the same data he
> had put into the database.
But you _can’t_ put a number like 0.1 into a binary floatingpoint value; only a very close
approximation of it. It’s a mathematical impossibility, because 0.1 has an infinite number
of digits in binary. So roundtrip fidelity is impossible. The only way to store a number
like that exactly is to represent it as BCD or fixedpoint or as a string. (It seems weird
to be explaining this to someone with an IEEE email address…)
It sounds like you are just going to have to accept tiny bits of roundoff error. If you think
it makes the numbers look ugly, make your app do a bit of truncation when it displays them.
It seems like hyperbole to say that this is going to block your project.
—Jens
