Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula exponent help

Status
Not open for further replies.

nickadeemus2002

Programmer
Feb 27, 2004
9
US
I have the following formula:
x = z + (1+y)^3

I need to put this in c++ syntax. This is what I have:

x=z+((1E3)+(yE3))

Is this correct?

 
No I don't think that is correct.


for the formula x = z + (1+y)^3

use cmath.

x = z + pow((1+y),3);
 
For small integer pow I advise you to not use function pow. For example you can do like this:
x = z + (1+y) *(1+y) *(1+y);

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top