Raymond Toy pushed to branch issue-314-complex-tanh-incorrect-for-large-arg at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/irrat-dd.lisp
    ... ... @@ -1800,12 +1800,10 @@ Z may be any number, but the result is always a complex."
    1800 1800
     	(declare (optimize (speed 3) (space 0)
    
    1801 1801
     			   (inhibit-warnings 3)))
    
    1802 1802
           (cond ((> (abs x)
    
    1803
    -		#-(or linux hpux) #.(/ (%asinh most-positive-double-float) 4d0)
    
    1804
    -		;; This is more accurate under linux.
    
    1805
    -		#+(or linux hpux) #.(/ (+ (%log 2.0d0)
    
    1806
    -					  (%log most-positive-double-float)) 4d0))
    
    1803
    +                ;; Don't need double-double accuracy here.
    
    1804
    +		#.(/ (%asinh most-positive-double-float) 4d0))
    
    1807 1805
     	     (complex (float-sign x)
    
    1808
    -		      (float-sign y)))
    
    1806
    +		      (float-sign y 0w0)))
    
    1809 1807
     	    (t
    
    1810 1808
     	     (let* ((tv (dd-%tan y))
    
    1811 1809
     		    (beta (+ 1.0d0 (* tv tv)))
    

  • tests/irrat.lisp
    ... ... @@ -239,4 +239,9 @@
    239 239
                   (tanh #c(200d0 -200d0)))
    
    240 240
       (assert-eql (complex 1d0 +0d0)
    
    241 241
                   (tanh #c(200d0 +200d0)))
    
    242
    +  (assert-eql (complex 1w0 -0w0)
    
    243
    +              (tanh #c(200w0 -200w0)))
    
    244
    +  (assert-eql (complex 1w0 +0w0)
    
    245
    +              (tanh #c(200w0 200w0))))
    
    246
    +  
    
    242 247