Can you tell me what should i do in order to compute for the cube root of a number using java?
Super thanks in advance to anyone who could help.
CUBE ROOT IN JAVA
Page 1 of 18 Replies  16604 Views  Last Post: 15 January 2010  11:30 PM
Replies To: CUBE ROOT IN JAVA
#2
Re: CUBE ROOT IN JAVA
Posted 14 January 2010  06:39 AM
the Math.pow() function in Java takes two doubles as its arguments (which means they can be fractions). A property of exponentiation is that powers which are fractions are equivalent to nthroots. Therefore cube roots are equivalent to raising a number to the (1/3) power.
Hope this helps.
Hope this helps.
This post has been edited by Dark_Nexus: 14 January 2010  06:42 AM
#3
Re: CUBE ROOT IN JAVA
Posted 14 January 2010  06:57 AM
hmm. is the pow function also supported in Java ME? its still not working for me..
#4
Re: CUBE ROOT IN JAVA
Posted 14 January 2010  09:03 AM
ME is restricted to 1.3 and the Math library has been around since 1.0
So we'd need to see your snippet to determine why "it's not working".
So we'd need to see your snippet to determine why "it's not working".
#5
Re: CUBE ROOT IN JAVA
Posted 14 January 2010  10:00 AM
And what do you mean by "not working?" Does it not compile? Or is it not giving you the desired result?
#6
Re: CUBE ROOT IN JAVA
Posted 14 January 2010  10:54 PM
use Math.cbrt() function
for more functions in math class, go to http://java.sun.com/...4/tt1102.html#1
for more functions in math class, go to http://java.sun.com/...4/tt1102.html#1
#7
Re: CUBE ROOT IN JAVA
Posted 15 January 2010  10:46 PM
when i said it's not working, i mean it doesn't compile.
Math.cbrt(x) and Math.pow(x,y) functions are not included in the package in Java ME. it is very limited compared to java SE.
Can you help me extract the cube root of numbers? any other idea?
i really need this function for the mobile application that i am working with.
Math.cbrt(x) and Math.pow(x,y) functions are not included in the package in Java ME. it is very limited compared to java SE.
Can you help me extract the cube root of numbers? any other idea?
i really need this function for the mobile application that i am working with.
#8
Re: CUBE ROOT IN JAVA
Posted 15 January 2010  11:04 PM
jastin_01, on 15 Jan, 2010  09:46 PM, said:
when i said it's not working, i mean it doesn't compile.
Math.cbrt(x) and Math.pow(x,y) functions are not included in the package in Java ME. it is very limited compared to java SE.
Can you help me extract the cube root of numbers? any other idea?
i really need this function for the mobile application that i am working with.
Math.cbrt(x) and Math.pow(x,y) functions are not included in the package in Java ME. it is very limited compared to java SE.
Can you help me extract the cube root of numbers? any other idea?
i really need this function for the mobile application that i am working with.
Google cube root algorithm
or if you are really really lazy
Google cube root algorithm java
#9
Re: CUBE ROOT IN JAVA
Posted 15 January 2010  11:30 PM
Or if you are incredibly lazy and don't even want to Google: http://today.java.ne...powmethod.html
Page 1 of 1
