| ... |
... |
@@ -349,7 +349,9 @@ |
|
349
|
349
|
;; acosh(2^50), case 2^28 < x
|
|
350
|
350
|
(assert-eql 35.35050620855721d0 (acosh (scale-float 1d0 50)))
|
|
351
|
351
|
;; No overflow for most positive
|
|
352
|
|
- (assert-eql 710.4758600739439d0 (acosh most-positive-double-float)))
|
|
|
352
|
+ (assert-eql #-core-math 710.4758600739439d0
|
|
|
353
|
+ #+core-math 710.475860073944d0
|
|
|
354
|
+ (acosh most-positive-double-float)))
|
|
353
|
355
|
|
|
354
|
356
|
(define-test asinh-basic-tests
|
|
355
|
357
|
(:tag :fdlibm)
|
| ... |
... |
@@ -378,8 +380,12 @@ |
|
378
|
380
|
(assert-eql -20.101268236238415d0 (asinh (- x))))
|
|
379
|
381
|
(let ((x most-positive-double-float))
|
|
380
|
382
|
;; No overflow for most-positive-double-float
|
|
381
|
|
- (assert-eql 710.4758600739439d0 (asinh x))
|
|
382
|
|
- (assert-eql -710.4758600739439d0 (asinh (- x)))))
|
|
|
383
|
+ (assert-eql #-core-math 710.4758600739439d0
|
|
|
384
|
+ #+core-math 710.475860073944d0
|
|
|
385
|
+ (asinh x))
|
|
|
386
|
+ (assert-eql #-core-math -710.4758600739439d0
|
|
|
387
|
+ #+core-math -710.475860073944d0
|
|
|
388
|
+ (asinh (- x)))))
|
|
383
|
389
|
|
|
384
|
390
|
(define-test atanh-basic-tests
|
|
385
|
391
|
(:tag :fdlibm)
|
| ... |
... |
@@ -517,34 +523,52 @@ |
|
517
|
523
|
;; |log(x) + log(1/x)| < 1.77635684e-15, x = 1.2^k, 0 <= k < 2000
|
|
518
|
524
|
;; The threshold is experimentally determined
|
|
519
|
525
|
(let ((x 1d0)
|
|
520
|
|
- (max-value -1d0))
|
|
|
526
|
+ (max-value -1d0)
|
|
|
527
|
+ (worst-x 0d0))
|
|
521
|
528
|
(declare (double-float max-value)
|
|
522
|
529
|
(type (double-float 1d0) x))
|
|
523
|
530
|
(dotimes (k 2000)
|
|
524
|
531
|
(let ((y (abs (+ (log x) (log (/ x))))))
|
|
525
|
|
- (setf max-value (max max-value y))
|
|
|
532
|
+ (when (> y max-value)
|
|
|
533
|
+ (setf worst-x x
|
|
|
534
|
+ max-value y))
|
|
526
|
535
|
(setf x (* x 1.4d0))))
|
|
527
|
|
- (assert-true (< max-value 1.77635684d-15)))
|
|
|
536
|
+ (assert-true (< max-value
|
|
|
537
|
+ #-core-math 1.77635684d-15
|
|
|
538
|
+ #+core-math 1.42108548d-14)
|
|
|
539
|
+ max-value
|
|
|
540
|
+ worst-x))
|
|
528
|
541
|
;; |exp(log(x)) - x|/x < 5.6766649d-14, x = 1.4^k, 0 <= k < 2000
|
|
529
|
542
|
(let ((x 1d0)
|
|
530
|
|
- (max-error 0d0))
|
|
531
|
|
- (declare (double-float max-error)
|
|
|
543
|
+ (max-error 0d0)
|
|
|
544
|
+ (worst-x 0d0))
|
|
|
545
|
+ (declare (double-float max-error worst-x worst-y)
|
|
532
|
546
|
(type (double-float 1d0) x))
|
|
533
|
547
|
(dotimes (k 2000)
|
|
534
|
548
|
(let ((y (abs (/ (- (exp (log x)) x) x))))
|
|
535
|
|
- (setf max-error (max max-error y))
|
|
|
549
|
+ (when (> y max-error)
|
|
|
550
|
+ (setf worst-x x
|
|
|
551
|
+ max-error y))
|
|
536
|
552
|
(setf x (* x 1.4d0))))
|
|
537
|
|
- (assert-true (< max-error 5.6766649d-14)))
|
|
|
553
|
+ (assert-true (< max-error 5.6766649d-14)
|
|
|
554
|
+ max-error
|
|
|
555
|
+ worst-x
|
|
|
556
|
+ worst-y))
|
|
538
|
557
|
;; |exp(log(x)) - x|/x < 5.68410245d-14, x = 1.4^(-k), 0 <= k < 2000
|
|
539
|
558
|
(let ((x 1d0)
|
|
540
|
|
- (max-error 0d0))
|
|
541
|
|
- (declare (double-float max-error)
|
|
|
559
|
+ (max-error 0d0)
|
|
|
560
|
+ (worst-x 0d0))
|
|
|
561
|
+ (declare (double-float max-error worst-x worst-y)
|
|
542
|
562
|
(type (double-float (0d0)) x))
|
|
543
|
563
|
(dotimes (k 2000)
|
|
544
|
564
|
(let ((y (abs (/ (- (exp (log x)) x) x))))
|
|
545
|
|
- (setf max-error (max max-error y))
|
|
|
565
|
+ (when (> y max-error)
|
|
|
566
|
+ (setf worst-x x
|
|
|
567
|
+ max-error y))
|
|
546
|
568
|
(setf x (/ x 1.4d0))))
|
|
547
|
|
- (assert-true (< max-error 5.68410245d-14))))
|
|
|
569
|
+ (assert-true (< max-error 5.68410245d-14)
|
|
|
570
|
+ max-error
|
|
|
571
|
+ worst-x)))
|
|
548
|
572
|
|
|
549
|
573
|
(define-test sinh-basic-tests
|
|
550
|
574
|
(:tag :fdlibm)
|