* Added inexact->exact
This commit is contained in:
parent
0480517615
commit
d88126aea1
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -5,11 +5,12 @@
|
|||
|
||||
|
||||
(library (ikarus flonums)
|
||||
(export string->flonum flonum->string $flonum->exact)
|
||||
(export string->flonum flonum->string $flonum->exact
|
||||
inexact->exact)
|
||||
(import
|
||||
(ikarus system $bytevectors)
|
||||
(ikarus system $flonums)
|
||||
(except (ikarus) flonum->string string->flonum))
|
||||
(except (ikarus) flonum->string string->flonum inexact->exact))
|
||||
|
||||
(define (flonum->string x)
|
||||
(utf8-bytevector->string
|
||||
|
@ -64,6 +65,15 @@
|
|||
(* m (expt 2 -1074)))]
|
||||
[else #f])))
|
||||
|
||||
|
||||
(define (inexact->exact x)
|
||||
(cond
|
||||
[(flonum? x)
|
||||
(or ($flonum->exact x)
|
||||
(error 'inexact->exact "~s has no real value" x))]
|
||||
[(or (fixnum? x) (ratnum? x) (bignum? x)) x]
|
||||
[else
|
||||
(error 'inexact->exact "~s is not an inexact number" x)]))
|
||||
|
||||
)
|
||||
|
||||
|
|
|
@ -399,6 +399,7 @@
|
|||
[ceiling i r]
|
||||
[exact-integer-sqrt i r]
|
||||
[exact->inexact i r]
|
||||
[inexact->exact i r]
|
||||
[symbol? i r symbols]
|
||||
[gensym? i symbols]
|
||||
[gensym i symbols]
|
||||
|
|
Loading…
Reference in New Issue