Arcvercosine
Compute the inverse versed cosine of a single-precision floating-point number (in radians).
The inverse versed cosine is defined as
Usage
var avercosf = require( '@stdlib/math/base/special/avercosf' );
avercosf( x )
Computes the inverse versed cosine of a single-precision floating-point number (in radians).
var v = avercosf( 0.0 );
// returns 0.0
v = avercosf( -3.141592653589793 / 2.0 );
// returns ~2.1783
v = avercosf( -3.141592653589793 / 6.0 );
// returns ~1.0742
If x < -2
, x > 0
, or x
is NaN
, the function returns NaN
.
var v = avercosf( 1.0 );
// returns NaN
v = avercosf( -3.14 );
// returns NaN
v = avercosf( NaN );
// returns NaN
Examples
var linspace = require( '@stdlib/array/base/linspace' );
var avercosf = require( '@stdlib/math/base/special/avercosf' );
var x = linspace( -2.0, 0.0, 100 );
var i;
for ( i = 0; i < x.length; i++ ) {
console.log( avercosf( x[ i ] ) );
}
C APIs
Usage
#include "stdlib/math/base/special/avercosf.h"
stdlib_base_avercosf( x )
Computes the inverse versed cosine of a single-precision floating-point number (in radians).
float out = stdlib_base_avercosf( -3.141592653589793f / 2.0f );
// returns ~2.1783f
If x < -2
, x > 0
, or x
is NaN
, the function returns NaN
.
float out = stdlib_base_avercosf( -3.141592653589793f );
// returns NaN
The function accepts the following arguments:
- x:
[in] float
input value.
float stdlib_base_avercosf( const float x );
Examples
#include "stdlib/math/base/special/avercosf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { -2.5f, -2.0f, -1.5f, -1.0f, -0.5f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f };
float v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_avercosf( x[ i ] );
printf( "avercosf(%f) = %f\n", x[ i ], v );
}
}