Math operators is C. Exponent operator?

Quote:

> Hi. I am still a little confused as to why standard ANSI C does not

> include a normal power operator like for example 2^3.74 (two to the

> power of 3.74). How do people calculate fractional exponents in C (or

> C++) given there is no exponent operator supported (^ or **) and one can

> not just use a direct multiplying loop?

As any mathematician does.

Quote:

> Doses a person find a stardard

> library or header some where or does a person typically just us a

> fortran subroutine to handle the math that is compiled in. I really

> would like to know how to do math problems in C. Any help is

> appreciated. Thanks,

You could use something like (untested, no error handling):

double DoublePower(double base,double exponent)

{

return exp(exponent*log(base));

}

...

x=DoublePower(2.0,3.74);

Hope it helps.

--

Graz, Austria www.hls-software.com