* Added flmin.

This commit is contained in:
Abdulaziz Ghuloum 2007-06-13 14:16:03 +03:00
parent 009d0b2fac
commit 48c80cbd9c
3 changed files with 23 additions and 2 deletions

Binary file not shown.

View File

@ -119,7 +119,7 @@
positive? expt gcd lcm numerator denominator exact-integer-sqrt positive? expt gcd lcm numerator denominator exact-integer-sqrt
quotient+remainder number->string string->number min max quotient+remainder number->string string->number min max
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 flzero? flnegative?) fl>=? fl+ fl- fl* fl/ flsqrt flmin flzero? flnegative?)
(import (import
(ikarus system $fx) (ikarus system $fx)
(ikarus system $flonums) (ikarus system $flonums)
@ -133,7 +133,7 @@
string->number expt gcd lcm numerator denominator string->number expt gcd lcm numerator denominator
exact->inexact floor ceiling round log exact->inexact floor ceiling round log
exact-integer-sqrt min max exact-integer-sqrt min max
fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/ flsqrt fl=? fl<? fl<=? fl>? fl>=? fl+ fl- fl* fl/ flsqrt flmin
flzero? flnegative?)) flzero? flnegative?))
(define (fixnum->flonum x) (define (fixnum->flonum x)
@ -869,6 +869,26 @@
x x
(error 'min "~s is not a number" x))])) (error 'min "~s is not a number" x))]))
(define flmin
(case-lambda
[(x y)
(if (flonum? x)
(if (flonum? y)
(if ($fl< x y) x y)
(error 'flmin "~s is not a flonum" y))
(error 'flmin "~s is not a flonum" x))]
[(x y z . rest)
(let f ([a (flmin x y)] [b z] [ls rest])
(cond
[(null? ls) (flmin a b)]
[else
(f (flmin a b) (car ls) (cdr ls))]))]
[(x)
(if (flonum? x)
x
(error 'flmin "~s is not a flonum" x))]))
(define exact->inexact (define exact->inexact
(lambda (x) (lambda (x)
(cond (cond

View File

@ -376,6 +376,7 @@
[fl* i rfl] [fl* i rfl]
[fl- i rfl] [fl- i rfl]
[fl/ i rfl] [fl/ i rfl]
[flmin i rfl]
[flsqrt i rfl] [flsqrt i rfl]
[flzero? i rfl] [flzero? i rfl]
[flnegative? i rfl] [flnegative? i rfl]