Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: add missing native.js and fix variable range #6467

Merged
merged 2 commits into from
Apr 1, 2025
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 @@ -40,7 +40,7 @@ bench( pkg, function benchmark( b ) {
var y;
var i;

x = discreteUniform( 100, -77, 0 );
x = discreteUniform( 100, -76, 0 );
Copy link
Contributor Author

@anandkaranubc anandkaranubc Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discreteUniform returns values inclusive of both the minimum and maximum.

cc: @hrshya

Reference PR: #6430


b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand All @@ -67,7 +67,7 @@ bench( pkg+'::analytic', function benchmark( b ) {
return pow( -1.0, an ) * round( pow( PHI, an ) );
}

x = discreteUniform( 100, -77, 0 );
x = discreteUniform( 100, -76, 0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand All @@ -89,7 +89,7 @@ bench( pkg+'::table', function benchmark( b ) {
var y;
var i;

x = discreteUniform( 100, -77, 0 );
x = discreteUniform( 100, -76, 0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down Expand Up @@ -197,7 +197,7 @@ bench( pkg+'::naive_iterative', function benchmark( b ) {
return arr[ an ];
}

x = discreteUniform( 100, -77, 0 );
x = discreteUniform( 100, -76, 0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down Expand Up @@ -238,7 +238,7 @@ bench( pkg+'::iterative', function benchmark( b ) {
return b;
}

x = discreteUniform( 100, -77, 0 );
x = discreteUniform( 100, -76, 0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down Expand Up @@ -281,7 +281,7 @@ bench( pkg+'::iterative_memoized', function benchmark( b ) {
return arr[ an ];
}

x = discreteUniform( 100, -77, 0 );
x = discreteUniform( 100, -76, 0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down
70 changes: 70 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/negalucas/lib/native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var addon = require( './../src/addon.node' );


// MAIN //

/**
* Computes the nth negaLucas number.

Check warning on line 29 in lib/node_modules/@stdlib/math/base/special/negalucas/lib/native.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "nega"
*
* @private
* @param {NonPositiveInteger} n - the negaLucas number to compute

Check warning on line 32 in lib/node_modules/@stdlib/math/base/special/negalucas/lib/native.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "nega"
* @returns {integer} negaLucas number

Check warning on line 33 in lib/node_modules/@stdlib/math/base/special/negalucas/lib/native.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "nega"
*
* @example
* var y = negalucas( 0 );
* // returns 2
*
* @example
* y = negalucas( -1 );
* // returns -1
*
* @example
* y = negalucas( -2 );
* // returns 3
*
* @example
* y = negalucas( -3 );
* // returns -4
*
* @example
* y = negalucas( -4 );
* // returns 7
*
* @example
* y = negalucas( -5 );
* // returns -11
*
* @example
* y = negalucas( -6 );
* // returns 18
*/
function negalucas( n ) {
return addon( n );
}


// EXPORTS //

module.exports = negalucas;