`exact` applied to NaNs and infinites returns `-2147483648`
jpellegrini opened this issue ยท 6 comments
Hi!
Maybe it would be nice to signal an error instead?
(exact +inf.0) => -2147483648
(exact +nan.0) => -2147483648
otherwise, weird things like the following will happen...
(integer? (exact +inf.0)) => #t ; a finite infinity!
Thanks for the report! I agree this would be a better behavior.
We could also do a better job computing exact
for large double's. These should be converted to bignums if they are outside the fixnum range.
We could also do a better job computing
exact
for large double's. These should be converted to bignums if they are outside the fixnum range.
That would be great!
Also, since you mentioned, I see that Cyclone has a bignum?
predicate, but not fixnum?
. Maybe it would be nice to have the latter too?
There is a fixnum?
procedure, though it is a bit buried in SRFI 143 rather than always being included in the REPL environment: https://github.com/justinethier/cyclone/blob/master/docs/api/srfi/143.md
There is a
fixnum?
procedure, though it is a bit buried in SRFI 143 rather than always being included in the REPL environment: https://github.com/justinethier/cyclone/blob/master/docs/api/srfi/143.md
Isn't it convenient / useful enough to have in the REPL environment? (Not really complaining -- it it's there, it's good enough already!)
Added code to signal an error when exact
receives a NAN or infinite value.
Also tightened up support for other types of edge cases involving doubles, bignums, and complex numbers.
Yes, I've just tested and it works fine here! Thanks!
I guess this PR can be closed...