* Added flmax

This commit is contained in:
Abdulaziz Ghuloum 2007-06-18 13:06:19 +03:00
parent d04b4f4be8
commit cb4752df99
4 changed files with 25 additions and 3 deletions

View File

@ -88,7 +88,7 @@
(let ((h (intersect s pt ray)))
(if h
(let ((d (distance h pt)))
(if (fl< d dist)
(if (fl<? d dist)
(loop (cdr lst) s h d)
(loop (cdr lst) surface hit dist)))
(loop (cdr lst) surface hit dist)))))))

Binary file not shown.

View File

@ -133,7 +133,7 @@
exact->inexact floor ceiling round log fl=? fl<? fl<=? fl>?
fl>=? fl+ fl- fl* fl/ flsqrt flmin flzero? flnegative?
sin cos atan sqrt
flround)
flround flmax)
(import
(ikarus system $fx)
(ikarus system $flonums)
@ -150,7 +150,7 @@
fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/ flsqrt flmin
flzero? flnegative?
sin cos atan sqrt
flround))
flround flmax))
(define (fixnum->flonum x)
(foreign-call "ikrt_fixnum_to_flonum" x))
@ -815,6 +815,27 @@
[else (f (binary/ a b) (car ls) (cdr ls))]))]))
(define flmax
(case-lambda
[(x y)
(if (flonum? x)
(if (flonum? y)
(if ($fl< x y)
y
x)
(error 'flmax "~s is not a flonum" y))
(error 'flmax "~s is not a flonum" x))]
[(x y z . rest)
(let f ([a (flmax x y)] [b z] [ls rest])
(cond
[(null? ls) (flmax a b)]
[else
(f (flmax a b) (car ls) (cdr ls))]))]
[(x)
(if (flonum? x)
x
(error 'flmax "~s is not a number" x))]))
(define max
(case-lambda
[(x y)

View File

@ -398,6 +398,7 @@
[flnegative? i rfl]
[flpositive? i rfl]
[flabs i rfl]
[flmax i rfl]
[flround i rfl]
[fixnum->string i]
[string->flonum i]