@stdlib/math-base-special-cscf
v0.1.1
Published
Compute the cosecant of a single-precision floating-point number (in radians).
Downloads
52
Readme
Cosecant
Evaluate the cosecant of a single-precision floating-point number (in radians).
Installation
npm install @stdlib/math-base-special-cscfUsage
var cscf = require( '@stdlib/math-base-special-cscf' );cscf( x )
Evaluates the cosecant of a single-precision floating-point number (in radians).
var v = cscf( 0.0 );
// returns Infinity
v = cscf( 3.141592653589793/2.0 );
// returns 1.0
v = cscf( -3.141592653589793/6.0 );
// returns ~-2.0
v = cscf( 3.141592653589793/6.0 );
// returns ~2.0
v = cscf( NaN );
// returns NaNExamples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var TWO_PI = require( '@stdlib/constants-float32-two-pi' );
var cscf = require( '@stdlib/math-base-special-cscf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, 0.0, TWO_PI, opts );
logEachMap( 'cscf(%0.4f) = %0.4f', x, cscf );C APIs
Usage
#include "stdlib/math/base/special/cscf.h"stdlib_base_cscf( x )
Evaluates the cosecant of a single-precision floating-point number (in radians).
float out = stdlib_base_cscf( 0.0f );
// returns Infinity
out = stdlib_base_cscf( 3.141592653589793f / 2.0f );
// returns 1.0fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_cscf( const float x );Examples
#include "stdlib/math/base/special/cscf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { 0.523f, 0.785f, 1.047f, 3.14f };
float y;
int i;
for ( i = 0; i < 4; i++ ) {
y = stdlib_base_cscf( x[ i ] );
printf( "cscf(%f) = %f\n", x[ i ], y );
}
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
