Re: Numbers/math in Clojure

2017-06-27 Thread Phillip Lord
Alex Miller writes: > On Sunday, June 25, 2017 at 1:55:42 AM UTC-5, henrik42 wrote: >>> Oh, I thought because there is the float-function floats are supported. >> Clojure could use "0.2f" to print/read floats and still use double "0.2" as >> the default (but float's "Infinity" may be challengin

Re: Numbers/math in Clojure

2017-06-25 Thread Alex Miller
On Sunday, June 25, 2017 at 1:55:42 AM UTC-5, henrik42 wrote: > > Alex, > > Am Samstag, 24. Juni 2017 13:38:55 UTC schrieb Alex Miller: >> >> >> >> Oh, I thought because there is the float-function floats are supported. > Clojure could use "0.2f" to print/read floats and still use double "0.2" a

Re: Numbers/math in Clojure

2017-06-24 Thread henrik42
Alex, Am Samstag, 24. Juni 2017 13:38:55 UTC schrieb Alex Miller: > > > Due to how single and double precision floats are stored, you'll get these > same results in Java too. These will store differently imprecise > representations of the number (remember base 2, not 10). > > user=> (Integer/toB

Re: Numbers/math in Clojure

2017-06-24 Thread Alex Miller
On Saturday, June 24, 2017 at 3:36:21 AM UTC-5, henrik42 wrote: > > Hi, > > I'm doing a little write-up on Java basics and comparing some of them > to Clojure (things like mutable shared state, side effects and so > on). When I came to "numbers" I was surprised by some of the things I > found in

Numbers/math in Clojure

2017-06-24 Thread henrik42
Hi, I'm doing a little write-up on Java basics and comparing some of them to Clojure (things like mutable shared state, side effects and so on). When I came to "numbers" I was surprised by some of the things I found in Clojure. (== (double 0.5) (float 0.5)) ;; -> true (== (double 0.2) (fl