Closed anttih closed 1 year ago
I think it's reasonable behavior, there is no positive fixnum of the same magnitude as most-negative-fixnum
, so the error message is correct. It would be worse to return a bignum, in which case you'd have to check the type of the output of fxabs
before using it in further fixnum operations.
All the fxsomething
functions raise an error in these cases like (fx+ (most-positive-fixnum) 1)
.
It's more obvious to me that normal operations (like addition) overflow. I was just a bit surprised that there is no valid positive fixnum for the most-negative-fixnum
. But there is probably a good reason for this. Thanks!
Fixnum overflows when called with
(most-nagative-fixnum)
:This seems like a bug to me because
fxabs
doesn't take as argument a value that should be a valid fixnum.