floats and doubles are "inexact" numbers and ratios, ints, longs,
bigints, and bigdecimals are "exact" numbers.
The expected behavior is that inexact things contaminate exact things,
because now the result is inexact.  This is what Clojure does.

On Fri, Jun 25, 2010 at 1:18 PM, Garth Sheldon-Coulson <g...@mit.edu> wrote:
> 1) If there is going to be BigInt contagion, why not BigDecimal contagion?

doubles contaminate bigdecimals, not the other way around.  That's how
it should be.

> 2) Will the same reasoning that produced BigInt give us a BigDec with a
> better hashCode() than that of BigDecimal?

You don't want the hashCode of bigdecimal to match the corresponding
double.  They aren't equal, so they shouldn't have the same hashcode.
They aren't equal because one is exact and one is inexact.

Now, one interesting question is whether the hashCode of 40.0M should
match the hashCode for 40N, because they are two exact numbers that
represent the same value.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to