@stdlib/math-base-special-negalucasf
v0.1.1
Published
Compute the nth negaLucas number in single-precision floating-point format.
Downloads
72
Readme
negaLucasf
Compute the nth negaLucas number in single-precision floating-point format.
The negaLucas numbers are the integer sequence
The sequence is defined by the recurrence relation
which yields
with seed values L_0 = 2 and L_{-1} = -1.
Installation
npm install @stdlib/math-base-special-negalucasfUsage
var negalucasf = require( '@stdlib/math-base-special-negalucasf' );negalucasf( n )
Computes the nth negaLucas number in single-precision floating-point format.
var v = negalucasf( 0 );
// returns 2
v = negalucasf( -1 );
// returns -1
v = negalucasf( -2 );
// returns 3
v = negalucasf( -3 );
// returns -4
v = negalucasf( -34 );
// returns 12752043If n < -34, the function returns NaN, as larger negaLucas numbers cannot be safely represented in single-precision floating-point format.
var v = negalucasf( -35 );
// returns NaNIf not provided a nonpositive integer value, the function returns NaN.
var v = negalucasf( -3.14 );
// returns NaN
v = negalucasf( 1 );
// returns NaNIf provided NaN, the function returns NaN.
var v = negalucasf( NaN );
// returns NaNExamples
var negalucasf = require( '@stdlib/math-base-special-negalucasf' );
var v;
var i;
for ( i = 0; i > -35; i-- ) {
v = negalucasf( i );
console.log( v );
}C APIs
Usage
#include "stdlib/math/base/special/negalucasf.h"stdlib_base_negalucasf( n )
Computes the nth negaLucas number in single-precision floating-point format.
float out = stdlib_base_negalucasf( 0.0f );
// returns 0.0f
out = stdlib_base_negalucasf( -1.0f );
// returns -1.0fThe function accepts the following arguments:
- n:
[in] floatinput value.
float stdlib_base_negalucasf( const float n );Examples
#include "stdlib/math/base/special/negalucasf.h"
#include <stdio.h>
int main( void ) {
float i;
float v;
for ( i = 0.0f; i > -35.0f; i-- ) {
v = stdlib_base_negalucasf( i );
printf( "negalucasf(%f) = %f\n", i, v );
}
}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.
