Re:0.30000000000000004
by dragonwriter on Sunday April 02, 2017 @09:59PM
(#14020150)
This is solved by the Scheme numerical tower, which prefers exact representations (including exact rationals) unless inexact representation is explicitly requested or forced by an operation that doesn't support exact results.
[ Parent
| on HN ]
Re:0.30000000000000004
by Johnny_Brahms on Monday April 03, 2017 @03:11AM
(#14021105)
The problem is remembering to only input rationals :) So instead of doing (iota 100 0.1 0.1), you do (iota 100 (/ 1 10) (/ 1 10)). That does not work in chicken for some reason.
I don't know if precomputation is ever guaranteed for those things, but otherwise it would be neat to be able to input rationals directly into the source.
Edit: So, this is scheme standard discovery week: apparently inputing 1/10 works just fine. I can't believe I missed this.