Added fixnum->flonum

This commit is contained in:
Abdulaziz Ghuloum 2007-09-02 21:02:06 -04:00
parent 46193467c5
commit 6ff9e3dc9c
4 changed files with 11 additions and 3 deletions

Binary file not shown.

View File

@ -8,12 +8,13 @@
(library (ikarus flonums) (library (ikarus flonums)
(export $flonum->exact $flonum-signed-biased-exponent flonum-parts (export $flonum->exact $flonum-signed-biased-exponent flonum-parts
inexact->exact exact $flonum-rational? $flonum-integer? $flzero? inexact->exact exact $flonum-rational? $flonum-integer? $flzero?
$flnegative? flpositive? flabs) $flnegative? flpositive? flabs fixnum->flonum)
(import (import
(ikarus system $bytevectors) (ikarus system $bytevectors)
(except (ikarus system $flonums) $flonum-signed-biased-exponent (except (ikarus system $flonums) $flonum-signed-biased-exponent
$flonum-rational? $flonum-integer?) $flonum-rational? $flonum-integer?)
(except (ikarus) inexact->exact exact flpositive? flabs)) (except (ikarus) inexact->exact exact flpositive? flabs
fixnum->flonum))
(define (flonum-bytes f) (define (flonum-bytes f)
(unless (flonum? f) (unless (flonum? f)
@ -130,6 +131,12 @@
($fl* x -1.0) ($fl* x -1.0)
x) x)
(error 'flabs "~s is not a flonum" x))) (error 'flabs "~s is not a flonum" x)))
(define (fixnum->flonum x)
(if (fixnum? x)
($fixnum->flonum x)
(error 'fixnum->flonum "~s is not a fixnum")))
) )

View File

@ -492,6 +492,7 @@
[exact-integer-sqrt i r] [exact-integer-sqrt i r]
[exact->inexact i r] [exact->inexact i r]
[inexact->exact i r] [inexact->exact i r]
[fixnum->flonum i r]
[exact i r] [exact i r]
[inexact i r] [inexact i r]
[random i] [random i]

View File

@ -298,7 +298,7 @@
[fxxor D fx] [fxxor D fx]
[fxzero? D fx] [fxzero? D fx]
;;; ;;;
[fixnum->flonum S fl] [fixnum->flonum C fl]
[fl* C fl] [fl* C fl]
[fl+ C fl] [fl+ C fl]
[fl- C fl] [fl- C fl]