ahavercosf
Compute the inverse half-value versed cosine of a single-precision floating point number.
The inverse half-value versed cosine is defined as
Usage
var ahavercosf = require( '@stdlib/math/base/special/ahavercosf' );
ahavercosf( x )
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
Examples
var linspace = require( '@stdlib/array/base/linspace' );
var ahavercosf = require( '@stdlib/math/base/special/ahavercosf' );
var x = linspace( 0.0, 1.0, 100 );
var i;
for ( i = 0; i < x.length; i++ ) {
console.log( ahavercosf( x[ i ] ) );
}
C APIs
Usage
#include "stdlib/math/base/special/ahavercosf.h"
stdlib_base_ahavercosf( x )
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 );
Examples
#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 );
}
}