Compute the hyperbolic secant of a single-precision floating-point number.
var sechf = require( '@stdlib/math/base/special/sechf' );Computes the hyperbolic secant of a single-precision floating-point number.
var v = sechf( 0.0 );
// returns 1.0
v = sechf( 2.0 );
// returns ~0.2658
v = sechf( -2.0 );
// returns ~0.2658
v = sechf( NaN );
// returns NaNvar uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var sechf = require( '@stdlib/math/base/special/sechf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, -5.0, 5.0, opts );
logEachMap( 'sechf(%0.4f) = %0.4f', x, sechf );#include "stdlib/math/base/special/sechf.h"Computes the hyperbolic secant of a single-precision floating-point number.
float out = stdlib_base_sechf( 2.0f );
// returns ~0.2658f
out = stdlib_base_sechf( -2.0f );
// returns ~0.2658fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_sechf( const float x );#include "stdlib/math/base/special/sechf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { -5.0f, -3.89f, -2.78f, -1.67f, -0.56f, 0.56f, 1.67f, 2.78f, 3.89f, 5.0f };
float v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_sechf( x[ i ] );
printf( "sechf(%f) = %f\n", x[ i ], v );
}
}