(4 2)
(4. 2.)
;; Square root of perfect square x times 2i should be exactly x+xi.
+ (,(make-rectangular 0 (* 2 (expt 2 -4000)))
+ ,(make-rectangular (expt 2 -2000) (expt 2 -2000))
+ ,expect-failure)
+ (,(make-rectangular 0. (* 2 flo:smallest-positive-subnormal))
+ ,(make-rectangular (expt 2. (/ flo:subnormal-exponent-min 2))
+ (expt 2. (/ flo:subnormal-exponent-min 2)))
+ ,expect-failure)
+ (+.125i .25+.25i ,expect-failure)
+ (+1/8i 1/4+1/4i ,expect-failure)
(+2i 1+1i ,expect-failure)
(+8i 2+2i ,expect-failure)
(+18i 3+3i ,expect-failure)
(+8.i 2.+2.i ,expect-failure)
(+18.i 3.+3.i ,expect-failure)
(+32.i 4.+4.i ,expect-failure)
+ (,(make-rectangular 0. (expt 2. flo:normal-exponent-max))
+ ,(make-rectangular (expt 2. (/ (- flo:normal-exponent-max 1) 2))
+ (expt 2. (/ (- flo:normal-exponent-max 1) 2)))
+ ,expect-failure)
+ (,(make-rectangular 0 (* 2 (expt 2 4000)))
+ ,(make-rectangular (expt 2 2000) (expt 2 2000))
+ ,expect-error)
;; Likewise, sqrt of perfect square x times -2i should be x-xi.
+ (,(make-rectangular 0 (* -2 (expt 2 -4000)))
+ ,(make-rectangular (expt 2 -2000) (- (expt 2 -2000)))
+ ,expect-failure)
+ (,(make-rectangular 0. (- (* 2 flo:smallest-positive-subnormal)))
+ ,(make-rectangular
+ (expt 2. (/ flo:subnormal-exponent-min 2))
+ (- (expt 2. (/ flo:subnormal-exponent-min 2))))
+ ,expect-failure)
+ (-.125i .25-.25i ,expect-failure)
+ (-1/8i 1/4-1/4i ,expect-failure)
(-2i 1-1i ,expect-failure)
(-8i 2-2i ,expect-failure)
(-18i 3-3i ,expect-failure)
(-8.i 2.-2.i ,expect-failure)
(-18.i 3.-3.i ,expect-failure)
(-32.i 4.-4.i ,expect-failure)
+ (,(make-rectangular 0. (- (expt 2. flo:normal-exponent-max)))
+ ,(make-rectangular (expt 2. (/ (- flo:normal-exponent-max 1) 2))
+ (- (expt 2. (/ (- flo:normal-exponent-max 1) 2))))
+ ,expect-failure)
+ (,(make-rectangular 0 (- (* 2 (expt 2 4000))))
+ ,(make-rectangular (expt 2 2000) (- (expt 2 2000)))
+ ,expect-error)
;; Handle signed zero carefully.
(+0.i 0.+0.i)
(-0.i 0.-0.i ,expect-failure)