Skip to content

Commit 01f6fd3

Browse files
committed
chore: use macros instead of vars and updated benchmark
1 parent 2ba1fb4 commit 01f6fd3

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

lib/node_modules/@stdlib/math/base/special/lucasf/benchmark/c/benchmark.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,17 @@ int lucasf( int n ) {
107107
static double benchmark( void ) {
108108
double elapsed;
109109
double t;
110-
int x;
110+
int x[ 100 ];
111111
int y;
112112
int i;
113113

114+
for ( i = 0; i < 100; i++ ) {
115+
x[ i ] = (int)floorf( 30.0f * rand_float() );
116+
}
117+
114118
t = tic();
115119
for ( i = 0; i < ITERATIONS; i++ ) {
116-
x = (int)floorf( 30.0f * rand_float() );
117-
y = lucasf( x );
120+
y = lucasf( x[ i % 100 ] );
118121
if ( y < 0 ) {
119122
printf( "should return a nonnegative integer\n" );
120123
break;

lib/node_modules/@stdlib/math/base/special/lucasf/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2424
var isIntegerf = require( '@stdlib/math/base/assert/is-integerf' );
25-
var MAX_LUCAS = 34;
25+
var MAX_LUCAS = require( '@stdlib/constants/float32/max-safe-nth-lucas' );
2626
var LUCAS = require( './lucas.json' );
2727

2828

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"libraries": [],
3737
"libpath": [],
3838
"dependencies": [
39-
"@stdlib/math/base/napi/unary"
39+
"@stdlib/math/base/napi/unary",
40+
"@stdlib/constants/float32/max-safe-nth-lucas"
4041
]
4142
},
4243
{
@@ -49,7 +50,9 @@
4950
],
5051
"libraries": [],
5152
"libpath": [],
52-
"dependencies": []
53+
"dependencies": [
54+
"@stdlib/constants/float32/max-safe-nth-lucas"
55+
]
5356
},
5457
{
5558
"task": "examples",
@@ -61,7 +64,9 @@
6164
],
6265
"libraries": [],
6366
"libpath": [],
64-
"dependencies": []
67+
"dependencies": [
68+
"@stdlib/constants/float32/max-safe-nth-lucas"
69+
]
6570
}
6671
]
6772
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
*/
1818

1919
#include "stdlib/math/base/special/lucasf.h"
20-
21-
static const int32_t STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_LUCAS = 34;
20+
#include "stdlib/constants/float32/max_safe_nth_lucas.h"
2221

2322
static const int32_t lucas_value[ 35 ] = {
2423
2,

0 commit comments

Comments
 (0)