Raymond Toy pushed to branch rtoy-setexception-inexact at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/lisp/s_expm1.c
    --- a/src/lisp/s_expm1.c
    +++ b/src/lisp/s_expm1.c
    @@ -160,8 +160,8 @@ Q5  =  -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
                     
     	    }
     	    if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */
    -		if(x+tiny<0.0)		/* raise inexact */
    -		return tiny-one;	/* return -1 */
    +                fdlibm_setexception(x, FDLIBM_INEXACT);
    +		return tiny - one;
     	    }
     	}
     
    

  • tests/fdlibm.lisp
    --- a/tests/fdlibm.lisp
    +++ b/tests/fdlibm.lisp
    @@ -163,7 +163,12 @@
     		 (kernel:%expm1 709.8d0))
         )
       (kernel::with-float-traps-masked (:invalid)
    -    (assert-true (ext::float-nan-p (kernel:%expm1 *snan*)))))
    +    (assert-true (ext::float-nan-p (kernel:%expm1 *snan*))))
    +  ;; expm1(x) = -1 for x < -56*log(2), signaling inexact
    +  (let ((x (* -57 (log 2d0))))
    +    (with-inexact-exception-enabled
    +	(assert-error 'floating-point-inexact
    +		      (kernel:%expm1 x)))))
     
     (define-test %log1p.exceptions
       (:tag :fdlibm)