rcbrt

Compute the reciprocal of the principal cube root of a double-precision floating-point number.

The reciprocal of the principal cube root is defined as

Usage

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

rcbrt( x )

Computes the reciprocal (inverse) cube root of a double-precision floating-point number.

var v = rcbrt( 1.0 );
// returns 1.0

v = rcbrt( 8.0 );
// returns 0.5

v = rcbrt( 1000.0 );
// returns 0.1

v = rcbrt( 0.0 );
// returns Infinity

v = rcbrt( NaN );
// returns NaN

v = rcbrt( Infinity );
// returns 0.0

Examples

var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var rcbrt = require( '@stdlib/math/base/special/rcbrt' );

var x;
var i;
for ( i = 0; i < 100; i++ ) {
    x = discreteUniform( 0.0, 100.0 );
    console.log( 'rcbrt(%d) = %d', x, rcbrt( x ) );
}

C APIs

Usage

#include "stdlib/math/base/special/rcbrt.h"

stdlib_base_rcbrt( x )

Computes the reciprocal (inverse) cube root of a double-precision floating-point number.

double y = stdlib_base_rcbrt( 8.0 );
// returns 0.5

The function accepts the following arguments:

  • x: [in] double input value.
double stdlib_base_rcbrt( const double x );

Examples

#include "stdlib/math/base/special/rcbrt.h"
#include <stdio.h>

int main( void ) {
    const double x[] = { 3.14, 9.0, 0.0, 0.0/0.0 };

    double y;
    int i;
    for ( i = 0; i < 4; i++ ) {
        y = stdlib_base_rcbrt( x[ i ] );
        printf( "rcbrt(%lf) = %lf\n", x[ i ], y );
    }
}
Did you find this page helpful?