3
$Id: fixart.scm,v 1.8 2001/12/18 18:39:31 cph Exp $
5
Copyright (c) 1988-2001 Massachusetts Institute of Technology
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or (at
10
your option) any later version.
12
This program is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23
;;;; Fixnum Arithmetic
24
;;; package: (runtime fixnum-arithmetic)
26
(declare (usual-integrations))
29
(fix:fixnum? fixnum? 1)
31
(index-fixnum? index-fixnum? 1)
32
(fix:zero? zero-fixnum? 1)
33
(fix:negative? negative-fixnum? 1)
34
(fix:positive? positive-fixnum? 1)
35
(fix:= equal-fixnum? 2)
36
(fix:< less-than-fixnum? 2)
37
(fix:> greater-than-fixnum? 2)
38
(fix:1+ one-plus-fixnum 1)
39
(fix:-1+ minus-one-plus-fixnum 1)
41
(fix:- minus-fixnum 2)
42
(fix:* multiply-fixnum 2)
43
(fix:divide divide-fixnum 2)
44
(fix:quotient fixnum-quotient 2)
45
(fix:remainder fixnum-remainder 2)
46
(fix:gcd gcd-fixnum 2)
47
(fix:andc fixnum-andc 2)
48
(fix:and fixnum-and 2)
50
(fix:xor fixnum-xor 2)
51
(fix:not fixnum-not 1)
52
(fix:lsh fixnum-lsh 2)
54
(int:integer? integer? 1)
55
(int:zero? integer-zero? 1)
56
(int:positive? integer-positive? 1)
57
(int:negative? integer-negative? 1)
58
(int:= integer-equal? 2)
59
(int:< integer-less? 2)
60
(int:> integer-greater? 2)
61
(int:negate integer-negate 1)
62
(int:1+ integer-add-1 1)
63
(int:-1+ integer-subtract-1 1)
65
(int:- integer-subtract 2)
66
(int:* integer-multiply 2)
67
(int:divide integer-divide 2)
68
(int:quotient integer-quotient 2)
69
(int:remainder integer-remainder 2)
71
(flo:flonum? flonum? 1)
72
(flo:zero? flonum-zero? 1)
73
(flo:positive? flonum-positive? 1)
74
(flo:negative? flonum-negative? 1)
75
(flo:= flonum-equal? 2)
76
(flo:< flonum-less? 2)
77
(flo:> flonum-greater? 2)
79
(flo:- flonum-subtract 2)
80
(flo:* flonum-multiply 2)
81
(flo:/ flonum-divide 2)
82
(flo:negate flonum-negate 1)
83
(flo:abs flonum-abs 1)
84
(flo:exp flonum-exp 1)
85
(flo:log flonum-log 1)
86
(flo:sin flonum-sin 1)
87
(flo:cos flonum-cos 1)
88
(flo:tan flonum-tan 1)
89
(flo:asin flonum-asin 1)
90
(flo:acos flonum-acos 1)
91
(flo:atan flonum-atan 1)
92
(flo:atan2 flonum-atan2 2)
93
(flo:sqrt flonum-sqrt 1)
94
(flo:expt flonum-expt 2)
95
(flo:floor flonum-floor 1)
96
(flo:ceiling flonum-ceiling 1)
97
(flo:truncate flonum-truncate 1)
98
(flo:round flonum-round 1)
99
(flo:floor->exact flonum-floor->exact 1)
100
(flo:ceiling->exact flonum-ceiling->exact 1)
101
(flo:truncate->exact flonum-truncate->exact 1)
102
(flo:round->exact flonum-round->exact 1)
103
(flo:vector-cons floating-vector-cons 1)
104
(flo:vector-length floating-vector-length 1)
105
(flo:vector-ref floating-vector-ref 2)
106
(flo:vector-set! floating-vector-set! 3))
108
(define-integrable (fix:<= x y)
111
(define-integrable (fix:>= x y)
114
(define (fix:min n m)
115
(if (fix:< n m) n m))
117
(define (fix:max n m)
118
(if (fix:> n m) n m))
120
(define-integrable (int:<= x y)
123
(define-integrable (int:>= x y)
126
(define-integrable (int:->flonum n)
127
((ucode-primitive integer->flonum 2) n #b10))
129
(define-integrable (flo:<= x y)
132
(define-integrable (flo:>= x y)
135
(define (flo:min n m)
136
(if (flo:< n m) n m))
138
(define (flo:max n m)
139
(if (flo:> n m) n m))
143
(error:wrong-type-argument x "real number" '->FLONUM))
144
(exact->inexact (real-part x)))
146
(define (flo:finite? x)
147
(not (cond ((flo:> x 0.)
149
(flo:= x (flo:/ x 2.))))
152
(flo:= x (flo:/ x 2.))))
b'\\ No newline at end of file'