I took a look at the code for Clojure 1.1, in clojure.lang.Numbers, and it seems that results of numerical ops on BigIntegers (BigIntegerOps) are passed to a 'reduce' method, which appears to return the most economical representation of a number:
static public Number reduce(BigInteger val){ int bitLength = val.bitLength(); if(bitLength < 32) return val.intValue(); else if(bitLength < 64) return val.longValue(); else return val; } The class that operates on Integers, IntegerOps, doesn't have an equivalent reduce() method. On Mar 11, 7:53 am, Brian Hurt <bhur...@gmail.com> wrote: > In a recent clojure: > > user=> (class 2147483647) > java.lang.Integer > user=> (class (inc 2147483647)) > java.math.BigInteger > user=> (class (inc (inc 2147483647))) > java.lang.Long > user=> > > This isn't *technically* a bug, but it is an odd behavior. > > Brian -- 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