Raymond Toy pushed to branch issue-471-test-cases-for-pow at cmucl / cmucl
Commits:
-
6011e629
by Raymond Toy at 2026-02-06T17:25:39-08:00
1 changed file:
Changes:
| ... | ... | @@ -785,10 +785,27 @@ |
| 785 | 785 | |
| 786 | 786 | (define-test %pow.case.9
|
| 787 | 787 | (:tag :fdlibm)
|
| 788 | + ;; std::pow says 1^exp is 1 for any exp, including NaN. (-1)^(+/-inf)
|
|
| 789 | + ;; is 1. No errors signaled.
|
|
| 790 | + #+core-math
|
|
| 791 | + (progn
|
|
| 792 | + (assert-equal 1d0
|
|
| 793 | + (kernel:%pow 1d0 ext:double-float-positive-infinity))
|
|
| 794 | + (assert-equal 1d0
|
|
| 795 | + (kernel:%pow 1d0 ext:double-float-negative-infinity))
|
|
| 796 | + (assert-equal 1d0
|
|
| 797 | + (kernel:%pow 1d0 *qnan*))
|
|
| 798 | + (assert-equal 1d0
|
|
| 799 | + (kernel:%pow -1d0 ext:double-float-positive-infinity))
|
|
| 800 | + (assert-equal 1d0
|
|
| 801 | + (kernel:%pow -1d0 ext:double-float-negative-infinity)))
|
|
| 802 | + #-core-math
|
|
| 788 | 803 | ;; +-1 ^ +-inf is NaN.
|
| 789 | 804 | ;;
|
| 790 | 805 | ;; But the implementation signals invalid operation, so we need to
|
| 791 | 806 | ;; check for that.
|
| 807 | + ;;
|
|
| 808 | + (progn
|
|
| 792 | 809 | (assert-error 'floating-point-invalid-operation
|
| 793 | 810 | (kernel:%pow 1d0 ext:double-float-positive-infinity))
|
| 794 | 811 | (assert-error 'floating-point-invalid-operation
|
| ... | ... | @@ -805,7 +822,7 @@ |
| 805 | 822 | (assert-true (ext:float-nan-p
|
| 806 | 823 | (kernel:%pow -1d0 ext:double-float-positive-infinity)))
|
| 807 | 824 | (assert-true (ext:float-nan-p
|
| 808 | - (kernel:%pow -1d0 ext:double-float-negative-infinity)))))
|
|
| 825 | + (kernel:%pow -1d0 ext:double-float-negative-infinity))))))
|
|
| 809 | 826 | |
| 810 | 827 | (define-test %pow.case.10
|
| 811 | 828 | (:tag :fdlibm)
|