Skip to content

Latest commit

 

History

History

README.md

cscdf

Compute the cosecant of a single-precision floating-point number (in degrees).

Usage

var cscdf = require( '@stdlib/math/base/special/cscdf' );

cscdf( x )

Computes the cosecant of a single-precision floating-point number (in degrees).

var v = cscdf( 30.0 );
// returns ~2.0

v = cscdf( 45.0 );
// returns ~1.41

v = cscdf( 60.0 );
// returns ~1.15

v = cscdf( 90.0 );
// returns 1.0

v = cscdf( 0.0 );
// returns Infinity

v = cscdf( NaN );
// returns NaN

Examples

var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var cscdf = require( '@stdlib/math/base/special/cscdf' );

var opts = {
    'dtype': 'float32'
};
var x = uniform( 100, -180.0, 180.0, opts );

logEachMap( 'cscdf(%0.4f) = %0.4f', x, cscdf );

C APIs

Usage

#include "stdlib/math/base/special/cscdf.h"

stdlib_base_cscdf( x )

Computes the cosecant of a single-precision floating-point number (in degrees).

float out = stdlib_base_cscdf( 30.0f );
// returns ~2.0f

out = stdlib_base_cscdf( 45.0f );
// returns ~1.41f

The function accepts the following arguments:

  • x: [in] float input value.
float stdlib_base_cscdf( const float x );

Examples

#include "stdlib/math/base/special/cscdf.h"
#include <stdio.h>

int main( void ) {
    const float x[] = { 30.0f, 45.0f, 60.0f, 90.0f };

    float y;
    int i;
    for ( i = 0; i < 4; i++ ) {
        y = stdlib_base_cscdf( x[ i ] );
        printf( "cscdf(%f) = %f\n", x[ i ], y );
    }
}