On May 7, 2014, at 12:11 PM, Mars0i <marsh...@logical.net> wrote: > To me, the fact that BigDecimal is contagious sometimes but not always, seems > confusing in a way that could encourage bugs. The fact that BigInts are > contagious would also lead one to assume that BigDecimals are contagious.
I don't think it's a case of "sometimes but not always". Instead there's a contagion precedence order such that any type earlier in the order combined with a type later in the order yields the type later in the order. Here's the order: Long < BigInt < Ratio < BigDec < Double Before applying the contagion order, narrower integer types are promoted to Long, and float is promoted to Double. See for reference the many implementations of opsWith in Numbers.java: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/jvm/clojure/lang/Numbers.java#L411 --Steve -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.