* moved fxquotient, fxremainder, and fxmodulo to the fixnums library
This commit is contained in:
parent
bdd87d66b5
commit
6995d57df0
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -64,37 +64,6 @@
|
|||
(set-top-level-value! x v)))
|
||||
|
||||
|
||||
(primitive-set! 'fxquotient
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
(error 'fxquotient "~s is not a fixnum" x))
|
||||
(unless (fixnum? y)
|
||||
(error 'fxquotient "~s is not a fixnum" y))
|
||||
(when ($fxzero? y)
|
||||
(error 'fxquotient "zero dividend ~s" y))
|
||||
($fxquotient x y)))
|
||||
|
||||
(primitive-set! 'fxremainder
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
(error 'fxremainder "~s is not a fixnum" x))
|
||||
(unless (fixnum? y)
|
||||
(error 'fxremainder "~s is not a fixnum" y))
|
||||
(when ($fxzero? y)
|
||||
(error 'fxremainder "zero dividend ~s" y))
|
||||
(let ([q ($fxquotient x y)])
|
||||
($fx- x ($fx* q y)))))
|
||||
|
||||
(primitive-set! 'fxmodulo
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
(error 'fxmodulo "~s is not a fixnum" x))
|
||||
(unless (fixnum? y)
|
||||
(error 'fxmodulo "~s is not a fixnum" y))
|
||||
(when ($fxzero? y)
|
||||
(error 'fxmodulo "zero dividend ~s" y))
|
||||
($fxmodulo x y)))
|
||||
|
||||
(primitive-set! 'fxlogor
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
|
||||
(library (ikarus fixnums)
|
||||
(export fxzero? fxadd1 fxsub1 fxlognot fx+ fx- fx*)
|
||||
(export fxzero? fxadd1 fxsub1 fxlognot fx+ fx- fx* fxquotient
|
||||
fxremainder fxmodulo)
|
||||
(import
|
||||
(only (scheme) $fxadd1 $fxsub1 $fxlognot $fx+ $fx- $fx*)
|
||||
(except (ikarus) fxzero? fxadd1 fxsub1 fxlognot fx+ fx- fx*))
|
||||
(only (scheme) $fxadd1 $fxsub1 $fxlognot $fxzero? $fxquotient
|
||||
$fxmodulo $fx+ $fx- $fx*)
|
||||
(except (ikarus) fxzero? fxadd1 fxsub1 fxlognot fx+ fx- fx*
|
||||
fxquotient fxremainder fxmodulo))
|
||||
|
||||
(define fxzero?
|
||||
(lambda (x)
|
||||
|
@ -54,5 +57,36 @@
|
|||
(error 'fx* "~s is not a fixnum" y))
|
||||
($fx* x y)))
|
||||
|
||||
(define fxquotient
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
(error 'fxquotient "~s is not a fixnum" x))
|
||||
(unless (fixnum? y)
|
||||
(error 'fxquotient "~s is not a fixnum" y))
|
||||
(when ($fxzero? y)
|
||||
(error 'fxquotient "zero dividend ~s" y))
|
||||
($fxquotient x y)))
|
||||
|
||||
(define fxremainder
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
(error 'fxremainder "~s is not a fixnum" x))
|
||||
(unless (fixnum? y)
|
||||
(error 'fxremainder "~s is not a fixnum" y))
|
||||
(when ($fxzero? y)
|
||||
(error 'fxremainder "zero dividend ~s" y))
|
||||
(let ([q ($fxquotient x y)])
|
||||
($fx- x ($fx* q y)))))
|
||||
|
||||
(define fxmodulo
|
||||
(lambda (x y)
|
||||
(unless (fixnum? x)
|
||||
(error 'fxmodulo "~s is not a fixnum" x))
|
||||
(unless (fixnum? y)
|
||||
(error 'fxmodulo "~s is not a fixnum" y))
|
||||
(when ($fxzero? y)
|
||||
(error 'fxmodulo "zero dividend ~s" y))
|
||||
($fxmodulo x y)))
|
||||
|
||||
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue