The binary search controversy has improperly gone from the definition of numbers in poorly designed languages to the "static vs. dynamic" debate, which has no bearing on this topic. Then the question came up about floating point and why even Smalltalk accepts that 1e16 + 1
is equal to 1e16
when using a floating point (i.e. inexact) representation of integers.
The numerical tower in Scheme explicitly defines what number representations and procedures deal with exact or with inexact math. You get to choose, for instance based on whether you need speed or accuracy.
> (+ 2/3 1/3) 1 > exact->inexact #inexact> > (exact->inexact 1/3) .3333333333333333 > (= (+ 1 10000000000000000) (+ 1 (exact->inexact 10000000000000000))) #f > (= 1e16 (exact->inexact 10000000000000000)) #t
No comments:
Post a Comment