Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

README.md

Outline

cosdf

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

Usage

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

cosdf( x )

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

var v = cosdf( 0.0 );
// returns 1.0

v = cosdf( 60.0 );
// returns ~0.5

v = cosdf( 90.0 );
// returns 0.0

v = cosdf( NaN );
// returns NaN

Examples

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

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

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

C APIs

Usage

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

stdlib_base_cosdf( x )

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

float out = stdlib_base_cosdf( 0.0f );
// returns 1.0f

out = stdlib_base_cosdf( 60.0f );
// returns ~0.5f

The function accepts the following arguments:

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

Examples

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

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

    float y;
    int i;
    for ( i = 0; i < 5; i++ ) {
        y = stdlib_base_cosdf( x[ i ] );
        printf( "cosdf(%f) = %f\n", x[ i ], y );
    }
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.