Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@

var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
var FLOAT64_MAX_SAFE_NTH_TRIBONACCI = require( '@stdlib/constants/float64/max-safe-nth-tribonacci' ); // eslint-disable-line id-length
var TRIBONACCI = require( './tribonacci.json' );


// VARIABLES //

var MAX_TRIBONACCI = 63;


// MAIN //

/**
Expand Down Expand Up @@ -83,7 +79,7 @@ function tribonacci( n ) {
isnan( n ) ||
isInteger( n ) === false ||
n < 0 ||
n > MAX_TRIBONACCI
n > FLOAT64_MAX_SAFE_NTH_TRIBONACCI
) {
return NaN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/math/base/napi/unary"
"@stdlib/math/base/napi/unary",
"@stdlib/constants/float64/max-safe-nth-tribonacci"
]
},
{
Expand All @@ -49,7 +50,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/constants/float64/max-safe-nth-tribonacci"
]
},
{
"task": "examples",
Expand All @@ -61,7 +64,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/constants/float64/max-safe-nth-tribonacci"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

#include "stdlib/math/base/special/tribonacci.h"
#include "stdlib/constants/float64/max_safe_nth_tribonacci.h"

static const int32_t STDLIB_CONSTANTS_FLOAT64_MAX_SAFE_NTH_TRIBONACCI = 63; // TODO: consider making a package similar to `@stdlib/constants/float64/max-safe-nth-fibonacci`
static const int64_t tribonacci_value[ 64 ] = {
0,
0,
Expand Down Expand Up @@ -96,7 +96,7 @@ static const int64_t tribonacci_value[ 64 ] = {
* // returns 0
*/
double stdlib_base_tribonacci( const int32_t n ) {
if ( n < 0 || n > STDLIB_CONSTANTS_FLOAT64_MAX_SAFE_NTH_TRIBONACCI ) {
if ( n < 0 || n > STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_TRIBONACCI ) {
return 0.0 / 0.0; // NaN
}
return tribonacci_value[ n ];
Expand Down
Loading