Name: sl110371 Date: 06/21/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
It would be nice to have a Math.cbrt() function (cube root of a real number),
for those of us involved in numerical/graphics programming.
Looking at the JDK source code (publically available), there is a cbrt() native
method defined in the library but it is unused. The Math class would need to
be altered to call this method, similar to the way it invokes sqrt().
Math.pow(x, 1/3.0) can be used to compute a cube root, but is much less
efficient than a true cube root function. Also, special care must be taken for
negative values of x. (See work-around).
(Review ID: 105412)
======================================================================
Name: rmT116609 Date: 02/19/2002
DESCRIPTION OF THE PROBLEM :
It would be nice to have a cubic root method in java.lang.Math, for example :
public static double cbrt (double x)
This mathematical function is defined for all real values regardless of their sign, but computing it with Math.pow cannot be done directly for non positive values. We have to end up with this kind of code :
if (x >= 0)
c = Math.pow (x, 1.0 / 3.0);
else
c = -Math.pow (-x, 1.0 / 3.0);
(Review ID: 139858)
======================================================================
- relates to
-
JDK-8136799 Port fdlibm cbrt to Java
- Resolved
-
JDK-4943127 Update StrictMath regression tests to use hexadecimal floating-point literals
- Resolved
-
JDK-4893344 Regression tests for java.lang.Math would benefit from minor refactoring
- Resolved
-
JDK-4633024 Augment Java math libraries with methods from C libm and IEEE 754
- Closed