raise value1 to power of value2

hi

I was hoping someone would have a better understanding of this.

I have an open source class Real written in java redefining integer implementation of 64-bit precision floating points that perform this task well, but how to do this without the Real library and without losing any data?

for example

advance = 91500

intrate = 0.0095

NoOfInst = 300

using this sequesnce : advance*rate/(1-(1+rate)^(-Noofinst))

if i had to use java data types i thought of using double for most of the values, but what happens when i have to raise (1-(1+rate) to the power of (-Noofinst)

do i use:

double x = Math.pow(((1-(1+rate)), ((-Noofinst)));

this returns infinity which is obviously wrong (correct me if i'm wrong)

does enyone know how to raise value1 to power of value2?

[841 byte] By [DevOReZ] at [2007-9-30 18:55:01]
# 1
sorry typo rate = intrate
DevOReZ at 2007-7-6 21:13:28 > top of Java-index,Administration Tools,Sun Connection...
# 2

I had to reach for this - many years back in a dim cubbyhole!

* is multiplication

^ is exponentiation

e is Euler's number

ln is natural logarithm

Let n = x^y

then

ln(n) = ln(x^y)

ln(n) = y * ln(x)

e^ln(n) = e^(y * ln(x))

n = e^(y * ln(x))

In Java code, it is

double n, x, y;

x = 5.0;

y = 4.0;

n = Math.exp(y*Math.log(x));

The result is 624.9999999999998 (an approximation due to the nature of binary floating point arithmetic.)

ChuckBing at 2007-7-6 21:13:28 > top of Java-index,Administration Tools,Sun Connection...