Hi good folks!
Whats going on here?
(1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3) // 2.0
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)).asInteger // 1
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)).ceil.asInteger // 2
(1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3) == 2.0 // false
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)).ceil == 2.0 // true
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)) + 1.0 == 3.0 // true
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)) + 0.2 == 2.2 // false
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)) + 0.3 == 2.3 // true
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)) + 0.201 == 2.201 // false
((1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)) + 0.202 == 2.202 // true
(1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3) == (6/3) // false
(1/3) + (1/3) == 0.66666666666667 // false
(1/3) + (1/3) == (2/3) // true
Its all float imperfections?
In lisp fractions will stay fractions until they are made rationals. (1/3) + (1/3) equals 2/3 not a rounded 0.66666666666667. So in sclang a fraction becomes a rational immediately? Or they are really just a syntactical representation of a rational? So where and why exactly does this rounding error happen?
Its is puzzling to me how the language can return
(1/3) + (1/3) + (1/3) + (1/3) + (1/3) + (1/3)
as 2.0, when it is not really 2.0 until some procedural magic has rounded it up/down and made it 2.0
