* Added flexpt

This commit is contained in:
Abdulaziz Ghuloum 2007-09-12 03:56:08 -04:00
parent 69d692417f
commit 888833f686
6 changed files with 26 additions and 3 deletions

Binary file not shown.

View File

@ -17,6 +17,13 @@ ikrt_fl_exp(ikp x, ikp y){
return y;
}
ikp
ikrt_flfl_expt(ikp a, ikp b, ikp z){
flonum_data(z) = exp(flonum_data(b) * log(flonum_data(a)));
return z;
}

Binary file not shown.

View File

@ -11,7 +11,8 @@
$flnegative? flpositive? flabs fixnum->flonum
flsin flcos fltan flasin flacos flatan fleven? flodd?
flfloor flceiling flnumerator fldenominator flexp fllog
flinteger? flonum-bytes flnan? flfinite? flinfinite?)
flinteger? flonum-bytes flnan? flfinite? flinfinite?
flexpt)
(import
(ikarus system $bytevectors)
(ikarus system $fx)
@ -22,7 +23,8 @@
(except (ikarus) inexact->exact exact flpositive? flabs fixnum->flonum
flsin flcos fltan flasin flacos flatan fleven? flodd?
flfloor flceiling flnumerator fldenominator flexp fllog
flinteger? flonum-parts flonum-bytes flnan? flfinite? flinfinite?))
flexpt flinteger? flonum-parts flonum-bytes flnan? flfinite?
flinfinite?))
(define (flonum-bytes f)
(unless (flonum? f)
@ -286,6 +288,19 @@
(error 'fllog "argument ~s should not be negative" x))
(error 'fllog "~s is not a flonum" x)))
(define (flexpt x y)
(if (flonum? x)
(if (flonum? y)
(let ([y^ ($flonum->exact y)])
(cond
[(fixnum? y^) (inexact (expt x y^))]
[(bignum? y^) (inexact (expt x y^))]
[else
(foreign-call "ikrt_flfl_expt" x y ($make-flonum))]))
(error 'flexpt "~s is not a flonum" y))
(error 'fllog "~s is not a flonum" x)))
)

View File

@ -498,6 +498,7 @@
[add1 i]
[sub1 i]
[expt i r]
[flexpt i]
[sin i r]
[cos i r]
[tan i r]

View File

@ -321,7 +321,7 @@
[fldiv0-and-mod0 D fl]
[fleven? C fl]
[flexp C fl]
[flexpt S fl]
[flexpt C fl]
[flfinite? C fl]
[flfloor C fl]
[flinfinite? C fl]