Menu

#4979 float of an out-of-range integer raises a Lisp error, breaking comparison and sorting

None
open
nobody
float (18)
5
13 hours ago
13 hours ago
No

float(10^400) and is(10^400 > 1.0) both signal a raw Lisp FLOATING-POINT-OVERFLOW

Maxima 5.49post, SBCL 2.6.7.

(%i1) display2d:false$
(%i2) float(10^400);
Maxima encountered a Lisp error:
 arithmetic error FLOATING-POINT-OVERFLOW signalled
Operation was (* 1.0e300 1.0e300).
(%i3) is(10^400 > 1.0);
Maxima encountered a Lisp error:
 arithmetic error FLOATING-POINT-OVERFLOW signalled
Operation was (* 1.0e300 1.0e300).

Expected: (%i2) should either return an overflow-appropriate result or raise a Maxima-level error naming the problem. (%i3) needs no float conversion at all — 10^400 > 1.0 is decidable by sign and magnitude — and should return true.

Because the comparison goes through a float conversion, is, max, min and sort all fail on any list containing both a float and an integer beyond the double range.

Discussion


Log in to post a comment.