rcbrtf

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

The reciprocal of the principal cube root is defined as

Usage

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

rcbrtf( x )

Computes the reciprocal cube root of a single-precision floating-point number.

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

v = rcbrtf( 8.0 );
// returns 0.5

v = rcbrtf( 1000.0 );
// returns ~0.1

v = rcbrtf( 0.0 );
// returns Infinity

v = rcbrtf( NaN );
// returns NaN

v = rcbrtf( Infinity );
// returns 0.0

Examples

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

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

C APIs

Usage

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

stdlib_base_rcbrtf( x )

Computes the reciprocal cube root of a single-precision floating-point number.

float y = stdlib_base_rcbrtf( 8.0f );
// returns 0.5f

The function accepts the following arguments:

  • x: [in] float input value.
float stdlib_base_rcbrtf( const float x );

Examples

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

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

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