From: Christopher Dicely Date: 2010-04-19T14:24:56+09:00 Subject: Re: ruby 1.9+ , floats, and decimal On Sun, Apr 18, 2010 at 8:07 PM, botp wrote: >> 0.2-0.1 > => 0.1 > >> 1.2-0.1 > => 1.1 > >> 1.2-1.1 > => 0.0999999999999999 > > gotcha! > > ok, i know what you're thinking. this dead horse is double dead.. > > in the spirit of advancing to a better computing env, shouldn't it be > time for ruby to default to "real" decimal instead of float? I think decimal floating point (as supported in the 2008 version of IEEE 754) would be a good idea. OTOH, to reduce the potential impact on existing code -- including on performance, where binary floating point, since it has more prevalent hardware support, is likely to outperform in most cases -- it might be better to introduce a simple syntax for decimal floating point literals, e.g. an integer or floating point expression with a trailing (no intervening whitespace) "d" like 1.0d would be treated as a decimal floating point value.