Compute the inverse half-value versed cosine of a single-precision floating point number.
The inverse half-value versed cosine is defined as
var ahavercosf = require( '@stdlib/math/base/special/ahavercosf' );
Computes the inverse half-value versed cosine of a single-precision floating point number (in radians).
var v = ahavercosf( 0.0 );
// returns ~3.1416
v = ahavercosf( 1.0 );
// returns 0.0
v = ahavercosf( 0.5 );
// returns ~1.5708
If x < 0
, x > 1
, or x
is NaN
, the function returns NaN
.
var v = ahavercosf( 1.5 );
// returns NaN
v = ahavercosf( -3.14 );
// returns NaN
v = ahavercosf( NaN );
// returns NaN
var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var ahavercosf = require( '@stdlib/math/base/special/ahavercosf' );
var x = uniform( 100, 0.0, 1.0, {
'dtype': 'float32'
});
logEachMap( 'ahavercosf(%0.4f) = %0.4f', x, ahavercosf );
#include "stdlib/math/base/special/ahavercosf.h"
Computes the inverse half-value versed cosine of a single-precision floating-point number (in radians).
float out = stdlib_base_ahavercosf( 0.0f );
// returns ~3.1416f
If x < 0
, x > 1
, or x
is NaN
, the function returns NaN
.
float out = stdlib_base_ahavercosf( -3.14f );
// returns NaN
The function accepts the following arguments:
- x:
[in] float
input value.
float stdlib_base_ahavercosf( const float x );
#include "stdlib/math/base/special/ahavercosf.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_ahavercosf( x[ i ] );
printf( "ahavercosf(%f) = %f\n", x[ i ], v );
}
}