Compute the versed cosine of a single-precision floating-point number (in radians).
The versed cosine is defined as
var vercosf = require( '@stdlib/math/base/special/vercosf' );Computes the versed cosine of a single-precision floating-point number (in radians).
var v = vercosf( 0.0 );
// returns 2.0
v = vercosf( 3.141592653589793/2.0 );
// returns 1.0
v = vercosf( -3.141592653589793/6.0 );
// returns ~1.8660var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var TWO_PI = require( '@stdlib/constants/float32/two-pi' );
var vercosf = require( '@stdlib/math/base/special/vercosf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, 0.0, TWO_PI, opts );
logEachMap( 'vercosf(%0.4f) = %0.4f', x, vercosf );#include "stdlib/math/base/special/vercosf.h"Computes the versed cosine of a single-precision floating-point number (in radians).
float out = stdlib_base_vercosf( 0.0f );
// returns 2.0f
out = stdlib_base_vercosf( 3.141592653589793f / 2.0f );
// returns ~1.0fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_vercosf( const float x );#include "stdlib/math/base/special/vercosf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { 0.0f, 0.523f, 0.785f, 1.047f, 3.14f };
float y;
int i;
for ( i = 0; i < 5; i++ ) {
y = stdlib_base_vercosf( x[ i ] );
printf( "vercosf(%f) = %f\n", x[ i ], y );
}
}