Thoughts on IEEE P754
rubys at intertwingly.net
Thu Aug 21 19:08:13 PDT 2008
Waldemar Horwat wrote:
> Some tidbits about our embedding of decimal:
> - Contagion should be towards decimal if decimal and binary are mixed
> as operands. 5.3m + 1 should be 6.3m, not 6.3. If we use 128-bit
> decimal, this also makes the behavior of heterogeneous comparisons
> (binary compared to decimal) sensible.
What should 5.3m + 1.0000000000000001 produce?
I also don't understand the heterogeneous comparisons comment. What
should 1.0000000000000001 == 1.0000000000000001m produce?
> - We should not print the trailing zeroes. IEEE P754 does not
> require it, and it breaks things such as array lookup. There is
> precedence for this in ECMAScript: -0 and +0 both print as "0". If
> someone really wants to distinguish among equal numbers, he can do it
> with a function call to one of the mandated functions.
Please explain the breakage?
When dealing with currency, having 0.05 + 0.05 produce 0.10 is a feature.
- Sam Ruby
More information about the Es-discuss