atanf

Compute the arctangent of a single-precision floating-point number.

Usage

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

atanf( x )

Computes the arctangent of a single-precision floating-point number (in radians).

var v = atanf( 0.0 );
// returns 0.0

v = atanf( -3.14/4.0 );
// returns ~-0.666

Examples

var linspace = require( '@stdlib/array/base/linspace' );
var atanf = require( '@stdlib/math/base/special/atanf' );

var x = linspace( -1.0, 1.0, 100 );

var i;
for ( i = 0; i < x.length; i++ ) {
    console.log( atanf( x[ i ] ) );
}

C APIs

Usage

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

stdlib_base_atanf( x )

Computes the arctangent of a single-precision floating-point number (in radians).

float out = stdlib_base_atanf( 0.0f );
// returns 0.0f

out = stdlib_base_atanf( -3.14f/4.0f );
// returns ~-0.666f

The function accepts the following arguments:

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

Examples

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

int main( void ) {
    const float x[] = { -1000.0f, -777.78f, -555.56f, -333.33f, -111.11f, 111.11f, 333.33f, 555.56f, 777.78f, 1000.0f };

    float v;
    int i;
    for ( i = 0; i < 10; i++ ) {
        v = stdlib_base_atanf( x[ i ] );
        printf( "atan(%f) = %f\n", x[ i ], v );
    }
}
Did you find this page helpful?