Skip to content

Commit c450a93

Browse files
committed
chore: code review
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent a897f64 commit c450a93

File tree

12 files changed

+32
-173
lines changed

12 files changed

+32
-173
lines changed

lib/node_modules/@stdlib/math/base/special/tribonaccif/README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ The [Tribonacci numbers][tribonacci-number] are the integer sequence
3232
0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, \ldots
3333
```
3434

35-
<!-- <div class="equation" align="center" data-raw-text="0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, \ldots" data-equation="eq:tribonacci_sequence">
36-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@3249a68fb57cd71148f87ef3b2774be70a04d80a/lib/node_modules/@stdlib/math/base/special/tribonacci/docs/img/equation_tribonacci_sequence.svg" alt="Tribonacci sequence">
37-
<br>
38-
</div> -->
39-
4035
<!-- </equation> -->
4136

4237
The sequence is defined by the recurrence relation
@@ -47,11 +42,6 @@ The sequence is defined by the recurrence relation
4742
F_n = F_{n-1} + F_{n-2} + F_{n-3}
4843
```
4944

50-
<!-- <div class="equation" align="center" data-raw-text="F_n = F_{n-1} + F_{n-2} + F_{n-3}" data-equation="eq:tribonacci_recurrence_relation">
51-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@3249a68fb57cd71148f87ef3b2774be70a04d80a/lib/node_modules/@stdlib/math/base/special/tribonacci/docs/img/equation_tribonacci_recurrence_relation.svg" alt="Tribonacci sequence recurrence relation">
52-
<br>
53-
</div> -->
54-
5545
<!-- </equation> -->
5646

5747
with seed values `F_0 = 0`, `F_1 = 0`, and `F_2 = 1`.
@@ -130,15 +120,13 @@ var v = tribonaccif( NaN );
130120
<!-- eslint no-undef: "error" -->
131121

132122
```javascript
123+
var logEachMap = require( '@stdlib/console/log-each-map' );
124+
var linspace = require( '@stdlib/array/base/linspace' );
133125
var tribonaccif = require( '@stdlib/math/base/special/tribonaccif' );
134126

135-
var v;
136-
var i;
127+
var v = linspace( 0, 30, 31 );
137128

138-
for ( i = 0; i < 31; i++ ) {
139-
v = tribonaccif( i );
140-
console.log( v );
141-
}
129+
logEachMap( 'tribonaccif(%d) = %0.4f', v, tribonaccif );
142130
```
143131

