Closed soegaard closed 7 years ago
There's no easy fix here: This is due to problems in the js-numbers library, which (sadly) has a lot of limitations. You may want to look at Pyret's numbers library, which was designed to serve as a drop-in replacement for the existing one.
The new library is complete: https://github.com/brownplt/pyret-lang/blob/20594854ec510ff44052f1d4e7714be86e0573bb/src/js/base/js-numbers.js
I don't think this is a bug: Racket has the same behavior. If you want to compare numeric values regardless of their types, use =
, not equal?
.
lexi-lamda is correct. This is not a bug.
lang whalesong
(equal? 13 13) (equal? 13. 13) (equal? 13 13.) (equal? 13. 13.)
gives
true false false true