expt: repair for large power of inexact between 0 and -1
Closes PR 14824
This commit is contained in:
parent
b9d8f65fc9
commit
1e9d7c1d2a
|
@ -555,6 +555,17 @@
|
|||
(test 0.0 expt -10.0 -10000000000000.0)
|
||||
(test -0.0 expt -10.0 -10000000000001.0)
|
||||
|
||||
(test 0.0 expt 0.9999 (expt 2 5000))
|
||||
(test 0.0 expt 0.9999 (add1 (expt 2 5000)))
|
||||
(test 0.0 expt 0.9999 (/ (expt 2 5000) 3))
|
||||
(test 0.0 expt -0.9999 (expt 2 5000))
|
||||
(test -0.0 expt -0.9999 (add1 (expt 2 5000)))
|
||||
(test 0.0f0 expt 0.9999f0 (expt 2 5000))
|
||||
(test 0.0f0 expt 0.9999f0 (add1 (expt 2 5000)))
|
||||
(test 0.0f0 expt 0.9999f0 (/ (expt 2 5000) 3))
|
||||
(test 0.0f0 expt -0.9999f0 (expt 2 5000))
|
||||
(test -0.0f0 expt -0.9999f0 (add1 (expt 2 5000)))
|
||||
|
||||
(err/rt-test (max 0 'a))
|
||||
(err/rt-test (min 0 'a))
|
||||
(err/rt-test (max 'a 0))
|
||||
|
|
|
@ -3605,6 +3605,18 @@ scheme_expt(int argc, Scheme_Object *argv[])
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if ((d < 0.0) && (d > -1.0)) {
|
||||
/* If `e` is a positive bignum, then the result should be zero,
|
||||
but we won't get that result if conversion produces infinity */
|
||||
if (SCHEME_BIGNUMP(e) && SCHEME_BIGPOS(e)) {
|
||||
#ifdef MZ_USE_SINGLE_FLOATS
|
||||
int sgl = !SCHEME_DBLP(n);
|
||||
#endif
|
||||
if (SCHEME_FALSEP(scheme_odd_p(1, &e)))
|
||||
return SELECT_EXPT_PRECISION(scheme_zerof, scheme_zerod);
|
||||
else
|
||||
return SELECT_EXPT_PRECISION(scheme_nzerof, scheme_nzerod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user