Cube Root

Compute the cube root.

Usage

var cbrt = require( '@stdlib/math/base/special/cbrt' );

cbrt( x )

Computes the cube root.

var v = cbrt( 64.0 );
// returns 4.0

v = cbrt( 27.0 );
// returns 3.0

v = cbrt( 0.0 );
// returns 0.0

v = cbrt( -0.0 );
// returns -0.0

v = cbrt( -9.0 );
// returns ~-2.08

v = cbrt( NaN );
// returns NaN

Examples

var randu = require( '@stdlib/random/base/randu' );
var cbrt = require( '@stdlib/math/base/special/cbrt' );

var x;
var i;

for ( i = 0; i < 100; i++ ) {
    x = (randu()*200.0) - 400.0;
    console.log( 'cbrt(%d) = %d', x, cbrt( x ) );
}