* Added native support for $fl+, $fl-, $fl*, $fl/

This commit is contained in:
Abdulaziz Ghuloum
2007-06-15 08:53:34 +03:00
parent f1674cbaef
commit 3acdcb6c04
11 changed files with 220 additions and 46 deletions
+14 -11
View File
@@ -337,14 +337,17 @@
(define (ratnum->flonum x)
(binary/ (exact->inexact ($ratnum-n x))
(exact->inexact ($ratnum-d x))))
(define ($fl+ x y)
(foreign-call "ikrt_fl_plus" x y))
(define ($fl- x y)
(foreign-call "ikrt_fl_minus" x y))
(define ($fl* x y)
(foreign-call "ikrt_fl_times" x y))
(define ($fl/ x y)
(foreign-call "ikrt_fl_div" x y))
#;
(begin
(define ($fl+ x y)
(foreign-call "ikrt_fl_plus" x y))
(define ($fl- x y)
(foreign-call "ikrt_fl_minus" x y))
(define ($fl* x y)
(foreign-call "ikrt_fl_times" x y))
(define ($fl/ x y)
(foreign-call "ikrt_fl_div" x y)))
@@ -440,7 +443,7 @@
(foreign-call "ikrt_fxbnminus" x y)]
[(flonum? y)
(if ($fx= x 0)
($fl* y -1.0)
(fl* y -1.0)
($fl- (fixnum->flonum x) y))]
[(ratnum? y)
(let ([n ($ratnum-n y)] [d ($ratnum-d y)])
@@ -880,7 +883,7 @@
(if ($bignum-positive? x) x (- x))]
[(flonum? x)
(if ($flnegative? x)
($fl* x -1.0)
(fl* x -1.0)
x)]
[(ratnum? x)
(let ([n ($ratnum-n x)])
@@ -1284,7 +1287,7 @@
(f (fl- ac (car rest)) (cdr rest))))]
[(x)
(if (flonum? x)
($fl- 0.0 x)
(fl- 0.0 x)
(error 'fl+ "~s is not a flonum" x))]))
(define fl*