Robert Haas <robertmhaas@gmail.com> writes:
> In general, floating point arithmetic is inaccurate and sucky. That
> has nothing to do with PostgreSQL; it's just life.
Actually, I think these examples are being done in "numeric" not float8.
Your comment stands though --- 1.0/3.0 does not give the exact rational
number 1/3, but some finite decimal approximation to it, which when
multiplied by 3 will not produce exactly 1.0.
There is special-purpose software out there that can compute exactly
with rational numbers, but you aren't likely to find it embedded in any
general-purpose tools like databases --- the use-case just isn't wide
enough. One reason why not is that it'll still fall down on irrational
numbers.
regards, tom lane