* Added finite?, infinite?, and nan?

This commit is contained in:
Abdulaziz Ghuloum 2007-09-12 02:44:19 -04:00
parent ed45b486a3
commit c55cad8502
4 changed files with 42 additions and 5 deletions

Binary file not shown.

View File

@ -5,14 +5,15 @@
integer? exact? inexact? eof-object? bwp-object? immediate? integer? exact? inexact? eof-object? bwp-object? immediate?
boolean? char? vector? bytevector? string? procedure? null? pair? boolean? char? vector? bytevector? string? procedure? null? pair?
symbol? code? not weak-pair? eq? eqv? equal? boolean=? symbol? code? not weak-pair? eq? eqv? equal? boolean=?
symbol=?) symbol=? finite? infinite? nan?)
(import (import
(except (ikarus) fixnum? flonum? bignum? ratnum? number? complex? real? (except (ikarus) fixnum? flonum? bignum? ratnum? number? complex? real?
rational? integer? exact? inexact? eof-object? bwp-object? rational? integer? exact? inexact? eof-object? bwp-object?
immediate? boolean? char? vector? bytevector? string? procedure? immediate? boolean? char? vector? bytevector? string? procedure?
null? pair? weak-pair? symbol? code? not eq? eqv? equal? null? pair? weak-pair? symbol? code? not eq? eqv? equal?
port? input-port? output-port? boolean=? symbol=?) port? input-port? output-port? boolean=? symbol=?
finite? infinite? nan?)
(ikarus system $fx) (ikarus system $fx)
(ikarus system $flonums) (ikarus system $flonums)
(ikarus system $pairs) (ikarus system $pairs)
@ -110,6 +111,39 @@
[else [else
(error 'inexact? "~s is not a number" x)]))) (error 'inexact? "~s is not a number" x)])))
(define finite?
(lambda (x)
(cond
[(sys:flonum? x) (flfinite? x)]
[(sys:fixnum? x) #t]
[(sys:bignum? x) #t]
[(sys:ratnum? x) #t]
[else
(error 'finite? "~s is not a number" x)])))
(define infinite?
(lambda (x)
(cond
[(sys:flonum? x) (flinfinite? x)]
[(sys:fixnum? x) #f]
[(sys:bignum? x) #f]
[(sys:ratnum? x) #f]
[else
(error 'infinite? "~s is not a number" x)])))
(define nan?
(lambda (x)
(cond
[(sys:flonum? x) (flnan? x)]
[(sys:fixnum? x) #f]
[(sys:bignum? x) #f]
[(sys:ratnum? x) #f]
[else
(error 'nan? "~s is not a number" x)])))
(define eof-object? (lambda (x) (sys:eof-object? x))) (define eof-object? (lambda (x) (sys:eof-object? x)))
(define bwp-object? (lambda (x) (sys:bwp-object? x))) (define bwp-object? (lambda (x) (sys:bwp-object? x)))
(define immediate? (lambda (x) (sys:immediate? x))) (define immediate? (lambda (x) (sys:immediate? x)))

View File

@ -539,6 +539,9 @@
[number->string i r] [number->string i r]
[string->number i r] [string->number i r]
[flonum->string i] [flonum->string i]
[finite? i]
[infinite? i]
[nan? i]
[gcd i r] [gcd i r]
[lcm i r] [lcm i r]
[max i r] [max i r]

View File

@ -151,14 +151,14 @@
[exact? C ba se] [exact? C ba se]
[exp S ba se] [exp S ba se]
[expt C ba se] [expt C ba se]
[finite? S ba] [finite? C ba]
[floor C ba se] [floor C ba se]
[for-each C ba se] [for-each C ba se]
[gcd C ba se] [gcd C ba se]
[imag-part D ba se] [imag-part D ba se]
[inexact C ba] [inexact C ba]
[inexact? C ba se] [inexact? C ba se]
[infinite? S ba] [infinite? C ba]
[integer->char C ba se] [integer->char C ba se]
[integer-valued? S ba] [integer-valued? S ba]
[integer? C ba se] [integer? C ba se]
@ -179,7 +179,7 @@
[map C ba se] [map C ba se]
[max C ba se] [max C ba se]
[min C ba se] [min C ba se]
[nan? S ba] [nan? C ba]
[negative? C ba se] [negative? C ba se]
[not C ba se] [not C ba se]
[null? C ba] [null? C ba]