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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating powers

Status
Not open for further replies.

xlav

Technical User
Oct 23, 2003
223
JM
Tried to calculate 2 cubed using 2^3 but it doesn't work. Is there another operator that I can use without using pow() in math.h?.

-x
 
result = pow(2, 3);

Ion Filipski
1c.bmp
 
Thanks. It seems there is no alternative to pow().

-x

































 
Howdy,

Power(const Extended Base, const Extended Exponent)
IntPower(const Extended Base, const int Exponent)

Both are defined in math.hpp (that's not math.h :)
There are a LOT more math functions defined in (BorlandDirectory)\Includes\VCL\math.hpp. They may be useful in the future...

Good luck,
onrdbandit

No! Try not. Do, or do not. There is no try. - Yoda
 
Thanks for your suggestions.

-x
 
Hey !!!


You can always try j=i<<k;
where
i=2;
k=3-1; // when you want to calculate Cube
// if square then, k=2-1
Its 100% platform independent.

Regards,
SwapSawe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top