ahaversinf

Compute the inverse half-value versed sine of a single-precision floating-point number.

The inverse half-value versed sine is defined as

Usage

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

ahaversinf( x )

Computes the inverse half-value versed sine of a single-precision floating-point number.

var v = ahaversinf( 0.0 );
// returns 0.0

v = ahaversinf( 1.0 );
// returns ~3.1416

v = ahaversinf( 0.5 );
// returns ~1.5708

If x < 0, x > 1, or x is NaN, the function returns NaN.

var v = ahaversinf( 1.5 );
// returns NaN

v = ahaversinf( -3.14 );
// returns NaN

v = ahaversinf( NaN );
// returns NaN

Examples

var linspace = require( '@stdlib/array/base/linspace' );
var ahaversinf = require( '@stdlib/math/base/special/ahaversinf' );

var x = linspace( 0.0, 1.0, 100 );

var i;
for ( i = 0; i < x.length; i++ ) {
    console.log( ahaversinf( x[ i ] ) );
}

C APIs

Usage

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

stdlib_base_ahaversinf( x )

Computes the inverse half-value versed sine of a single-precision floating-point number (in radians).

float out = stdlib_base_ahaversinf( 0.0f );
// returns 0.0f

If x < 0, x > 1, or x is NaN, the function returns NaN.

float out = stdlib_base_ahaversinf( -3.14f );
// returns NaN

The function accepts the following arguments:

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

Examples

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

int main( void ) {
    const float x[] = { -2.0f, -1.6f, -1.2f, -0.8f, -0.4f, 0.4f, 0.8f, 1.2f, 1.6f, 2.0f };
    
    float v;
    int i;
    for ( i = 0; i < 10; i++ ) {
        v = stdlib_base_ahaversinf( x[ i ] );
        printf( "ahaversin(%f) = %f\n", x[ i ], v );
    }
}
Did you find this page helpful?