double-float-exponent type lower bound off by one?
Describe the bug
The type double-float-exponent
is defined in "float-tran.lisp" by:
(deftype double-float-exponent ()
`(integer ,(- vm:double-float-normal-exponent-min vm:double-float-bias
vm:double-float-digits)
,(- vm:double-float-normal-exponent-max vm:double-float-bias)))
This is the correct range of exponents for IEEE-754, but
double-float-exponent
is supposed to be the type of the exponent
returned by decode-float
, which is different from the IEEE-754
exponent. the smallest exponent is (decode-float least-positive-double-float)
, -1073. The value above is -1074. The
maximum exponent is correct.
We have the same issue for the other exponents for single-float
.
The lower exponent bound for integer-decode-float
in
double-float-int-exponent
is also off by one. It's currently -1127,
but the smallest value is -1126 (from (integer-decode-float least-positive-double-float)
).
These should probably be updated. It's not terrible that the lower bound is off by one, but might as well make it tight.
To Reproduce
Steps to reproduce the behavior:
-
(nth-value 1 (decode-float least-positive-double-float))
=> -1073 -
(typep -1073 'kernel:double-float-exponent)
=> T, OK. -
(typep -1074 'kernel:double-float-exponent)
=> T, WRONG.
Desktop (please complete the following information):
- OS: All
- Version: snapshot-2021-07