144132
</section>
@@ -177,10 +165,10 @@ Computes the nth [Tribonacci number][tribonacci-number] as a [single-precision f
177165

178166
```c
179167
float out = stdlib_base_tribonaccif( 0 );
180-
// returns 0
168+
// returns 0.0f
181169

182-
out = stdlib_base_tribonaccif( 1 );
183-
// returns 0
170+
out = stdlib_base_tribonaccif( 4 );
171+
// returns 2.0f
184172
```
185173

186174
The function accepts the following arguments:

lib/node_modules/@stdlib/math/base/special/tribonaccif/benchmark/benchmark.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ bench( pkg, function benchmark( b ) {
4040

4141
b.tic();
4242
for ( i = 0; i < b.iterations; i++ ) {
43-
y = tribonaccif( x[ i % x.length ] );
43+
y = tribonaccif( x[ i%x.length ] );
4444
if ( isnanf( y ) ) {
4545
b.fail( 'should not return NaN' );
4646
}
@@ -62,7 +62,7 @@ bench( pkg+'::table', function benchmark( b ) {
6262

6363
b.tic();
6464
for ( i = 0; i < b.iterations; i++ ) {
65-
y = TRIBONACCIF[ x[ i % x.length ] ];
65+
y = TRIBONACCIF[ x[ i%x.length ] ];
6666
if ( isnanf( y ) ) {
6767
b.fail( 'should not return NaN' );
6868
}
@@ -94,7 +94,7 @@ bench( pkg+'::naive_recursion', function benchmark( b ) {
9494

9595
b.tic();
9696
for ( i = 0; i < b.iterations; i++ ) {
97-
y = tribonaccif( x[ i % x.length ] );
97+
y = tribonaccif( x[ i%x.length ] );
9898
if ( isnanf( y ) ) {
9999
b.fail( 'should not return NaN' );
100100
}
@@ -132,7 +132,7 @@ bench( pkg+'::recursion_memoized', function benchmark( b ) {
132132

133133
b.tic();
134134
for ( i = 0; i < b.iterations; i++ ) {
135-
y = tribonaccif( x[ i % x.length ] );
135+
y = tribonaccif( x[ i%x.length ] );
136136
if ( isnanf( y ) ) {
137137
b.fail( 'should not return NaN' );
138138
}
@@ -168,7 +168,7 @@ bench( pkg+'::naive_iterative', function benchmark( b ) {
168168

169169
b.tic();
170170
for ( i = 0; i < b.iterations; i++ ) {
171-
y = tribonaccif( x[ i % x.length ] );
171+
y = tribonaccif( x[ i%x.length ] );
172172
if ( isnanf( y ) ) {
173173
b.fail( 'should not return NaN' );
174174
}
@@ -209,7 +209,7 @@ bench( pkg+'::iterative', function benchmark( b ) {
209209

210210
b.tic();
211211
for ( i = 0; i < b.iterations; i++ ) {
212-
y = tribonaccif( x[ i % x.length ] );
212+
y = tribonaccif( x[ i%x.length ] );
213213
if ( isnanf( y ) ) {
214214
b.fail( 'should not return NaN' );
215215
}
@@ -250,7 +250,7 @@ bench( pkg+'::iterative_memoized', function benchmark( b ) {
250250

251251
b.tic();
252252
for ( i = 0; i < b.iterations; i++ ) {
253-
y = tribonaccif( x[ i % x.length ] );
253+
y = tribonaccif( x[ i%x.length ] );
254254
if ( isnanf( y ) ) {
255255
b.fail( 'should not return NaN' );
256256
}

lib/node_modules/@stdlib/math/base/special/tribonaccif/benchmark/benchmark.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4747

4848
b.tic();
4949
for ( i = 0; i < b.iterations; i++ ) {
50-
y = tribonaccif( x[ i % x.length ] );
50+
y = tribonaccif( x[ i%x.length ] );
5151
if ( isnanf( y ) ) {
5252
b.fail( 'should not return NaN' );
5353
}

lib/node_modules/@stdlib/math/base/special/tribonaccif/benchmark/c/native/benchmark.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "stdlib/math/base/special/tribonaccif.h"
2020
#include <stdlib.h>
21+
#include <stdint.h>
2122
#include <stdio.h>
2223
#include <math.h>
2324
#include <time.h>

lib/node_modules/@stdlib/math/base/special/tribonaccif/docs/img/equation_tribonacci_recurrence_relation.svg

Lines changed: 0 additions & 44 deletions
This file was deleted.

lib/node_modules/@stdlib/math/base/special/tribonaccif/docs/img/equation_tribonacci_sequence.svg

Lines changed: 0 additions & 84 deletions
This file was deleted.

lib/node_modules/@stdlib/math/base/special/tribonaccif/examples/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818

1919
'use strict';
2020

21+
var logEachMap = require( '@stdlib/console/log-each-map' );
22+
var linspace = require( '@stdlib/array/base/linspace' );
2123
var tribonaccif = require( './../lib' );
2224

23-
var v;
24-
var i;
25+
var v = linspace( 0, 30, 31 );
2526

26-
for ( i = 0; i < 31; i++ ) {
27-
v = tribonaccif( i );
28-
console.log( v );
29-
}
27+
logEachMap( 'tribonaccif(%d) = %0.4f', v, tribonaccif );

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
"stdmath",
5757
"mathematics",
5858
"math",
59-
"special functions",
6059
"special",
6160
"function",
6261
"fibonacci",
6362
"tribonacci",
63+
"tribonaccif",
6464
"number"
6565
]
6666
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
#include "stdlib/math/base/special/tribonaccif.h"
2020
#include "stdlib/math/base/napi/unary.h"
2121

22-
// cppcheck-suppress shadowFunction
2322
STDLIB_MATH_BASE_NAPI_MODULE_I_F( stdlib_base_tribonaccif )

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "stdlib/math/base/special/tribonaccif.h"
2020
#include "stdlib/constants/float32/max_safe_nth_tribonacci.h"
21+
#include <stdint.h>
2122

2223
static const int32_t tribonaccif_value[ 31 ] = {
2324
0,
@@ -61,11 +62,11 @@ static const int32_t tribonaccif_value[ 31 ] = {
6162
*
6263
* @example
6364
* float out = stdlib_base_tribonaccif( 1 );
64-
* // returns 0
65+
* // returns 0.0f
6566
*/
6667
float stdlib_base_tribonaccif( const int32_t n ) {
6768
if ( n < 0 || n > STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_TRIBONACCI ) {
68-
return 0.0 / 0.0; // NaN
69+
return 0.0f / 0.0f; // NaN
6970
}
7071
return tribonaccif_value[ n ];
7172
}

0 commit comments

Comments
 (0)