* Added flsqrt.

This commit is contained in:
Abdulaziz Ghuloum 2007-06-13 14:00:29 +03:00
parent ded64db389
commit 89fd9d0a23
3 changed files with 9 additions and 2 deletions

Binary file not shown.

View File

@ -102,7 +102,7 @@
positive? expt gcd lcm numerator denominator exact-integer-sqrt
quotient+remainder number->string string->number min max
exact->inexact floor ceiling round log fl=? fl<? fl<=? fl>?
fl>=? fl+ fl- fl* fl/)
fl>=? fl+ fl- fl* fl/ flsqrt)
(import
(ikarus system $fx)
(ikarus system $flonums)
@ -116,7 +116,7 @@
string->number expt gcd lcm numerator denominator
exact->inexact floor ceiling round log
exact-integer-sqrt min max
fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/))
fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/ flsqrt))
(define (fixnum->flonum x)
(foreign-call "ikrt_fixnum_to_flonum" x))
@ -1457,6 +1457,12 @@
[(ratnum? x) (/ (sqrt ($ratnum-n x)) (sqrt ($ratnum-d x)))]
[else (error 'sqrt "unsupported ~s" x)])))
(define flsqrt
(lambda (x)
(if (flonum? x)
(foreign-call "ikrt_fl_sqrt" x)
(error 'flsqrt "~s is not a flonum" x))))
(define exact-integer-sqrt
(lambda (x)
(define who 'exact-integer-sqrt)

View File

@ -376,6 +376,7 @@
[fl* i rfl]
[fl- i rfl]
[fl/ i rfl]
[flsqrt i rfl]
[fixnum->string i]
[string->flonum i]
[- i r]