soegaard / whalesong

Whalesong: Racket to JavaScript compiler
http://hashcollision.org/whalesong
145 stars 14 forks source link

(equal? 13 13.0) #3

Closed soegaard closed 7 years ago

soegaard commented 10 years ago

lang whalesong

(equal? 13 13) (equal? 13. 13) (equal? 13 13.) (equal? 13. 13.)

gives

true false false true

schanzer commented 9 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.

schanzer commented 9 years ago

The new library is complete: https://github.com/brownplt/pyret-lang/blob/20594854ec510ff44052f1d4e7714be86e0573bb/src/js/base/js-numbers.js

lexi-lambda commented 9 years ago

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?.

soegaard commented 7 years ago

lexi-lamda is correct. This is not a bug.