Next: , Previous: , Up: syslib numerics   [Index]


12.10.26 Square root of numbers

Unsafe Operation: $sqrt-fixnum fx

Compute the principal square root of fx; return an unspecified number object.

($sqrt-fixnum 0)       ⇒ 0

($sqrt-fixnum +1)      ⇒ +1
($sqrt-fixnum -1)      ⇒ +1i

($sqrt-fixnum +4)      ⇒ +2
($sqrt-fixnum -4)      ⇒ +2i

($sqrt-fixnum +5)      ⇒ 2.23606797749979
($sqrt-fixnum -5)      ⇒ 0.0+2.23606797749979i
Unsafe Operation: $sqrt-bignum bn

Compute the principal square root of bn; return an unspecified number object.

(define SMALLEST-POSITIVE-BIGNUM (-    (least-fixnum)))
(define SMALLEST-NEGATIVE-BIGNUM (+ -1 (least-fixnum)))

(define BN1 (+ +1  SMALLEST-POSITIVE-BIGNUM))
(define BN2 (+ +10 SMALLEST-POSITIVE-BIGNUM))
(define BN3 (+ -1  SMALLEST-NEGATIVE-BIGNUM))
(define BN4 (+ -10 SMALLEST-NEGATIVE-BIGNUM))

;; on a 32-bit host
($sqrt-bignum BN1)      ⇒ 23170.475027499975
($sqrt-bignum BN2)      ⇒ 23170.47522171265
($sqrt-bignum BN3)      ⇒ 0.0+23170.475049079163i
($sqrt-bignum BN4)      ⇒ 0.0+23170.47524329184i
Unsafe Operation: $sqrt-ratnum rt

Compute the principal square root of rt; return an unspecified number object.

Unsafe Operation: $sqrt-flonum fl

Compute the principal square root of fl; return a flonum, compnum or cflonum.

($sqrt-flonum +0.0)     ⇒ +0.0
($sqrt-flonum -0.0)     ⇒ +0.0i

($sqrt-flonum +4.0)     ⇒ +2.0
($sqrt-flonum -4.0)     ⇒ +2.0i

($sqrt-flonum +1.0)     ⇒ +1.0
($sqrt-flonum -1.0)     ⇒ +1.0i

($sqrt-flonum +5.0)     ⇒ 2.23606797749979
($sqrt-flonum -5.0)     ⇒ 0.0+2.23606797749979i

($sqrt-flonum +inf.0)   ⇒ +inf.0
($sqrt-flonum -inf.0)   ⇒ +inf.0i

($sqrt-flonum +nan.0)   ⇒ +nan.0
Unsafe Operation: $sqrt-compnum cn

Compute the principal square root of cn; return an unspecified number object.

Unsafe Operation: $sqrt-cflonum cfl

Compute the principal square root of cfl; return a cflonum.

Unsafe Operation: $exact-integer-sqrt-fixnum fx

Return two non–negative exact integer objects being the root and the residual of fx.

Unsafe Operation: $exact-integer-sqrt-bignum bn

Return two non–negative exact integer objects being the root and the residual of bn.


Next: , Previous: , Up: syslib numerics   [Index]