This was the big change in clojure 1.3

See http://dev.clojure.org/display/doc/Enhanced+Primitive+Support

The expectation now is that if you are doing math that is going to
overflow, you can either introduce a bigint into the chain somewhere,
after which all the math will use bigints (contagion) or the writer of
the function can use the *' (prime) operator.

So the following are both fine, with the first usually being preferred
because it leaves the choice to the consumer.

 (* 1000M 1000 1000 1000 1000 1000 1000)
 (*' 1000 1000 1000 1000 1000 1000 1000)

On Mon, Feb 6, 2012 at 8:04 PM, Leandro Moreira
<leandro.rhc...@gmail.com> wrote:
> I thought clojure always did auto promotion between long and bigdecimal, but
> I run repl today and I notice this:
>
> (* 1000 1000 1000 1000 1000 1000 1000) raises overflow
> (* 1000M 1000M 1000M 1000M 1000M 1000M 1000M) this is ok
>
> So this was always working that way? or they've changed? (and if yes, why
> they did that?)
>
> thanks :)
>
> ps: I'm usingĀ {:interim true, :major 1, :minor 4, :incremental 0, :qualifier
> "master"}
>
> --
> 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 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