I made the following function to calculate x power y..

I'd like to upgrade it to make it possible to calculate even if y is decimal.. ex 2^3.456

is that possible?

Im not asking for full code just ideas..

Code:double power(double pow, double from) // x power y { double temp = from; if(pow > 0) { --pow; // x power 1 means x 1 time not 2 times ! for(int i = 0; i < pow; i++) temp *= from; // temp = from x times } else if(pow < 0) { --pow; // 10/10 = 1 so must add 1.. for(int i = 0; i > pow; --i) temp /= from; // temp = from divided x times } else if (pow == 0) temp = 1; // x power 0 == 1 return temp; }