(assert-eqv (flo:ulp x) u))))))
(define-enumerated-test 'copysign
- '((0. 0. 0.)
+ `((0. 0. 0.)
(0. -0. -0.)
(0. 1. 0.)
(0. -1. -0.)
(0. +inf.0 0.)
(0. -inf.0 -0.)
+ (0. ,(flo:make-nan #t #t 0) -0.)
+ (0. ,(flo:make-nan #f #t 0) 0.)
+ (0. ,(flo:make-nan #t #f 1) -0.)
+ (0. ,(flo:make-nan #f #f 1) 0.)
(1. 0. 1.)
(1. -0. -1.)
(1. 1. 1.)
(1. -1. -1.)
(1. +inf.0 1.)
(1. -inf.0 -1.)
+ (1. ,(flo:make-nan #t #t 0) -1.)
+ (1. ,(flo:make-nan #f #t 0) 1.)
+ (1. ,(flo:make-nan #t #f 1) -1.)
+ (1. ,(flo:make-nan #f #f 1) 1.)
(+inf.0 0. +inf.0)
(+inf.0 -0. -inf.0)
(+inf.0 1. +inf.0)
(+inf.0 -1. -inf.0)
(+inf.0 +inf.0 +inf.0)
(+inf.0 -inf.0 -inf.0)
+ (+inf.0 ,(flo:make-nan #t #t 0) -inf.0)
+ (+inf.0 ,(flo:make-nan #f #t 0) +inf.0)
+ (+inf.0 ,(flo:make-nan #t #f 1) -inf.0)
+ (+inf.0 ,(flo:make-nan #f #f 1) +inf.0)
(-inf.0 0. +inf.0)
(-inf.0 -0. -inf.0)
(-inf.0 1. +inf.0)
(-inf.0 -1. -inf.0)
(-inf.0 +inf.0 +inf.0)
- (-inf.0 -inf.0 -inf.0))
+ (-inf.0 -inf.0 -inf.0)
+ (-inf.0 ,(flo:make-nan #t #t 0) -inf.0)
+ (-inf.0 ,(flo:make-nan #f #t 0) +inf.0)
+ (-inf.0 ,(flo:make-nan #t #f 1) -inf.0)
+ (-inf.0 ,(flo:make-nan #f #f 1) +inf.0))
(lambda (x y z)
- (assert-eqv (yes-traps (lambda () (flo:copysign x y))) z)))
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign x y))) z)))
+
+(define-enumerated-test 'copysign-var/neg
+ `((-inf.0 -inf.0)
+ (-1. -1.)
+ (-0. -0.)
+ (0. -0.)
+ (1. -1.)
+ (+inf.0 -inf.0)
+ (,(flo:make-nan #t #t 1234) ,(flo:make-nan #t #t 1234))
+ (,(flo:make-nan #f #t 1234) ,(flo:make-nan #t #t 1234))
+ (,(flo:make-nan #t #f 1234) ,(flo:make-nan #t #f 1234))
+ (,(flo:make-nan #f #f 1234) ,(flo:make-nan #t #f 1234)))
+ (lambda (x z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign x -1.23))) z)))
+
+(define-enumerated-test 'copysign-var/pos
+ `((-inf.0 +inf.0)
+ (-1. +1.)
+ (-0. +0.)
+ (0. +0.)
+ (1. +1.)
+ (+inf.0 +inf.0)
+ (,(flo:make-nan #t #t 1234) ,(flo:make-nan #f #t 1234))
+ (,(flo:make-nan #f #t 1234) ,(flo:make-nan #f #t 1234))
+ (,(flo:make-nan #t #f 1234) ,(flo:make-nan #f #f 1234))
+ (,(flo:make-nan #f #f 1234) ,(flo:make-nan #f #f 1234)))
+ (lambda (x z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign x +1.23))) z)))
+
+(define-enumerated-test 'copysign-1.23/var
+ `((-inf.0 -1.23)
+ (-1. -1.23)
+ (-0. -1.23)
+ (0. 1.23)
+ (1. 1.23)
+ (+inf.0 1.23)
+ (,(flo:make-nan #t #t 1234) -1.23)
+ (,(flo:make-nan #f #t 1234) 1.23)
+ (,(flo:make-nan #t #f 1234) -1.23)
+ (,(flo:make-nan #f #f 1234) 1.23))
+ (lambda (x z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign -1.23 x))) z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign +1.23 x))) z)))
+
+(define-enumerated-test 'copysign-0/var
+ `((-inf.0 -0.)
+ (-1. -0.)
+ (-0. -0.)
+ (0. +0.)
+ (1. +0.)
+ (+inf.0 +0.)
+ (,(flo:make-nan #t #t 1234) -0.)
+ (,(flo:make-nan #f #t 1234) +0.)
+ (,(flo:make-nan #t #f 1234) -0.)
+ (,(flo:make-nan #f #f 1234) +0.))
+ (lambda (x z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign -0. x))) z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign +0. x))) z)))
+
+(define-enumerated-test 'copysign-inf/var
+ `((-inf.0 -inf.0)
+ (-1. -inf.0)
+ (-0. -inf.0)
+ (0. +inf.0)
+ (1. +inf.0)
+ (+inf.0 +inf.0)
+ (,(flo:make-nan #t #t 1234) -inf.0)
+ (,(flo:make-nan #f #t 1234) +inf.0)
+ (,(flo:make-nan #t #f 1234) -inf.0)
+ (,(flo:make-nan #f #f 1234) +inf.0))
+ (lambda (x z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign -inf.0 x))) z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign +inf.0 x))) z)))
+
+(define-enumerated-test 'copysign-qnan/var
+ `((-inf.0 ,(flo:make-nan #t #t 54321))
+ (-1. ,(flo:make-nan #t #t 54321))
+ (-0. ,(flo:make-nan #t #t 54321))
+ (0. ,(flo:make-nan #f #t 54321))
+ (1. ,(flo:make-nan #f #t 54321))
+ (+inf.0 ,(flo:make-nan #f #t 54321))
+ (,(flo:make-nan #t #t 1234) ,(flo:make-nan #t #t 54321))
+ (,(flo:make-nan #f #t 1234) ,(flo:make-nan #f #t 54321))
+ (,(flo:make-nan #t #f 1234) ,(flo:make-nan #t #t 54321))
+ (,(flo:make-nan #f #f 1234) ,(flo:make-nan #f #t 54321)))
+ (lambda (x z)
+ (let ((nan+ (flo:make-nan #f #t 54321))
+ (nan- (flo:make-nan #t #t 54321)))
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign nan+ x))) z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign nan- x))) z))))
+
+(define-enumerated-test 'copysign-snan/var
+ `((-inf.0 ,(flo:make-nan #t #f 54321))
+ (-1. ,(flo:make-nan #t #f 54321))
+ (-0. ,(flo:make-nan #t #f 54321))
+ (0. ,(flo:make-nan #f #f 54321))
+ (1. ,(flo:make-nan #f #f 54321))
+ (+inf.0 ,(flo:make-nan #f #f 54321))
+ (,(flo:make-nan #t #t 1234) ,(flo:make-nan #t #f 54321))
+ (,(flo:make-nan #f #t 1234) ,(flo:make-nan #f #f 54321))
+ (,(flo:make-nan #t #f 1234) ,(flo:make-nan #t #f 54321))
+ (,(flo:make-nan #f #f 1234) ,(flo:make-nan #f #f 54321)))
+ (lambda (x z)
+ (let ((nan+ (flo:make-nan #f #f 54321))
+ (nan- (flo:make-nan #t #f 54321)))
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign nan+ x))) z)
+ (assert-eqv-nan (yes-traps (lambda () (flo:copysign nan- x))) z))))
(define-enumerated-test 'nextafter
`((0. 1. ,subnormal+)