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

Java Math Library...exponentials

Status
Not open for further replies.

patnim17

Programmer
Jun 19, 2005
111
0
0
US
Hi,
I need to calculate exponentials of 10's

ie..10 to the power of 2 or 3 or 4 etc.

But the return value of Math.pow(10,2) is a double. I need it to be an integer. How can I do that in Java?

Pat

 
cast it to an int :

int i = (int)Math.pow(10d, 2d);

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
thanks. I thought type casting was only for java objects. Did not know that we can type cast primitive data types also.
Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top