Open noncombatant opened 1 year ago
The comparison of numbers is usually between integers, otherwise you have to account for float-point errors, which is expected behavior.
I think it's better to just implement a isclose
like function and register it with fe_cfunc()
and fe_set()
if you really need it.
Yes, I know that floating-point errors are expected. The trouble is that there is no way to detect or deal with them in terms of fe source code and in the REPL. I am proposing to resolve that in either of 2 ways.
(Regarding integers, the use of single-precision float
in fe means that the usable range of integers is only 23 bits, which is fairly small. double
provides 53 bits of integers.)
Thanks for publishing
fe
! It's very cool. Turning on more compiler warnings (I enjoy strange hobbies) I found this:I found that it is indeed a practical problem in the REPL: I have 2 expressions that print equal but for which
is
returnsnil
(correctly).I propose 2 possible fixes in the C file below: