Since we are talking about this, and since it is so much fun, here's one ramification of IEEE 754 doubles, in Groovy: groovy:000> a = new Double(-1) ===> -1.0 groovy:000> b = new Double(0) ===> 0.0 groovy:000> c = new Double(1) ===> 1.0 groovy:000> a * b == b * c ===> false Clearly this is a bug in Groovy, but it's a direct result of the use of IEEE-754. -tom On Mon, Mar 27, 2017 at 11:18 AM, Dave Dyer <ddyer@real-me.net> wrote:
If it's true that integers aren't exactly represented, it could be a big problem. I think it has become common to "know" that a double float has more bits of precision than a single int, and represents it exactly. With IEEE doubles, so there is no harm in promoting int to double and later doing comparisons, even for equality.
The pitfall with posits is that it might.
possibly
(posit)(x+y) != (posit)x+(posit)y;
whereas with IEEE doubles,
(double)(x+y) == (double)x+(double)y;
thoughtful coders won't write this on purpose, but it's hard to avoid using what you know.
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- -- http://cube20.org/ -- http://golly.sf.net/ --