Skip to content

Commit 52ea241

Browse files
refactor: C implementation
1 parent ff9d9d3 commit 52ea241

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lib/node_modules/@stdlib/math/base/special/tribonaccif/manifest.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"dependencies": [
3939
"@stdlib/math/base/napi/unary",
4040
"@stdlib/constants/float32/max-safe-nth-tribonacci",
41-
"@stdlib/math/base/assert/is-nanf"
41+
"@stdlib/math/base/assert/is-nanf",
42+
"@stdlib/math/base/assert/is-integerf"
4243
]
4344
},
4445
{
@@ -53,7 +54,8 @@
5354
"libpath": [],
5455
"dependencies": [
5556
"@stdlib/constants/float32/max-safe-nth-tribonacci",
56-
"@stdlib/math/base/assert/is-nanf"
57+
"@stdlib/math/base/assert/is-nanf",
58+
"@stdlib/math/base/assert/is-integerf"
5759
]
5860
},
5961
{
@@ -68,7 +70,8 @@
6870
"libpath": [],
6971
"dependencies": [
7072
"@stdlib/constants/float32/max-safe-nth-tribonacci",
71-
"@stdlib/math/base/assert/is-nanf"
73+
"@stdlib/math/base/assert/is-nanf",
74+
"@stdlib/math/base/assert/is-integerf"
7275
]
7376
}
7477
]

lib/node_modules/@stdlib/math/base/special/tribonaccif/src/main.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "stdlib/math/base/special/tribonaccif.h"
2020
#include "stdlib/constants/float32/max_safe_nth_tribonacci.h"
2121
#include "stdlib/math/base/assert/is_nanf.h"
22+
#include "stdlib/math/base/assert/is_integerf.h"
2223

2324
static const int32_t tribonaccif_value[ 31 ] = {
2425
0,
@@ -65,10 +66,12 @@ static const int32_t tribonaccif_value[ 31 ] = {
6566
* // returns 0
6667
*/
6768
float stdlib_base_tribonaccif( const int32_t n ) {
68-
if ( n < 0 || n > STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_TRIBONACCI || n == 3.14 ) { // eslint-disable-line max-len
69-
return 0.0 / 0.0; // NaN
70-
}
71-
if ( stdlib_base_is_nanf( n ) ){
69+
if (
70+
stdlib_base_is_nanf( n ) ||
71+
stdlib_base_is_integerf( n ) == false ||
72+
n < 0 ||
73+
n > STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_TRIBONACCI
74+
) {
7275
return 0.0 / 0.0; // NaN
7376
}
7477
return tribonaccif_value[ n ];

0 commit comments

Comments
 (0)