(flo:-inf.0))
assert-not-integer)
+(define pi 3.1415926535897932)
+(define pi/2 (/ pi 2))
+
(define-test 'asin-0
(lambda ()
(assert-eqv (asin 0) 0)
(define-enumerated-test 'asin
(vector
- (vector (/ (- (sqrt 6) (sqrt 2)) 4) (/ 3.1415926535897932 12))
- (vector (/ (sqrt (- 2 (sqrt 2))) 2) (/ 3.1415926535897932 8))
- (vector 1/2 (/ 3.1415926535897932 6))
- (vector (rsqrt 2) (/ 3.1415926535897932 4))
- (vector (/ (sqrt 3) 2) (/ 3.1415926535897932 3))
- (vector (/ (sqrt (+ 2 (sqrt 2))) 2) (* 3.1415926535897932 3/8))
- (vector (/ (+ (sqrt 6) (sqrt 2)) 4) (* 3.1415926535897932 5/12))
- (vector 1 (/ 3.1415926535897932 2))
+ (vector (/ (- (sqrt 6) (sqrt 2)) 4) (/ pi 12))
+ (vector (/ (sqrt (- 2 (sqrt 2))) 2) (/ pi 8))
+ (vector 1/2 (/ pi 6))
+ (vector (rsqrt 2) (/ pi 4))
+ (vector (/ (sqrt 3) 2) (/ pi 3))
+ (vector (/ (sqrt (+ 2 (sqrt 2))) 2) (* pi 3/8))
+ (vector (/ (+ (sqrt 6) (sqrt 2)) 4) (* pi 5/12))
+ (vector 1 (/ pi 2))
(vector 2 1.5707963267948966+1.3169578969248166i 'xfail)
(vector 2.+0.i 1.5707963267948966+1.3169578969248166i)
(vector 2.-0.i 1.5707963267948966-1.3169578969248166i)
(assert-eqv (acos 1.) 0.)
(assert-eqv (acos (identity-procedure 1.)) 0.)))
-(define pi/2 (/ 3.1415926535897932 2))
-
(define-enumerated-test 'acos
(vector
- (vector (/ (+ (sqrt 6) (sqrt 2)) 4) (/ 3.1415926535897932 12))
- (vector (/ (sqrt (+ 2 (sqrt 2))) 2) (/ 3.1415926535897932 8))
- (vector (/ (sqrt 3) 2) (/ 3.1415926535897932 6))
- (vector (rsqrt 2) (/ 3.1415926535897932 4))
- (vector 1/2 (/ 3.1415926535897932 3))
- (vector (/ (sqrt (- 2 (sqrt 2))) 2) (* 3.1415926535897932 3/8))
- (vector (/ (- (sqrt 6) (sqrt 2)) 4) (* 3.1415926535897932 5/12))
- (vector 0 (/ 3.1415926535897932 2))
+ (vector (/ (+ (sqrt 6) (sqrt 2)) 4) (/ pi 12))
+ (vector (/ (sqrt (+ 2 (sqrt 2))) 2) (/ pi 8))
+ (vector (/ (sqrt 3) 2) (/ pi 6))
+ (vector (rsqrt 2) (/ pi 4))
+ (vector 1/2 (/ pi 3))
+ (vector (/ (sqrt (- 2 (sqrt 2))) 2) (* pi 3/8))
+ (vector (/ (- (sqrt 6) (sqrt 2)) 4) (* pi 5/12))
+ (vector 0 (/ pi 2))
(vector 2 (* +i (log (- 2 (sqrt 3)))) 'xfail)
(vector 2.+0.i (* +i (log (- 2 (sqrt 3)))))
(vector 2.-0.i (* -i (log (- 2 (sqrt 3)))))
+ (vector -2 (+ pi (* +i (log (- 2 (sqrt 3))))))
+ (vector -2.+0.i (+ pi (* +i (log (- 2 (sqrt 3))))))
+ (vector -2.-0.i (+ pi (* -i (log (- 2 (sqrt 3))))))
;; -i log(z + sqrt(z^2 - 1))
- ;; = -i log(z + sqrt(z - 1) sqrt(z + 1))
- ;; = -i log(z (1 + sqrt(z - 1) sqrt(z + 1)/z))
- ;; = -i log(z) - i log1p(sqrt(z - 1) sqrt(z + 1)/z)
- (vector 1e150 (* +i (+ (log 1e150) (log 2))) 'xfail)
- (vector 1e150+0.i (* +i (+ (log 1e150) (log 2))) 'xfail)
- (vector 1e150-0.i (* -i (+ (log 1e150) (log 2))) 'xfail)
- (vector -1e150 (+ pi/2 (* +i (+ (log 1e150) (log 2)))) 'xfail)
- (vector -1e150+0.i (+ pi/2 (* +i (+ (log 1e150) (log 2)))) 'xfail)
- (vector -1e150-0.i (+ pi/2 (* -i (+ (log 1e150) (log 2)))) 'xfail)
- (vector 1e300 (* +i (+ (log 1e300) (log 2))) 'xfail)
- (vector 1e300+0.i (* +i (+ (log 1e300) (log 2))) 'xfail)
- (vector 1e300-0.i (* -i (+ (log 1e300) (log 2))) 'xfail)
- (vector -1e300 (+ pi/2 (* +i (+ (log 1e300) (log 2)))) 'xfail)
- (vector -1e300+0.i (+ pi/2 (* +i (+ (log 1e300) (log 2)))) 'xfail)
- (vector -1e300-0.i (+ pi/2 (* -i (+ (log 1e300) (log 2)))) 'xfail))
+ ;; \approx -i log(z + sqrt(z^2))
+ ;; = -i log(z + z)
+ ;; = -i log(2 z)
+ (vector 1e150 (* +i (log (* 2 1e150))) 'xfail)
+ (vector 1e150+0.i (* +i (log (* 2 1e150))) 'xfail)
+ (vector 1e150-0.i (* -i (log (* 2 1e150))) 'xfail)
+ (vector -1e150 (+ pi (* +i (log (* 2 1e150)))) 'xfail)
+ (vector -1e150+0.i (+ pi (* +i (log (* 2 1e150)))) 'xfail)
+ (vector -1e150-0.i (+ pi (* -i (log (* 2 1e150)))) 'xfail)
+ (vector 1e300 (* +i (log (* 2 1e300))) 'xfail)
+ (vector 1e300+0.i (* +i (log (* 2 1e300))) 'xfail)
+ (vector 1e300-0.i (* -i (log (* 2 1e300))) 'xfail)
+ (vector -1e300 (+ pi (* +i (log (* 2 1e300)))) 'xfail)
+ (vector -1e300+0.i (+ pi (* +i (log (* 2 1e300)))) 'xfail)
+ (vector -1e300-0.i (+ pi (* -i (log (* 2 1e300)))) 'xfail))
(lambda (v)
(let ((x (vector-ref v 0))
(t (vector-ref v 1))