@stdlib/math-base-special-ahaversinf
v0.1.1
Published
Compute the inverse half-value versed sine of a single-precision floating-point number.
Readme
ahaversinf
Compute the inverse half-value versed sine of a single-precision floating-point number.
The inverse half-value versed sine is defined as
Installation
npm install @stdlib/math-base-special-ahaversinfUsage
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.5708If 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 NaNExamples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var ahaversinf = require( '@stdlib/math-base-special-ahaversinf' );
var x = uniform( 100, 0.0, 1.0, {
'dtype': 'float32'
});
logEachMap( 'ahaversinf(%0.4f) = %0.4f', x, ahaversinf );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.0fIf x < 0, x > 1, or x is NaN, the function returns NaN.
float out = stdlib_base_ahaversinf( -3.14f );
// returns NaNThe function accepts the following arguments:
- x:
[in] floatinput 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 );
}
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
