* Added flmax
This commit is contained in:
parent
d04b4f4be8
commit
cb4752df99
|
@ -88,7 +88,7 @@
|
||||||
(let ((h (intersect s pt ray)))
|
(let ((h (intersect s pt ray)))
|
||||||
(if h
|
(if h
|
||||||
(let ((d (distance h pt)))
|
(let ((d (distance h pt)))
|
||||||
(if (fl< d dist)
|
(if (fl<? d dist)
|
||||||
(loop (cdr lst) s h d)
|
(loop (cdr lst) s h d)
|
||||||
(loop (cdr lst) surface hit dist)))
|
(loop (cdr lst) surface hit dist)))
|
||||||
(loop (cdr lst) surface hit dist)))))))
|
(loop (cdr lst) surface hit dist)))))))
|
||||||
|
|
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -133,7 +133,7 @@
|
||||||
exact->inexact floor ceiling round log fl=? fl<? fl<=? fl>?
|
exact->inexact floor ceiling round log fl=? fl<? fl<=? fl>?
|
||||||
fl>=? fl+ fl- fl* fl/ flsqrt flmin flzero? flnegative?
|
fl>=? fl+ fl- fl* fl/ flsqrt flmin flzero? flnegative?
|
||||||
sin cos atan sqrt
|
sin cos atan sqrt
|
||||||
flround)
|
flround flmax)
|
||||||
(import
|
(import
|
||||||
(ikarus system $fx)
|
(ikarus system $fx)
|
||||||
(ikarus system $flonums)
|
(ikarus system $flonums)
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/ flsqrt flmin
|
fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/ flsqrt flmin
|
||||||
flzero? flnegative?
|
flzero? flnegative?
|
||||||
sin cos atan sqrt
|
sin cos atan sqrt
|
||||||
flround))
|
flround flmax))
|
||||||
|
|
||||||
(define (fixnum->flonum x)
|
(define (fixnum->flonum x)
|
||||||
(foreign-call "ikrt_fixnum_to_flonum" x))
|
(foreign-call "ikrt_fixnum_to_flonum" x))
|
||||||
|
@ -815,6 +815,27 @@
|
||||||
[else (f (binary/ a b) (car ls) (cdr ls))]))]))
|
[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
|
(define max
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[(x y)
|
[(x y)
|
||||||
|
|
|
@ -398,6 +398,7 @@
|
||||||
[flnegative? i rfl]
|
[flnegative? i rfl]
|
||||||
[flpositive? i rfl]
|
[flpositive? i rfl]
|
||||||
[flabs i rfl]
|
[flabs i rfl]
|
||||||
|
[flmax i rfl]
|
||||||
[flround i rfl]
|
[flround i rfl]
|
||||||
[fixnum->string i]
|
[fixnum->string i]
|
||||||
[string->flonum i]
|
[string->flonum i]
|
||||||
|
|
Loading…
Reference in New Issue