Re: A question on Clojure precision

2012-07-30 Thread Kevin Ilchmann Jørgensen
Hey Does the part about numbers: http://clojure.org/data_structures clear it up for you? >From (source +) you should see that (+ 0.1 0.1M ...) is matched to (. clojure.lang.Numbers (add x y))) ; (. clojure.lang.Numbers (add 0.1 0.1M)) =>0.2 and that (+ 0.1M 0.1M ...) is (. clojure.lang.Number

A question on Clojure precision

2012-07-30 Thread grahamke
I was testing some of the code in Miclael Fogus & Chris Houser's The Joy of Clojure and found this: Clojure 1.4.0 user=> (let [a (+ 0.1 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M)] (println (class a)) a) java.lang.Double 0. user=> (let [b (+ 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.