Can't use '^' with doubles?

futuristicmonkey

Golden Member
Feb 29, 2004
1,031
0
76
Hello. I'm coding a very small program in C++ to calculate the sine of an angle, using the Taylor series equation.

The taylor series goes: sin(x) = x - x^3/3! + x^5/5! - x^7/7! ...

Anyways, I need to use doubles to hold all the decimal places (for pi, and for x, because x needs to be in radians), but, I always get a compiler error telling me (paraphrased) that I can't use the '^' operator with doubles.

Is there anyway to raise a number to a power, without having to go: (x*x*x*x....)?
Oh, and is there any way to do the '!' without putting: (7*6*5....) ?

Thanks
- Ben
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
"You keep using that word. I do not think it means, what you think it means"

Bitwise-Exclusive-OR Operator: ^

You need to pow! kick it up a notch instead
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: DaveSimmons
"You keep using that word. I do not think it means, what you think it means"

Bitwise-Exclusive-OR Operator: ^

You need to pow! kick it up a notch instead

That was an awesome post :)