* Added flexp

This commit is contained in:
Abdulaziz Ghuloum 2007-09-10 23:36:36 -04:00
parent ad3f96d2ad
commit 3ecf53f9fd
6 changed files with 24 additions and 9 deletions

Binary file not shown.

View File

@ -11,6 +11,15 @@ ikrt_fl_round(ikp x, ikp y){
return y; return y;
} }
ikp
ikrt_fl_exp(ikp x, ikp y){
flonum_data(y) = exp(flonum_data(x));
return y;
}
ikp ikp
ikrt_bytevector_to_flonum(ikp x, ikpcb* pcb){ ikrt_bytevector_to_flonum(ikp x, ikpcb* pcb){
double v = strtod((char*)x+off_bytevector_data, NULL); double v = strtod((char*)x+off_bytevector_data, NULL);

Binary file not shown.

View File

@ -10,7 +10,7 @@
inexact->exact exact $flonum-rational? $flonum-integer? $flzero? inexact->exact exact $flonum-rational? $flonum-integer? $flzero?
$flnegative? flpositive? flabs fixnum->flonum $flnegative? flpositive? flabs fixnum->flonum
flsin flcos fltan flasin flacos flatan fleven? flodd? flsin flcos fltan flasin flacos flatan fleven? flodd?
flfloor flceiling flnumerator fldenominator flfloor flceiling flnumerator fldenominator flexp
flinteger? flonum-bytes flnan? flfinite? flinfinite?) flinteger? flonum-bytes flnan? flfinite? flinfinite?)
(import (import
(ikarus system $bytevectors) (ikarus system $bytevectors)
@ -20,7 +20,7 @@
$flonum-rational? $flonum-integer?) $flonum-rational? $flonum-integer?)
(except (ikarus) inexact->exact exact flpositive? flabs fixnum->flonum (except (ikarus) inexact->exact exact flpositive? flabs fixnum->flonum
flsin flcos fltan flasin flacos flatan fleven? flodd? flsin flcos fltan flasin flacos flatan fleven? flodd?
flfloor flceiling flnumerator fldenominator flfloor flceiling flnumerator fldenominator flexp
flinteger? flonum-parts flonum-bytes flnan? flfinite? flinfinite?)) flinteger? flonum-parts flonum-bytes flnan? flfinite? flinfinite?))
(define (flonum-bytes f) (define (flonum-bytes f)
@ -273,6 +273,11 @@
[else x]))] [else x]))]
[else (error 'flceiling "~s is not a flonum" x)])) [else (error 'flceiling "~s is not a flonum" x)]))
(define (flexp x)
(if (flonum? x)
(foreign-call "ikrt_fl_exp" x ($make-flonum))
(error 'flexp "~s is not a flonum" x)))
) )

View File

@ -480,6 +480,7 @@
[flceiling i rfl] [flceiling i rfl]
[flnumerator i rfl] [flnumerator i rfl]
[fldenominator i rfl] [fldenominator i rfl]
[flexp i rfl]
[fixnum->string i] [fixnum->string i]
[string->flonum i] [string->flonum i]
[- i r] [- i r]

View File

@ -315,12 +315,12 @@
[flceiling C fl] [flceiling C fl]
[flcos C fl] [flcos C fl]
[fldenominator C fl] [fldenominator C fl]
[fldiv S fl] [fldiv D fl]
[fldiv-and-mod S fl] [fldiv-and-mod D fl]
[fldiv0 S fl] [fldiv0 D fl]
[fldiv0-and-mod0 S fl] [fldiv0-and-mod0 D fl]
[fleven? C fl] [fleven? C fl]
[flexp S fl] [flexp C fl]
[flexpt S fl] [flexpt S fl]
[flfinite? C fl] [flfinite? C fl]
[flfloor C fl] [flfloor C fl]
@ -329,8 +329,8 @@
[fllog S fl] [fllog S fl]
[flmax C fl] [flmax C fl]
[flmin C fl] [flmin C fl]
[flmod S fl] [flmod D fl]
[flmod0 S fl] [flmod0 D fl]
[flnan? C fl] [flnan? C fl]
[flnegative? C fl] [flnegative? C fl]
[flnumerator C fl] [flnumerator C fl]