Re: float vs fraction (just playing around)

2009-03-08 Thread Mark H.
On Mar 6, 8:06 pm, David Sletten wrote: > It comes as no surprise that certain numbers cannot be represented by   > a finite string of decimal digits. We all realize that 1/3 =   > 0...., and the "..." part is critical. Take it away and the   > equality goes away too. In other words, if that

Re: float vs fraction (just playing around)

2009-03-06 Thread mike.farn...@gmail.com
Thanks for the very detailed explanation and all of the code examples. I was a bit twiddler a long time ago. (I enjoyed reading the opcodes in the mainframe dumps) Lisp is a new language. And, I think it counts as the Language of theYear, since it is so different than Java. I was playing with ja

Re: float vs fraction (just playing around)

2009-03-06 Thread David Sletten
On Mar 5, 2009, at 8:00 PM, mike.farn...@gmail.com wrote: > > I thought it neat that clojure supports fractions (just like > Smalltalk). > user=> (/ 3) > 1/3 > > I was sort of surprised by this. > > user=> (+ (float (* (/ 2) (/ 3))) (float (* (/ 2) (/ 3))) ) > 0.3334 It comes as no surprise

Re: float vs fraction (just playing around)

2009-03-06 Thread Mark H.
On Mar 5, 10:00 pm, "mike.farn...@gmail.com" wrote: > I was sort of surprised by this. > > user=> (+ (float (* (/ 2) (/ 3))) (float (* (/ 2) (/ 3))) ) > 0.3334 > >  (=  (+ (float (* (/ 2) (/ 3))) (float (* (/ 2) (/ 3))) ) (/ 3) ) > yields true > > How is tracking these number internally? > >

float vs fraction (just playing around)

2009-03-06 Thread mike.farn...@gmail.com
I thought it neat that clojure supports fractions (just like Smalltalk). user=> (/ 3) 1/3 I was sort of surprised by this. user=> (+ (float (* (/ 2) (/ 3))) (float (* (/ 2) (/ 3))) ) 0.3334 (= (+ (float (* (/ 2) (/ 3))) (float (* (/ 2) (/ 3))) ) (/ 3) ) yields true How is tracking these