From a43c417c2e0489fdf632daa6ebe20c2e307750d8 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Jul 2026 08:18:56 +0000 Subject: [PATCH 1/2] bench: add missing native benchmark for `math/base/special/log1pmx` Adds `benchmark/benchmark.native.js` to exercise the native N-API addon via `tryRequire( './../lib/native.js' )`, mirroring the sibling pattern already present in 342 of 343 (99.7%) native packages under `@stdlib/math/base/special` (e.g. `log1p/benchmark/benchmark.native.js`). The benchmark reuses the JS benchmark's `uniform( 100, -1.0, 99.0 )` input distribution and skips when the addon is not built. --- .../log1pmx/benchmark/benchmark.native.js | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js new file mode 100644 index 000000000000..ad95e40b7eeb --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var log1pmx = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( log1pmx instanceof Error ) +}; + + +// MAIN // + +bench( format( '%s::native', pkg ), opts, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, -1.0, 99.0 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = log1pmx( x[ i%x.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); From c95574e19037be26138402c5da33b72de40b712c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Jul 2026 08:21:54 +0000 Subject: [PATCH 2/2] chore: update copyright year to 2026 in new native benchmark Fixes the `Lint Copyright Years` CI check on the newly added `log1pmx/benchmark/benchmark.native.js`, which requires the current year in the copyright header for newly added files. --- .../math/base/special/log1pmx/benchmark/benchmark.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js index ad95e40b7eeb..6e03910b64ba 100644 --- a/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/log1pmx/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* Copyright (c) 2026 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.