前页 | 后页 |
cbrt
Cube root.SYNOPSIS:
double x, y, cbrt();
y = cbrt(x);
DESCRIPTION:
Returns the cube root of the argument, which could be negative. Range reduction involves determining the power of 2 of the argument. A polynomial of degree 2 applied to the mantissa, and multiplication by the cube root of 1, 2, or 4 approximates the root to within about 0.1%. Then Newton's iteration is used three times to converge to an accurate result.
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
DEC -10,10 200000 1.8e-17 6.2e-18
IEEE 0,1e308 30000 1.5e-16 5.0e-17
JavaScript:
//
//Plot of y = 3vx.
//
function plotYforX(x1, x2)
{
for(var x = x1; x <= x2; x++)
{
var y = cephes.cbrt(x);
Session.Output("plot of x for " + x + " gives y of " + y);
}
}
function main()
{
plotYforX(-1,6);
}
main();