questions about float operations

2010-08-20 Thread bufo
I am currently learning clojure by reading The Joy of Clojure and I have 2 questions on float opertions: - why does (+ 4.2 8.4) return 12.601 and (+ 1.5 2.6) 4.1? Since 4.2, 8.4 and (+ 4.2 8.4) are java Doubles why does it not behave as expected? What does clojure do in the

Re: questions about float operations

2010-08-20 Thread David Sletten
This may help explain things: http://groups.google.com/group/clojure/msg/325228e8b66923ac Have all good days, David Sletten On Aug 20, 2010, at 8:26 AM, bufo wrote: I am currently learning clojure by reading The Joy of Clojure and I have 2 questions on float opertions: - why does (+ 4.2

Re: questions about float operations

2010-08-20 Thread Nicolas Oury
- why does (+ 4.2 8.4) return 12.601 and (+ 1.5 2.6) 4.1? Since 4.2, 8.4 and (+ 4.2 8.4) are java Doubles why does it not behave as expected? What does clojure do in the background? That's not a bug. Doubles have a standard. Clojure implementation follows the standard. (as most

Re: questions about float operations

2010-08-20 Thread B Smith-Mannschott
On Fri, Aug 20, 2010 at 14:26, bufo ferna...@gmail.com wrote: I am currently learning clojure by reading The Joy of Clojure and I have 2 questions on float opertions: - why does (+ 4.2 8.4) return 12.601 and (+ 1.5 2.6) 4.1? Since 4.2, 8.4 and (+ 4.2 8.4) are java Doubles why does