Fix exponentiation of negative single-floats and moderately large bignums.
This commit is contained in:
parent
a389678556
commit
e7e75c2292
|
@ -572,6 +572,9 @@
|
|||
(test -inf.0 expt -4.0 (add1 (expt 2 5000)))
|
||||
(test +inf.f expt -4.0f0 (expt 2 5000))
|
||||
(test -inf.f expt -4.0f0 (add1 (expt 2 5000)))
|
||||
;; exponent large enough to overflow singles, but not doubles
|
||||
(test +inf.f expt -4.0f0 (lcm (exact-round -1.7976931348623151e+308)))
|
||||
(test -inf.f expt -4.0f0 (add1 (lcm (exact-round -1.7976931348623151e+308))))
|
||||
|
||||
(define (inf-non-real? x)
|
||||
(and (not (real? x))
|
||||
|
|
|
@ -3634,7 +3634,16 @@ scheme_expt(int argc, Scheme_Object *argv[])
|
|||
be converted to infinity, this would return a complex NaN.
|
||||
Instead, we want to return (positive of negative) infinity.
|
||||
See discussion in Github issue 1148. */
|
||||
#ifdef MZ_USE_SINGLE_FLOATS
|
||||
if (sgl) {
|
||||
/* Need to go through singles to get right overflow behavior. */
|
||||
e_dbl = (double)(scheme_bignum_to_float(e));
|
||||
} else {
|
||||
e_dbl = scheme_bignum_to_double(e);
|
||||
}
|
||||
#else
|
||||
e_dbl = scheme_bignum_to_double(e);
|
||||
#endif
|
||||
if ((d < 0.0) && MZ_IS_POS_INFINITY(e_dbl)) {
|
||||
if (SCHEME_TRUEP(scheme_odd_p(1, &e))) {
|
||||
return SELECT_EXPT_PRECISION(scheme_single_minus_inf_object,
|
||||
|
|
Loading…
Reference in New Issue
Block a user