* flonum->string now always returns a string with a decimal point.
* number?, exact?, inexact?, ... now know about flonums. * number->string also handles flonums, and so is the writer (automatically).
This commit is contained in:
parent
de910a3544
commit
96ad8a04a4
BIN
bin/ikarus
BIN
bin/ikarus
Binary file not shown.
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -245,7 +245,8 @@
|
||||||
(define number?
|
(define number?
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(or (fixnum? x)
|
(or (fixnum? x)
|
||||||
(bignum? x))))
|
(bignum? x)
|
||||||
|
(flonum? x))))
|
||||||
|
|
||||||
(define complex?
|
(define complex?
|
||||||
(lambda (x) (number? x)))
|
(lambda (x) (number? x)))
|
||||||
|
@ -255,22 +256,29 @@
|
||||||
(lambda (x) (number? x)))
|
(lambda (x) (number? x)))
|
||||||
(define integer?
|
(define integer?
|
||||||
(lambda (x) (number? x)))
|
(lambda (x) (number? x)))
|
||||||
|
|
||||||
(define exact?
|
(define exact?
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(or (number? x)
|
(cond
|
||||||
(error 'exact? "~s is not a number" x))))
|
[(fixnum? x) #t]
|
||||||
|
[(bignum? x) #t]
|
||||||
|
[(flonum? x) #f]
|
||||||
|
[else
|
||||||
|
(error 'exact? "~s is not a number" x)])))
|
||||||
|
|
||||||
(define inexact?
|
(define inexact?
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(if (number? x)
|
(cond
|
||||||
#f
|
[(fixnum? x) #f]
|
||||||
(error 'inexact? "~s is not a number" x))))
|
[(bignum? x) #f]
|
||||||
|
[(flonum? x) #t]
|
||||||
|
[else
|
||||||
|
(error 'inexact? "~s is not a number" x)])))
|
||||||
|
|
||||||
(define positive-bignum?
|
(define positive-bignum?
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(foreign-call "ikrt_positive_bn" x)))
|
(foreign-call "ikrt_positive_bn" x)))
|
||||||
|
|
||||||
|
|
||||||
(define even-bignum?
|
(define even-bignum?
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(foreign-call "ikrt_even_bn" x)))
|
(foreign-call "ikrt_even_bn" x)))
|
||||||
|
@ -296,6 +304,7 @@
|
||||||
(cond
|
(cond
|
||||||
[(fixnum? x) (fixnum->string x)]
|
[(fixnum? x) (fixnum->string x)]
|
||||||
[(bignum? x) (foreign-call "ikrt_bntostring" x)]
|
[(bignum? x) (foreign-call "ikrt_bntostring" x)]
|
||||||
|
[(flonum? x) (foreign-call "ikrt_flonum_to_string" x)]
|
||||||
[else (error 'number->string "~s is not a number" x)])))
|
[else (error 'number->string "~s is not a number" x)])))
|
||||||
|
|
||||||
(define-syntax mk<
|
(define-syntax mk<
|
||||||
|
|
Loading…
Reference in New Issue