(define flo:significand-digits-base-2)
(define flo:significand-digits-base-10)
(define int:flonum-integer-limit)
-(define fix:largest-value)
-(define fix:smallest-value)
(define (initialize-microcode-dependencies!)
(let ((p microcode-id/floating-mantissa-bits))
(set! int:flonum-integer-limit (int:expt 2 p)))
unspecific)
-(define (largest-fixnum)
- fix:largest-value)
-
-(define (smallest-fixnum)
- fix:smallest-value)
-
(define (initialize-package!)
(initialize-microcode-dependencies!)
(add-event-receiver! event:after-restore initialize-microcode-dependencies!)
(max/min max complex:max)
(max/min min complex:min))
- (let loop ((n 1))
- (if (fix:fixnum? n)
- (loop (* n 2))
- (let ((n (- n 1)))
- (if (not (fix:fixnum? n))
- (error "Unable to compute largest fixnum:" n))
- (set! fix:largest-value n))))
- (let loop ((n -1))
- (if (fix:fixnum? n)
- (loop (* n 2))
- (let ((n (quotient n 2)))
- (if (not (fix:fixnum? n))
- (error "Unable to compute smallest fixnum:" n))
- (set! fix:smallest-value n))))
-
unspecific)
\f
(define (int:max n m)
(define-guarantee negative-fixnum "negative fixnum")
(define-guarantee non-positive-fixnum "non-positive fixnum")
(define-guarantee non-negative-fixnum "non-negative fixnum")
-
+\f
(define (guarantee-index-fixnum object #!optional caller)
(if (not (index-fixnum? object))
(error:wrong-type-argument object "index integer" caller)))
(define (fix:>= n m) (not (fix:< n m)))
(define (fix:min n m) (if (fix:< n m) n m))
(define (fix:max n m) (if (fix:> n m) n m))
+
+(define (fix:largest-value)
+ (force largest-fixnum-promise))
+
+(define largest-fixnum-promise
+ (delay
+ (let loop ((n 1))
+ (if (fix:fixnum? n)
+ (loop (* n 2))
+ (let ((n (- n 1)))
+ (if (not (fix:fixnum? n))
+ (error "Unable to compute largest fixnum:" n))
+ n)))))
+
+(define (fix:smallest-value)
+ (force smallest-fixnum-promise))
+
+(define smallest-fixnum-promise
+ (delay
+ (let loop ((n -1))
+ (if (fix:fixnum? n)
+ (loop (* n 2))
+ (let ((n (quotient n 2)))
+ (if (not (fix:fixnum? n))
+ (error "Unable to compute smallest fixnum:" n))
+ n)))))
\f
;;;; Flonums
(parent (runtime))
(export ()
;; BEGIN deprecated bindings
+ (largest-fixnum fix:largest-value)
+ (smallest-fixnum fix:smallest-value)
guarantee-fixnum
guarantee-index-fixnum
guarantee-limited-index-fixnum
fix:divide
fix:fixnum?
fix:gcd
+ fix:largest-value
fix:lsh
fix:max
fix:min
fix:positive?
fix:quotient
fix:remainder
+ fix:smallest-value
fix:xor
fix:zero?
fixnum?
inexact?
integer-divide-quotient
integer-divide-remainder
- largest-fixnum
lcm
max
min
param:flonum-unparser-cutoff
quotient
remainder
- smallest-fixnum
square)
(initialization
(begin
(letrec
((primes (cons-stream 3 (fixnum-filter 5)))
(fixnum-filter
- (let ((limit (fix:- (largest-fixnum) 2)))
+ (let ((limit (fix:- (fix:largest-value) 2)))
(lambda (n)
(if (fix:<= n limit)
(let loop ((ps primes))