Jan 15, 2007 #1 patnim17 Programmer Jun 19, 2005 111 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
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
Jan 15, 2007 #2 sedj Programmer Aug 6, 2002 5,610 cast it to an int : int i = (int)Math.pow(10d, 2d); -------------------------------------------------- Free Java/J2EE Database Connection Pooling Software http://www.primrose.org.uk Upvote 0 Downvote
cast it to an int : int i = (int)Math.pow(10d, 2d); -------------------------------------------------- Free Java/J2EE Database Connection Pooling Software http://www.primrose.org.uk
Jan 15, 2007 Thread starter #3 patnim17 Programmer Jun 19, 2005 111 US thanks. I thought type casting was only for java objects. Did not know that we can type cast primitive data types also. Thank you. Upvote 0 Downvote
thanks. I thought type casting was only for java objects. Did not know that we can type cast primitive data types also. Thank you.