Skip to content
Snippets Groups Projects
Commit 80df05a1 authored by Raymond Toy's avatar Raymond Toy
Browse files

Make cosh signal overflow when it should overflow.

 * lisp/e_cosh.c:
   * The compiler replaced the code huge*huge with infinity instead of
     doing the operation.  Change it so it does fabs(x)*huge, which
     forces the compiler to do the multiplication.
   * Change huge from 1e300 to 1e307 so that fabs(x)*huge will
     actually overflow when |x| > overflowthreshold.
 * tests/trig.lisp:
   * Add tests for sinh and cosh signaling overflow appropriately.
 * general-info/release-20f.txt:
   * Update.
parent ab446830
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,8 @@ New in this release:
DEFINE-CONDITION. (From Helmut Eller.)
* The lisp executable is now compiled to use SSE2 on x86 machines;
CMUCL will not run on chips without SSE2 anymore.
* (cosh 1000d0) signals an overflow error as it
should. Previously, it just incorrectly returned infinity.
* ANSI compliance fixes:
* The values on the branch cuts for the inverse trig and
......
......@@ -35,9 +35,9 @@
#include "fdlibm.h"
#ifdef __STDC__
static const double one = 1.0, half=0.5, huge = 1.0e300;
static const double one = 1.0, half=0.5, huge = 1.0e307;
#else
static double one = 1.0, half=0.5, huge = 1.0e300;
static double one = 1.0, half=0.5, huge = 1.0e307;
#endif
#ifdef __STDC__
......@@ -91,5 +91,5 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
}
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
return fabs(x)*huge;
}
......@@ -791,3 +791,13 @@
(get-signs (atanh-def #c(2d0 +1d-20)))
(assert-true (check-signs #'atanh #c(2d0 0d0) tr ti))
(assert-true (check-signs #'atanh #c(2w0 0w0) tr ti))))
(define-test cosh.overflow
(:tag :cosh)
(assert-error 'floating-point-overflow
(cosh 1000d0)))
(define-test sinh.overflow
(:tag :sinh)
(assert-error 'floating-point-overflow
(sinh 1000d0)))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment