* Added (random fx) procedure.
This commit is contained in:
parent
fc06fa7312
commit
a09da8f581
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -143,7 +143,7 @@
|
||||||
exact->inexact inexact floor ceiling round log fl=? fl<? fl<=? fl>?
|
exact->inexact 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 flmax)
|
flround flmax random)
|
||||||
(import
|
(import
|
||||||
(ikarus system $fx)
|
(ikarus system $fx)
|
||||||
(ikarus system $flonums)
|
(ikarus system $flonums)
|
||||||
|
@ -161,7 +161,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 flmax))
|
flround flmax random))
|
||||||
|
|
||||||
; (foreign-call "ikrt_fixnum_to_flonum" x))
|
; (foreign-call "ikrt_fixnum_to_flonum" x))
|
||||||
|
|
||||||
|
@ -1920,6 +1920,15 @@
|
||||||
[(fx> n 0) (start x n 0 #f #f)]
|
[(fx> n 0) (start x n 0 #f #f)]
|
||||||
[else #f]))))
|
[else #f]))))
|
||||||
|
|
||||||
|
|
||||||
|
(define (random n)
|
||||||
|
(if (fixnum? n)
|
||||||
|
(if (fx> n 1)
|
||||||
|
(foreign-call "ikrt_fxrandom" n)
|
||||||
|
(if (fx= n 1)
|
||||||
|
0
|
||||||
|
(error 'random "incorrect argument ~s" n)))
|
||||||
|
(error 'random "~s is not a fixnum" n)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2074,4 +2083,5 @@
|
||||||
[else
|
[else
|
||||||
(error 'string->flonum "~s is not a string" x)]))
|
(error 'string->flonum "~s is not a string" x)]))
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -480,6 +480,7 @@
|
||||||
[inexact->exact i r]
|
[inexact->exact i r]
|
||||||
[exact i r]
|
[exact i r]
|
||||||
[inexact i r]
|
[inexact i r]
|
||||||
|
[random i]
|
||||||
[symbol? i r symbols]
|
[symbol? i r symbols]
|
||||||
[symbol=? i r symbols]
|
[symbol=? i r symbols]
|
||||||
[gensym? i symbols]
|
[gensym? i symbols]
|
||||||
|
|
Loading…
Reference in New Issue