From 40140bbe9849e756593ef3fa8f36f838dde1a18e Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 06:48:19 +0000 Subject: [PATCH 01/29] feat: add strided/base/reinterpret-uint64 --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/lib/main.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/main.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/main.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/main.js new file mode 100644 index 000000000000..d08fe685352f --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/main.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 Uint32Array = require( '@stdlib/array/uint32' ); + + +// MAIN // + +/** +* Reinterprets a `Uint64Array` as a `Uint32Array`. +* +* @param {Uint64Array} x - input array +* @param {NonNegativeInteger} offset - starting index +* @returns {Uint32Array} `Uint32Array` view +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( 10 ); +* +* var out = reinterpret( x, 0 ); +* // returns +* +* var bool = ( out.buffer === x.buffer ); +* // returns true +*/ +function reinterpret( x, offset ) { + return new Uint32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = reinterpret; From 6dd0c59c0868baa8dd63475fa9add509e24144e8 Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 06:53:30 +0000 Subject: [PATCH 02/29] docs: add package.json --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/package.json | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/package.json diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/package.json b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/package.json new file mode 100644 index 000000000000..90f4b5ce00d3 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/strided/base/reinterpret-uint64", + "version": "0.0.0", + "description": "Reinterpret a Uint64Array as a Uint32Array.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "base", + "strided", + "array", + "unsigned-integer", + "uint32", + "reinterpret", + "cast", + "view" + ], + "__stdlib__": {} +} From 383a38ec41d0eed6e279678af47f3931e6227907 Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 06:54:59 +0000 Subject: [PATCH 03/29] feat: add entry point --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/lib/index.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/index.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/index.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/index.js new file mode 100644 index 000000000000..63da3088367a --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/index.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +/** +* Reinterpret a `Uint64Array` as a `Uint32Array`. +* +* @module @stdlib/strided/base/reinterpret-uint64 +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var reinterpret = require( '@stdlib/strided/base/reinterpret-uint64' ); +* +* var x = new Uint64Array( 10 ); +* +* var out = reinterpret( x, 0 ); +* // returns +* +* var bool = ( out.buffer === x.buffer ); +* // returns true +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; From cd5666a61cb0126eaad7294aaa42cbbc11ba6243 Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 07:02:25 +0000 Subject: [PATCH 04/29] test: adds test --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/test/test.js | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js new file mode 100644 index 000000000000..dc65a5dd356e --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js @@ -0,0 +1,101 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var isUint32Array = require( '@stdlib/assert/is-uint32array' ); +var ArrayBuffer = require( '@stdlib/array/buffer' ); +var reinterpret = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof reinterpret, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function reinterprets a 64-bit unsigned integer array', function test( t ) { + var values; + var v; + var i; + + values = [ + new Uint64Array( 10 ), + new Uint64Array( 5 ), + new Uint64Array( 20 ) + ]; + + for ( i = 0; i < values.length; i++ ) { + v = reinterpret( values[ i ], 0 ); + t.strictEqual( isUint32Array( v ), true, 'returns a Uint32Array' ); + t.strictEqual( v.buffer, values[ i ].buffer, 'returns a view' ); + t.strictEqual( v.length, values[ i ].length*2, 'has expected length' ); + t.strictEqual( v.byteOffset, 0, 'has expected byte offset' ); + } + t.end(); +}); + +tape( 'the function reinterprets a 64-bit unsigned integer array (byte offset)', function test( t ) { + var values; + var buf; + var v; + var i; + + buf = new ArrayBuffer( 1000 ); + values = [ + new Uint64Array( buf, 320, 10 ), + new Uint64Array( buf, 32, 5 ), + new Uint64Array( buf, 112, 20 ) + ]; + + for ( i = 0; i < values.length; i++ ) { + v = reinterpret( values[ i ], 0 ); + t.strictEqual( isUint32Array( v ), true, 'returns a Uint32Array' ); + t.strictEqual( v.buffer, buf, 'returns a view' ); + t.strictEqual( v.length, values[ i ].length*2, 'has expected length' ); + t.strictEqual( v.byteOffset, values[ i ].byteOffset, 'has expected byte offset' ); + } + t.end(); +}); + +tape( 'the function reinterprets a 64-bit unsigned integer array (index offset)', function test( t ) { + var values; + var v; + var i; + + values = [ + new Uint64Array( 10 ), + new Uint64Array( 5 ), + new Uint64Array( 20 ) + ]; + + for ( i = 0; i < values.length; i++ ) { + v = reinterpret( values[ i ], 2 ); + t.strictEqual( isUint32Array( v ), true, 'returns a Uint32Array' ); + t.strictEqual( v.buffer, values[ i ].buffer, 'returns a view' ); + t.strictEqual( v.length, (values[ i ].length-2)*2, 'has expected length' ); + t.strictEqual( v.byteOffset, 16, 'has expected byte offset' ); + } + t.end(); +}); From c2a1b47e3581956736eb3d0b7612d54a074fb46f Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 08:01:06 +0000 Subject: [PATCH 05/29] bench: adds benchmark --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../reinterpret-uint64/benchmark/benchmark.js | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js new file mode 100644 index 000000000000..eb6c37937e6a --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 bench = require( '@stdlib/bench' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var isUint32Array = require( '@stdlib/assert/is-uint32array' ); +var pkg = require( './../package.json' ).name; +var reinterpret = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + new Uint64Array( 10 ), + new Uint64Array( 5 ), + new Uint64Array( 20 ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = reinterpret( values[ i%values.length ], 1 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isUint32Array( out ) ) { + b.fail( 'should return a Uint32Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); From 13c9693bf5d86076f26b697cda8935e8d91e2b57 Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 08:08:31 +0000 Subject: [PATCH 06/29] docs: adds type definition --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../reinterpret-uint64/docs/types/index.d.ts | 47 ++++++++++++++++ .../reinterpret-uint64/docs/types/test.ts | 55 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/index.d.ts b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/index.d.ts new file mode 100644 index 000000000000..531b08fd2325 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Uint64Array } from '@stdlib/types/array'; + +/** +* Reinterprets a `Uint64Array` as a `Uint32Array`. +* +* @param x - input array +* @param offset - starting index +* @returns `Uint32Array` view +* +* @example +* var Uint64Array = require( '@stdlib/array/complex128' ); +* +* var x = new Uint64Array( 10 ); +* +* var out = reinterpret( x, 0 ); +* // returns +* +* var bool = ( out.buffer === x.buffer ); +*/ +declare function reinterpret( x: Uint64Array, offset: number ): Uint32Array; + + +// EXPORTS // + +export = reinterpret; diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/test.ts b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/test.ts new file mode 100644 index 000000000000..dbc746f522e6 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/types/test.ts @@ -0,0 +1,55 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +import Uint64Array = require( '@stdlib/array/uint64' ); +import reinterpret = require( './index' ); + + +// TESTS // + +// The function returns a Uint32Array... +{ + reinterpret( new Uint64Array( 10 ), 0 ); // $ExpectType Uint32Array +} + +// The compiler throws an error if not provided a first argument which is a Uint64Array... +{ + reinterpret( '10', 0 ); // $ExpectError + reinterpret( 10, 0 ); // $ExpectError + reinterpret( true, 0 ); // $ExpectError + reinterpret( false, 0 ); // $ExpectError + reinterpret( null, 0 ); // $ExpectError + reinterpret( undefined, 0 ); // $ExpectError + reinterpret( [], 0 ); // $ExpectError + reinterpret( {}, 0 ); // $ExpectError + reinterpret( ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if not provided a second argument which is a number... +{ + const x = new Uint64Array( 10 ); + + reinterpret( x, '10' ); // $ExpectError + reinterpret( x, true ); // $ExpectError + reinterpret( x, false ); // $ExpectError + reinterpret( x, null ); // $ExpectError + reinterpret( x, undefined ); // $ExpectError + reinterpret( x, [] ); // $ExpectError + reinterpret( x, {} ); // $ExpectError + reinterpret( x, ( x: number ): number => x ); // $ExpectError +} From 38c4bacd967f5dd84a10039613e825975b64071a Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 08:10:08 +0000 Subject: [PATCH 07/29] docs: adds repl file --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/docs/repl.txt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/repl.txt diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/repl.txt b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/repl.txt new file mode 100644 index 000000000000..52174bbc55b9 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( x, offset ) + Returns a Uint32Array view of a Uint64Array. + + Parameters + ---------- + x: Uint64Array + Input array. + + offset: integer + Starting index of the view relative to the Uint64Array. + + Returns + ------- + out: Uint32Array + Uint32Array view. + + Examples + -------- + > var x = new {{alias:@stdlib/array/uint64}}( 10 ); + > var out = {{alias}}( x, 0 ) + + > var bool = ( out.buffer === x.buffer ) + true + + See Also + -------- + From 596902f5e8ea94eb1e1b183b794ed6daec3dbc8e Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 08:40:45 +0000 Subject: [PATCH 08/29] docs: adds example --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - 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: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/examples/index.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js new file mode 100644 index 000000000000..1050fba2f763 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +var Uint64Array = require( '@stdlib/array/uint64' ); +var reinterpret = require( './../lib' ); + +// Define a 64-bit unsigned integer array: +var x = new Uint64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ); +// returns + +// Reinterpret as a `uint32` array: +var view = reinterpret( x, 0 ); +// returns + +// Set view elements: +view[ 0 ] = 0; +view[ 1 ] = 0; + +// Get the first element of the 64-bit unsigned integer array: +var u = x.get( 0 ); +// returns [ 0n ] + +console.log( u.toString() ); From 683e28eed61145d82f42aa5b54a00ece753387ba Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 08:41:28 +0000 Subject: [PATCH 09/29] chore: fix import order --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - 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: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../strided/base/reinterpret-uint64/benchmark/benchmark.js | 2 +- .../@stdlib/strided/base/reinterpret-uint64/test/test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js index eb6c37937e6a..4d9104762d5d 100644 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/benchmark/benchmark.js @@ -21,8 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Uint64Array = require( '@stdlib/array/uint64' ); var isUint32Array = require( '@stdlib/assert/is-uint32array' ); +var Uint64Array = require( '@stdlib/array/uint64' ); var pkg = require( './../package.json' ).name; var reinterpret = require( './../lib' ); diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js index dc65a5dd356e..1bf581b8b251 100644 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/test/test.js @@ -21,9 +21,9 @@ // MODULES // var tape = require( 'tape' ); -var Uint64Array = require( '@stdlib/array/uint64' ); -var isUint32Array = require( '@stdlib/assert/is-uint32array' ); var ArrayBuffer = require( '@stdlib/array/buffer' ); +var isUint32Array = require( '@stdlib/assert/is-uint32array' ); +var Uint64Array = require( '@stdlib/array/uint64' ); var reinterpret = require( './../lib' ); From 46707db252cdd0b6ab28b1edda9e0104b9aebfdf Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 09:11:08 +0000 Subject: [PATCH 10/29] chore: upadte exmpales --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/reinterpret-uint64/examples/index.js | 7 +-- .../base/reinterpret-uint64/lib/indices.js | 47 +++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js index 1050fba2f763..e16200933df7 100644 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js @@ -19,6 +19,7 @@ 'use strict'; var Uint64Array = require( '@stdlib/array/uint64' ); +var indices = require( './../lib/indices.js' ); var reinterpret = require( './../lib' ); // Define a 64-bit unsigned integer array: @@ -30,11 +31,11 @@ var view = reinterpret( x, 0 ); // returns // Set view elements: -view[ 0 ] = 0; -view[ 1 ] = 0; +view[ indices.LOW ] = 9; +view[ indices.HIGH ] = 0; // Get the first element of the 64-bit unsigned integer array: var u = x.get( 0 ); -// returns [ 0n ] +// returns [ 9n ] console.log( u.toString() ); diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js new file mode 100644 index 000000000000..57341d75b278 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 isLittleEndian = require( '@stdlib/assert/is-little-endian' ); + + +// MAIN // + +var indices; +var HIGH; +var LOW; + +if ( isLittleEndian === true ) { + HIGH = 1; // second index + LOW = 0; // first index +} else { + HIGH = 0; // first index + LOW = 1; // second index +} +indices = { + 'HIGH': HIGH, + 'LOW': LOW +}; + + +// EXPORTS // + +module.exports = indices; From 58884668896e8a896bc3346235a438e3b61ece6c Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 09:25:26 +0000 Subject: [PATCH 11/29] docs: add readme --- .../strided/base/reinterpret-uint64/README.md | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md new file mode 100644 index 000000000000..2fe9506aa562 --- /dev/null +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md @@ -0,0 +1,167 @@ + + +# reinterpret + +> Reinterpret a [`Uint64Array`][@stdlib/array/uint64] as a [`Uint32Array`][@stdlib/array/uint32]. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var reinterpret = require( '@stdlib/strided/base/reinterpret-uint64' ); +``` + +#### reinterpret( x, offset ) + +Returns a [`Uint32Array`][@stdlib/array/uint32] view of a [`Uint64Array`][@stdlib/array/uint64]. + +```javascript +var Uint64Array = require( '@stdlib/array/uint64' ); + +var x = new Uint64Array( 10 ); + +var view = reinterpret( x, 0 ); +// returns + +var bool = ( view.buffer === x.buffer ); +// returns true + +var len = view.length; +// returns 20 +``` + +The `offset` argument specifies the starting index of the returned [`Uint32Array`][@stdlib/array/uint32] view relative to the [`Uint64Array`][@stdlib/array/uint64]. + +```javascript +var Uint64Array = require( '@stdlib/array/uint64' ); +var indices = require( './lib/indices' ); + +var x = new Uint64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ); + +var view = reinterpret( x, 2 ); +// returns + +var len = view.length; +// returns 4 + +var hi = view[ indices.HIGH ]; +// returns 5 + +var lo = view[ indices.LOW ]; +// returns 6 +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var Uint64Array = require( '@stdlib/array/uint64' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-uint64' ); +var indices = require( './lib/indices' ); + +// Define a complex number array: +var x = new Uint64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ); +// returns + +// Reinterpret as a `uint32` array: +var view = reinterpret( x, 0 ); +// returns + +// Set view elements: +view[ indices.LOW ] = 9; +view[ indices.HIGH ] = 0; +// x => [ 9, 2, 3, 4, 5, 6, 7, 8 ] +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + From a35b9dc8132348de094d06982a025c0d6ee356fe Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 09:30:57 +0000 Subject: [PATCH 12/29] chore: upadte exmpales --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - 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: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../strided/base/reinterpret-uint64/README.md | 22 ++++----- .../base/reinterpret-uint64/examples/index.js | 7 ++- .../base/reinterpret-uint64/lib/indices.js | 47 ------------------- 3 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md index 2fe9506aa562..2213d7448c53 100644 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md @@ -63,21 +63,20 @@ The `offset` argument specifies the starting index of the returned [`Uint32Array ```javascript var Uint64Array = require( '@stdlib/array/uint64' ); -var indices = require( './lib/indices' ); -var x = new Uint64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ); +var x = new Uint64Array( [ 1, 2, 3, 4, 0, 0, 5, 6 ] ); -var view = reinterpret( x, 2 ); +var view = reinterpret( x, 4 ); // returns var len = view.length; -// returns 4 +// returns 8 -var hi = view[ indices.HIGH ]; -// returns 5 +var hi = view[ 0 ]; +// returns 0 -var lo = view[ indices.LOW ]; -// returns 6 +var lo = view[ 1 ]; +// returns 0 ``` @@ -103,7 +102,6 @@ var lo = view[ indices.LOW ]; ```javascript var Uint64Array = require( '@stdlib/array/uint64' ); var reinterpret = require( '@stdlib/strided/base/reinterpret-uint64' ); -var indices = require( './lib/indices' ); // Define a complex number array: var x = new Uint64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ); @@ -114,9 +112,9 @@ var view = reinterpret( x, 0 ); // returns // Set view elements: -view[ indices.LOW ] = 9; -view[ indices.HIGH ] = 0; -// x => [ 9, 2, 3, 4, 5, 6, 7, 8 ] +view[ 0 ] = 0; +view[ 1 ] = 0; +// x => [ 0n, 2n, 3n, 4n, 5n, 6n, 7n, 8n ] ``` diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js index e16200933df7..1050fba2f763 100644 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/examples/index.js @@ -19,7 +19,6 @@ 'use strict'; var Uint64Array = require( '@stdlib/array/uint64' ); -var indices = require( './../lib/indices.js' ); var reinterpret = require( './../lib' ); // Define a 64-bit unsigned integer array: @@ -31,11 +30,11 @@ var view = reinterpret( x, 0 ); // returns // Set view elements: -view[ indices.LOW ] = 9; -view[ indices.HIGH ] = 0; +view[ 0 ] = 0; +view[ 1 ] = 0; // Get the first element of the 64-bit unsigned integer array: var u = x.get( 0 ); -// returns [ 9n ] +// returns [ 0n ] console.log( u.toString() ); diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js deleted file mode 100644 index 57341d75b278..000000000000 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/lib/indices.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isLittleEndian = require( '@stdlib/assert/is-little-endian' ); - - -// MAIN // - -var indices; -var HIGH; -var LOW; - -if ( isLittleEndian === true ) { - HIGH = 1; // second index - LOW = 0; // first index -} else { - HIGH = 0; // first index - LOW = 1; // second index -} -indices = { - 'HIGH': HIGH, - 'LOW': LOW -}; - - -// EXPORTS // - -module.exports = indices; From f4b8af173e5cd25099befc06b50a3836ca5fa862 Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 17:40:29 +0000 Subject: [PATCH 13/29] chore: update example --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/strided/base/reinterpret-uint64/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md index 2213d7448c53..a51598da40ca 100644 --- a/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md +++ b/lib/node_modules/@stdlib/strided/base/reinterpret-uint64/README.md @@ -64,7 +64,7 @@ The `offset` argument specifies the starting index of the returned [`Uint32Array ```javascript var Uint64Array = require( '@stdlib/array/uint64' ); -var x = new Uint64Array( [ 1, 2, 3, 4, 0, 0, 5, 6 ] ); +var x = new Uint64Array( [ 1, 2, 3, 4, 0, 5, 6, 7 ] ); var view = reinterpret( x, 4 ); // returns From dfdaefa9c591435936049d6453fc25681f45346e Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 18:20:50 +0000 Subject: [PATCH 14/29] feat: add uint64 support for hasEqualValues --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../array/base/assert/has-equal-values/lib/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js index 7bb137c2c162..b328869526bb 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js @@ -22,10 +22,12 @@ var isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); var isComplex64Array = require( '@stdlib/array/base/assert/is-complex64array' ); +var isUint64Array = require( '@stdlib/assert/is-uint64array' ); var isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); +var reinterpretUint64 = require( '@stdlib/strided/base/reinterpret-uint64' ); var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); @@ -158,6 +160,13 @@ function hasEqualValues( x, y ) { } return accessors( xo, yo ); } + // If provided 64-bit unsigned integer arrays, reinterpret the arrays to avoid using accessors to access array elements... + if ( isUint64Array( x ) ) { + if ( isUint64Array( y ) ) { + return internal( reinterpretUint64( x, 0 ), reinterpretUint64( y, 0 ) ); + } + return accessors( xo, yo ); + } // If provided a complex number array, reinterpret as a real typed array and test interleaved real and imaginary components... if ( isComplex128Array( x ) ) { xr = reinterpret128( x, 0 ); From c0abe5bf3e6b1543c87143a50726993dcbe55fe8 Mon Sep 17 00:00:00 2001 From: Divit Date: Thu, 13 Aug 2026 18:54:09 +0000 Subject: [PATCH 15/29] test: adds test for hasEqualValues --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/assert/has-equal-values/test/test.js | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js index 9b0332e24927..9da602d4b458 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js @@ -25,6 +25,7 @@ var AccessorArray = require( '@stdlib/array/base/accessor' ); var Float64Array = require( '@stdlib/array/float64' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var Uint64Array = require( '@stdlib/array/uint64' ); var BooleanArray = require( '@stdlib/array/bool' ); var hasEqualValues = require( './../lib' ); @@ -165,6 +166,23 @@ tape( 'if provided empty collections, the function returns `true` (complex typed t.end(); }); +tape( 'if provided empty collections, the function returns `true` (64-bit unsigned integer array)', function test( t ) { + var out; + var x; + var y; + + x = new Uint64Array( [] ); + out = hasEqualValues( x, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [] ); + y = new Uint64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + t.end(); +}); + tape( 'if provided empty collections, the function returns `true` (accessor)', function test( t ) { var out; var x; @@ -287,6 +305,23 @@ tape( 'the function returns `true` if both arrays have equal values (complex typ t.end(); }); +tape( 'the function returns `true` if both arrays have equal values (64-bit unsigned integer array)', function test( t ) { + var out; + var x; + var y; + + x = new Uint64Array( [ 0, 0, 3, 0 ] ); + out = hasEqualValues( x, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [ 0, 0, 3, 0 ] ); + y = new Uint64Array( [ 0, 0, 3, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + t.end(); +}); + tape( 'the function returns `true` if both arrays have equal values (accessor)', function test( t ) { var out; var x; @@ -421,6 +456,19 @@ tape( 'the function returns `false` if both arrays do not have equal values (com t.end(); }); +tape( 'the function returns `false` if both arrays do not have equal values (64-bit unsigned integer array)', function test( t ) { + var out; + var x; + var y; + + x = new Uint64Array( [ 0, 0, 0, 0 ] ); + y = new Uint64Array( [ 1, 0, 0, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + t.end(); +}); + tape( 'the function returns `false` if both arrays do not have equal values (accessor)', function test( t ) { var out; var x; From 92736ca0cb63922cd728b57058e98ce2757ec1e8 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 26 Aug 2026 03:03:09 -0700 Subject: [PATCH 16/29] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/array/base/assert/has-equal-values/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js index b328869526bb..e0a416305ec1 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js @@ -160,7 +160,7 @@ function hasEqualValues( x, y ) { } return accessors( xo, yo ); } - // If provided 64-bit unsigned integer arrays, reinterpret the arrays to avoid using accessors to access array elements... + // If provided 64-bit unsigned integer arrays, reinterpret as arrays of interleaved high and low words... if ( isUint64Array( x ) ) { if ( isUint64Array( y ) ) { return internal( reinterpretUint64( x, 0 ), reinterpretUint64( y, 0 ) ); From 9860e9d5ff8e9a0b310ae587deaed70bec7ff523 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Sat, 26 Sep 2026 17:27:13 +0000 Subject: [PATCH 17/29] feat: add support for comparision of int64 and uin64 array with real valued arrays --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/assert/has-equal-values/lib/main.js | 183 +++++++++++++++++- 1 file changed, 179 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js index e0a416305ec1..f41449fd9696 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js @@ -20,15 +20,30 @@ // MODULES // +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var isBetween = require( '@stdlib/assert/is-between' ); +var isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); var isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); var isComplex64Array = require( '@stdlib/array/base/assert/is-complex64array' ); +var isInt64Array = require( '@stdlib/assert/is-int64array' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; var isUint64Array = require( '@stdlib/assert/is-uint64array' ); -var isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); -var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); +var reinterpretInt64 = require( '@stdlib/strided/base/reinterpret-int64' ); var reinterpretUint64 = require( '@stdlib/strided/base/reinterpret-uint64' ); -var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); +var uint64ToWords = require( '@stdlib/number/uint64/base/number2words' ).assign; +var int64ToWords = require( '@stdlib/number/int64/base/number2words' ).assign; +var signbit32 = require( '@stdlib/number/int32/base/signbit' ); +var indices = require( './indices.js' ); + + +// VARIABLES // + +var TWO_63 = 9223372036854775808; // 2^63 +var TWO_64 = 18446744073709551616; // 2^64 +var W = [ 0, 0 ]; // FUNCTIONS // @@ -114,6 +129,137 @@ function accessors( x, y ) { return true; } +/** +* Tests if a 64-bit unsigned integer array and a 64-bit signed integer array have equal values. +* +* ## Notes +* +* - Both input arrays are expected to have been reinterpreted as arrays of interleaved high and low words. +* - If the sign bit of a high word is set, the corresponding 64-bit signed integer is negative and, thus, cannot equal a 64-bit unsigned integer, even when the bit patterns are identical (e.g., `-1` and `2^64-1`). +* +* @private +* @param {Uint32Array} x - unsigned integer array reinterpreted as interleaved high and low words +* @param {Uint32Array} y - signed integer array reinterpreted as interleaved high and low words +* @returns {boolean} boolean indicating if both arrays have equal values +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var Int64Array = require( '@stdlib/array/int64' ); +* var reinterpretUint64 = require( '@stdlib/strided/base/reinterpret-uint64' ); +* var reinterpretInt64 = require( '@stdlib/strided/base/reinterpret-int64' ); +* +* var x = reinterpretUint64( new Uint64Array( [ 0, 0, 1, 0 ] ), 0 ); +* var y = reinterpretInt64( new Int64Array( [ 0, 0, 1, 0 ] ), 0 ); +* +* var out = mixed64( x, y ); +* // returns true +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var Int64Array = require( '@stdlib/array/int64' ); +* var reinterpretUint64 = require( '@stdlib/strided/base/reinterpret-uint64' ); +* var reinterpretInt64 = require( '@stdlib/strided/base/reinterpret-int64' ); +* +* var x = reinterpretUint64( new Uint64Array( [ 0, 0, 1, 0 ] ), 0 ); +* var y = reinterpretInt64( new Int64Array( [ 0, 0, -1, 0 ] ), 0 ); +* +* var out = mixed64( x, y ); +* // returns false +*/ +function mixed64( x, y ) { + var i; + for ( i = 0; i < x.length; i += 2 ) { + if ( + x[ i+indices.HIGH ] !== y[ i+indices.HIGH ] || + x[ i+indices.LOW ] !== y[ i+indices.LOW ] || + signbit32( y[ i+indices.HIGH ] ) + ) { + return false; + } + } + return true; +} + +/** +* Tests if a 64-bit integer array and an array of numeric values have equal values. +* +* ## Notes +* +* - The 64-bit integer array is expected to have been reinterpreted as an array of interleaved high and low words. +* - An element of the second input array is considered equal to a 64-bit integer only if the element is an integer on the interval `[min, max)` whose high and low words match those of the 64-bit integer. Splitting each element into high and low words (rather than converting each 64-bit integer to a double-precision floating-point number) avoids rounding errors for values exceeding the maximum safe integer. +* +* @private +* @param {Uint32Array} x - 64-bit integer array reinterpreted as interleaved high and low words +* @param {Object} y - second input array object +* @param {number} min - minimum value (inclusive) which can be represented by the 64-bit integer data type +* @param {number} max - maximum value (exclusive) which can be represented by the 64-bit integer data type +* @param {Function} toWords - function which splits a number into the high and low words of a 64-bit integer +* @returns {boolean} boolean indicating if both arrays have equal values +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var reinterpretUint64 = require( '@stdlib/strided/base/reinterpret-uint64' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* var toWords = require( '@stdlib/number/uint64/base/number2words' ).assign; +* +* var x = reinterpretUint64( new Uint64Array( [ 0, 0, 1, 0 ] ), 0 ); +* var y = arraylike2object( [ 0, 0, 1, 0 ] ); +* +* var out = numeric64( x, y, 0, 18446744073709551616, toWords ); +* // returns true +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* var reinterpretInt64 = require( '@stdlib/strided/base/reinterpret-int64' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* var toWords = require( '@stdlib/number/int64/base/number2words' ).assign; +* +* var x = reinterpretInt64( new Int64Array( [ 0, 0, -1, 0 ] ), 0 ); +* var y = arraylike2object( [ 0, 0, -1, 0 ] ); +* +* var out = numeric64( x, y, -9223372036854775808, 9223372036854775808, toWords ); +* // returns true +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* var reinterpretInt64 = require( '@stdlib/strided/base/reinterpret-int64' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* var toWords = require( '@stdlib/number/int64/base/number2words' ).assign; +* +* var x = reinterpretInt64( new Int64Array( [ 0, 0, -1, 0 ] ), 0 ); +* var y = arraylike2object( [ 0, 0, -2, 0 ] ); +* +* var out = numeric64( x, y, -9223372036854775808, 9223372036854775808, toWords ); +* // returns false +*/ +function numeric64( x, y, min, max, toWords ) { + var ydata; + var yget; + var v; + var i; + var j; + + ydata = y.data; + yget = y.accessors[ 0 ]; + + j = 0; + for ( i = 0; i < ydata.length; i++ ) { + v = yget( ydata, i ); + + // Only integers on the interval `[min, max)` can be exactly represented as 64-bit integers... + if ( !isInteger( v ) || !isBetween( v, min, max, 'closed', 'open' ) ) { + return false; + } + // Split the value into high and low words... + toWords( v, W, 1, 0 ); + if ( x[ j+indices.HIGH ] !== W[ 0 ] || x[ j+indices.LOW ] !== W[ 1 ] ) { + return false; + } + j += 2; + } + return true; +} + // MAIN // @@ -137,6 +283,16 @@ function accessors( x, y ) { * * var out = hasEqualValues( x, y ); * // returns false +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Uint64Array( [ 0, 0, 1, 0 ] ); +* var y = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); +* +* var out = hasEqualValues( x, y ); +* // returns true */ function hasEqualValues( x, y ) { var FLG; @@ -165,7 +321,25 @@ function hasEqualValues( x, y ) { if ( isUint64Array( y ) ) { return internal( reinterpretUint64( x, 0 ), reinterpretUint64( y, 0 ) ); } - return accessors( xo, yo ); + if ( isInt64Array( y ) ) { + return mixed64( reinterpretUint64( x, 0 ), reinterpretInt64( y, 0 ) ); + } + return numeric64( reinterpretUint64( x, 0 ), yo, 0, TWO_64, uint64ToWords ); + } + if ( isInt64Array( x ) ) { + if ( isInt64Array( y ) ) { + return internal( reinterpretInt64( x, 0 ), reinterpretInt64( y, 0 ) ); + } + if ( isUint64Array( y ) ) { + return mixed64( reinterpretUint64( y, 0 ), reinterpretInt64( x, 0 ) ); + } + return numeric64( reinterpretInt64( x, 0 ), yo, -TWO_63, TWO_63, int64ToWords ); + } + if ( isUint64Array( y ) ) { + return numeric64( reinterpretUint64( y, 0 ), xo, 0, TWO_64, uint64ToWords ); + } + if ( isInt64Array( y ) ) { + return numeric64( reinterpretInt64( y, 0 ), xo, -TWO_63, TWO_63, int64ToWords ); } // If provided a complex number array, reinterpret as a real typed array and test interleaved real and imaginary components... if ( isComplex128Array( x ) ) { @@ -182,6 +356,7 @@ function hasEqualValues( x, y ) { yr = reinterpret64( y, 0 ); FLG -= 1; } + // TODO: Consider adding support for comparing real valued arrays with complex valued arrays... if ( FLG === 0 ) { return internal( xr, yr ); } From f414234f14707d4c78599bb66718e86671a85164 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Sat, 26 Sep 2026 17:33:42 +0000 Subject: [PATCH 18/29] feat: add support for comparision of int64 and uin64 array with real valued arrays --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../assert/has-equal-values/lib/indices.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/indices.js diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/indices.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/indices.js new file mode 100644 index 000000000000..57341d75b278 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/indices.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 isLittleEndian = require( '@stdlib/assert/is-little-endian' ); + + +// MAIN // + +var indices; +var HIGH; +var LOW; + +if ( isLittleEndian === true ) { + HIGH = 1; // second index + LOW = 0; // first index +} else { + HIGH = 0; // first index + LOW = 1; // second index +} +indices = { + 'HIGH': HIGH, + 'LOW': LOW +}; + + +// EXPORTS // + +module.exports = indices; From 8238eb44237403db90acb007c13cf31d4cf2b726 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Sat, 26 Sep 2026 18:17:45 +0000 Subject: [PATCH 19/29] test: add tests --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/assert/has-equal-values/test/test.js | 484 ++++++++++++++++++ 1 file changed, 484 insertions(+) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js index 9da602d4b458..f1dd8669adc7 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js @@ -25,7 +25,15 @@ var AccessorArray = require( '@stdlib/array/base/accessor' ); var Float64Array = require( '@stdlib/array/float64' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var Int8Array = require( '@stdlib/array/int8' ); +var Uint8Array = require( '@stdlib/array/uint8' ); var Uint64Array = require( '@stdlib/array/uint64' ); +var Int64Array = require( '@stdlib/array/int64' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var Int64 = require( '@stdlib/number/int64/ctor' ); var BooleanArray = require( '@stdlib/array/bool' ); var hasEqualValues = require( './../lib' ); @@ -120,6 +128,45 @@ tape( 'if provided empty collections, the function returns `true` (mixed)', func out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); + x = new Uint64Array( [] ); + y = []; + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = []; + y = new Uint64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [] ); + y = new Float64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [] ); + y = new Int64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [] ); + y = new Uint32Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int32Array( [] ); + y = new Int64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [] ); + y = new Int32Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint32Array( [] ); + y = new Int64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); t.end(); }); @@ -183,6 +230,23 @@ tape( 'if provided empty collections, the function returns `true` (64-bit unsign t.end(); }); +tape( 'if provided empty collections, the function returns `true` (64-bit signed integer array)', function test( t ) { + var out; + var x; + var y; + + x = new Int64Array( [] ); + out = hasEqualValues( x, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [] ); + y = new Int64Array( [] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + t.end(); +}); + tape( 'if provided empty collections, the function returns `true` (accessor)', function test( t ) { var out; var x; @@ -259,6 +323,26 @@ tape( 'the function returns `true` if both arrays have equal values (mixed)', fu out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); + x = new Uint64Array( [ 0, 2, 0 ] ); + y = [ 0, 2, 0 ]; + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = [ 0, 2, 0 ]; + y = new Uint64Array( [ 0, 2, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ 0, -2, 0 ] ); + y = [ 0, -2, 0 ]; + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = [ 0, -2, 0 ]; + y = new Int64Array( [ 0, -2, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + t.end(); }); @@ -322,6 +406,157 @@ tape( 'the function returns `true` if both arrays have equal values (64-bit unsi t.end(); }); +tape( 'the function returns `true` if both arrays have equal values (64-bit signed integer array)', function test( t ) { + var out; + var x; + var y; + + x = new Int64Array( [ 0, -1, 3, 0 ] ); + out = hasEqualValues( x, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ 0, -1, 3, 0 ] ); + y = new Int64Array( [ 0, -1, 3, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `true` if both arrays have equal values (mixed 64-bit integer arrays)', function test( t ) { + var out; + var x; + var y; + + // Signed and unsigned 64-bit integer arrays: + x = new Uint64Array( [ 0, 1, 2, 3 ] ); + y = new Int64Array( [ 0, 1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Values exceeding the maximum safe integer (2^60 and 2^64-2^11): + x = new Uint64Array([ + 1, + Uint64.of( 268435456, 0 ), + Uint64.of( 4294967295, 4294965248 ) + ]); + y = new Float64Array([ + 1.0, + 1152921504606846976.0, + 18446744073709549568.0 + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Negative values and values exceeding the maximum safe integer (-2^63, -2^32, and 2^63-2^10): + x = new Int64Array([ + Int64.of( 2147483648, 0 ), + -4294967296, + -1, + 0, + 1, + Int64.of( 2147483647, 4294966272 ) + ]); + y = new Float64Array([ + -9223372036854775808.0, + -4294967296.0, + -1.0, + 0.0, + 1.0, + 9223372036854774784.0 + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Lower precision integer arrays: + x = new Uint64Array( [ 0, 1, 2, 4294967295 ] ); + y = new Uint32Array( [ 0, 1, 2, 4294967295 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ -2147483648, -1, 0, 2147483647 ] ); + y = new Int32Array( [ -2147483648, -1, 0, 2147483647 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [ 0, 1, 2, 255 ] ); + y = new Uint8Array( [ 0, 1, 2, 255 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ -128, -1, 0, 127 ] ); + y = new Int8Array( [ -128, -1, 0, 127 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Uint64Array( [ 0, 1, 2, 3 ] ); + y = new Int32Array( [ 0, 1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Unsigned 32-bit values exceeding the maximum 32-bit signed integer (2^31 and 2^32-1): + x = new Int64Array( [ 0, 2147483648, 4294967295 ] ); + y = new Uint32Array( [ 0, 2147483648, 4294967295 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ 0, 1, 2, 3 ] ); + y = new Uint8Array( [ 0, 1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + // Floating-point arrays: + x = new Uint64Array( [ 0, 1, 2, 3 ] ); + y = new Float32Array( [ 0.0, 1.0, 2.0, 3.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ 0, -1, 2, -3 ] ); + y = new Float32Array( [ 0.0, -1.0, 2.0, -3.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + // Accessor arrays: + x = new Uint64Array( [ 0, 1, 2, 3 ] ); + y = new AccessorArray( [ 0, 1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + x = new Int64Array( [ 0, -1, 2, 3 ] ); + y = new AccessorArray( [ 0, -1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + t.end(); +}); + tape( 'the function returns `true` if both arrays have equal values (accessor)', function test( t ) { var out; var x; @@ -422,6 +657,25 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); + x = new Uint64Array( [ 0, 0, 1 ] ); + y = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + y = new Uint64Array( [ 0, 0, 1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ 0, 0, -1 ] ); + y = [ 0, 0, 1 ]; + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = [ 0, 0, 1 ]; + y = new Int64Array( [ 0, 0, -1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); t.end(); }); @@ -469,6 +723,236 @@ tape( 'the function returns `false` if both arrays do not have equal values (64- t.end(); }); +tape( 'the function returns `false` if both arrays do not have equal values (64-bit signed integer array)', function test( t ) { + var out; + var x; + var y; + + x = new Int64Array( [ 0, 0, 0, 0 ] ); + y = new Int64Array( [ -1, 0, 0, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ 1, 0, 0, 0 ] ); + y = new Int64Array( [ -1, 0, 0, 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if both arrays do not have equal values (mixed 64-bit integer arrays)', function test( t ) { + var out; + var x; + var y; + + // Same bit pattern, but different values (2^64-1 and -1): + x = new Uint64Array( [ 0, Uint64.of( 4294967295, 4294967295 ) ] ); + y = new Int64Array( [ 0, -1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ 0, -1 ] ); + y = new Uint64Array( [ 0, Uint64.of( 4294967295, 4294967295 ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Uint64Array( [ 0, 1 ] ); + y = new Int64Array( [ 0, 2 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same low word, but different high words (2^32+1 and 1): + x = new Uint64Array( [ Uint64.of( 1, 1 ) ] ); + y = new Float64Array( [ 1.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Uint64Array( [ 1 ] ); + y = new Float64Array( [ 4294967297.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same high word, but different low words (2^32+1 and 2^32+2): + x = new Uint64Array( [ Uint64.of( 1, 1 ) ] ); + y = new Float64Array( [ 4294967298.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Values which cannot be represented as 64-bit unsigned integers: + x = new Uint64Array( [ 1 ] ); + y = new Float64Array( [ 1.5 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Float64Array( [ NaN ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Float64Array( [ Infinity ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Float64Array( [ -1.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Int32Array( [ -1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // 2^64 (which would wrap to zero if naively truncated to 64 bits): + x = new Uint64Array( [ 0 ] ); + y = new Float64Array( [ 18446744073709551616.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Values which cannot be represented as 64-bit signed integers (-2^63 versus 2^63 and -2^63-2^11): + x = new Int64Array( [ Int64.of( 2147483648, 0 ) ] ); + y = new Float64Array( [ 9223372036854775808.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Float64Array( [ -9223372036854777856.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ -1 ] ); + y = new Float64Array( [ 1.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Float64Array( [ -1.5 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same low word bit pattern (-1 and 2^32-1): + y = new Uint32Array( [ 4294967295 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Non-numeric values: + x = new Uint64Array( [ 1, 2 ] ); + y = [ '1', '2' ]; + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = [ true, true ]; + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new BooleanArray( [ true, true ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Complex128Array( [ 1.0, 0.0, 2.0, 0.0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ -1, 2 ] ); + y = [ '-1', '2' ]; + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if both arrays do not have equal values (mixed 64-bit and 32-bit integer arrays)', function test( t ) { + var out; + var x; + var y; + + // Same signedness: + x = new Uint64Array( [ 0, 1, 2, 3 ] ); + y = new Uint32Array( [ 0, 1, 2, 4 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ 0, -1, 2, -3 ] ); + y = new Int32Array( [ 0, -1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same low word, but different high words (2^32 and 0): + x = new Uint64Array( [ Uint64.of( 1, 0 ) ] ); + y = new Uint32Array( [ 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + x = new Int64Array( [ Int64.of( 1, 0 ) ] ); + y = new Int32Array( [ 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsigned 64-bit versus signed 32-bit: + x = new Uint64Array( [ 0, 1, 2, 3 ] ); + y = new Int32Array( [ 0, 1, 2, -3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same bit pattern in the low word (2^32-1 and -1): + x = new Uint64Array( [ 4294967295 ] ); + y = new Int32Array( [ -1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Negative 32-bit values can never equal unsigned 64-bit values (-2^31): + x = new Uint64Array( [ 2147483648 ] ); + y = new Int32Array( [ -2147483648 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Signed 64-bit versus unsigned 32-bit: + x = new Int64Array( [ 0, -1, 2, 3 ] ); + y = new Uint32Array( [ 0, 1, 2, 3 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same bit pattern in the low word (-1 and 2^32-1): + x = new Int64Array( [ -1 ] ); + y = new Uint32Array( [ 4294967295 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Negative 64-bit values can never equal unsigned 32-bit values (-2^31 and 2^31): + x = new Int64Array( [ -2147483648 ] ); + y = new Uint32Array( [ 2147483648 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + t.end(); +}); + tape( 'the function returns `false` if both arrays do not have equal values (accessor)', function test( t ) { var out; var x; From 0e1fc06605bcf852cf1050f48d15bf5cb6e3c341 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Sun, 27 Sep 2026 12:49:02 +0000 Subject: [PATCH 20/29] refactor: use hexcode value --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/array/base/assert/has-equal-values/lib/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js index f41449fd9696..590ee846aef5 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js @@ -41,8 +41,8 @@ var indices = require( './indices.js' ); // VARIABLES // -var TWO_63 = 9223372036854775808; // 2^63 -var TWO_64 = 18446744073709551616; // 2^64 +var TWO_63 = 0x8000000000000000; // 2^63 +var TWO_64 = 0x10000000000000000; // 2^64 var W = [ 0, 0 ]; From cd0b6ca103efb38d9be26b99deea16d76e5a25e4 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Sun, 27 Sep 2026 12:50:58 +0000 Subject: [PATCH 21/29] docs: use hexcode value in example --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/array/base/assert/has-equal-values/lib/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js index 590ee846aef5..082412b3ed6c 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/main.js @@ -205,7 +205,7 @@ function mixed64( x, y ) { * var x = reinterpretUint64( new Uint64Array( [ 0, 0, 1, 0 ] ), 0 ); * var y = arraylike2object( [ 0, 0, 1, 0 ] ); * -* var out = numeric64( x, y, 0, 18446744073709551616, toWords ); +* var out = numeric64( x, y, 0, 0x10000000000000000, toWords ); * // returns true * * @example @@ -217,7 +217,7 @@ function mixed64( x, y ) { * var x = reinterpretInt64( new Int64Array( [ 0, 0, -1, 0 ] ), 0 ); * var y = arraylike2object( [ 0, 0, -1, 0 ] ); * -* var out = numeric64( x, y, -9223372036854775808, 9223372036854775808, toWords ); +* var out = numeric64( x, y, -0x8000000000000000, 0x8000000000000000, toWords ); * // returns true * * @example @@ -229,7 +229,7 @@ function mixed64( x, y ) { * var x = reinterpretInt64( new Int64Array( [ 0, 0, -1, 0 ] ), 0 ); * var y = arraylike2object( [ 0, 0, -2, 0 ] ); * -* var out = numeric64( x, y, -9223372036854775808, 9223372036854775808, toWords ); +* var out = numeric64( x, y, -0x8000000000000000, 0x8000000000000000, toWords ); * // returns false */ function numeric64( x, y, min, max, toWords ) { From f954ce775c2ce3828bfeeab76b52f465d60f4c16 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Sun, 27 Sep 2026 17:47:40 +0000 Subject: [PATCH 22/29] test: improve tests --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/assert/has-equal-values/test/test.js | 345 ++++++++++++++---- 1 file changed, 273 insertions(+), 72 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js index f1dd8669adc7..25340abe786f 100644 --- a/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js +++ b/lib/node_modules/@stdlib/array/base/assert/has-equal-values/test/test.js @@ -35,9 +35,25 @@ var Int64Array = require( '@stdlib/array/int64' ); var Uint64 = require( '@stdlib/number/uint64/ctor' ); var Int64 = require( '@stdlib/number/int64/ctor' ); var BooleanArray = require( '@stdlib/array/bool' ); +var MAX_SAFE_INTEGER = require( '@stdlib/constants/float64/max-safe-integer' ); +var MIN_SAFE_INTEGER = require( '@stdlib/constants/float64/min-safe-integer' ); +var UINT32_MAX = require( '@stdlib/constants/uint32/max' ); +var INT32_MAX = require( '@stdlib/constants/int32/max' ); +var INT32_MIN = require( '@stdlib/constants/int32/min' ); +var UINT8_MAX = require( '@stdlib/constants/uint8/max' ); +var INT8_MAX = require( '@stdlib/constants/int8/max' ); +var INT8_MIN = require( '@stdlib/constants/int8/min' ); var hasEqualValues = require( './../lib' ); +// VARIABLES // + +var TWO_32 = 0x100000000; // 2^32 +var TWO_53 = 0x20000000000000; // 2^53 +var TWO_63 = 0x8000000000000000; // 2^63 +var TWO_64 = 0x10000000000000000; // 2^64 + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -167,6 +183,7 @@ tape( 'if provided empty collections, the function returns `true` (mixed)', func y = new Int64Array( [] ); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); + t.end(); }); @@ -403,6 +420,32 @@ tape( 'the function returns `true` if both arrays have equal values (64-bit unsi out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); + // Values spanning both words (2^32-1, 2^32, and 2^32+1): + x = new Uint64Array( [ UINT32_MAX, TWO_32, TWO_32+1 ] ); + y = new Uint64Array([ + Uint64.of( 0x00000000, 0xFFFFFFFF ), + Uint64.of( 0x00000001, 0x00000000 ), + Uint64.of( 0x00000001, 0x00000001 ) + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + // Safe and unsafe integers (2^53-1, 2^53, 2^53+1, and 2^64-1): + x = new Uint64Array([ + MAX_SAFE_INTEGER, + TWO_53, + Uint64.of( 0x00200000, 0x00000001 ), + Uint64.of( 0xFFFFFFFF, 0xFFFFFFFF ) + ]); + y = new Uint64Array([ + Uint64.of( 0x001FFFFF, 0xFFFFFFFF ), + Uint64.of( 0x00200000, 0x00000000 ), + Uint64.of( 0x00200000, 0x00000001 ), + Uint64.of( 0xFFFFFFFF, 0xFFFFFFFF ) + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + t.end(); }); @@ -420,6 +463,41 @@ tape( 'the function returns `true` if both arrays have equal values (64-bit sign out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); + // Negative values in two's complement (-1, -2^31, -2^32, and -2^32-1): + x = new Int64Array( [ -1, INT32_MIN, -TWO_32, -TWO_32-1 ] ); + y = new Int64Array([ + Int64.of( 0xFFFFFFFF, 0xFFFFFFFF ), + Int64.of( 0xFFFFFFFF, 0x80000000 ), + Int64.of( 0xFFFFFFFF, 0x00000000 ), + Int64.of( 0xFFFFFFFE, 0xFFFFFFFF ) + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + // Safe and unsafe integers (-(2^53-1), -2^53, -2^53-1, 2^53-1, 2^53, 2^53+1, -2^63, and 2^63-1): + x = new Int64Array([ + MIN_SAFE_INTEGER, + -TWO_53, + Int64.of( 0xFFDFFFFF, 0xFFFFFFFF ), + MAX_SAFE_INTEGER, + TWO_53, + Int64.of( 0x00200000, 0x00000001 ), + -TWO_63, + Int64.of( 0x7FFFFFFF, 0xFFFFFFFF ) + ]); + y = new Int64Array([ + Int64.of( 0xFFE00000, 0x00000001 ), + Int64.of( 0xFFE00000, 0x00000000 ), + Int64.of( 0xFFDFFFFF, 0xFFFFFFFF ), + Int64.of( 0x001FFFFF, 0xFFFFFFFF ), + Int64.of( 0x00200000, 0x00000000 ), + Int64.of( 0x00200000, 0x00000001 ), + Int64.of( 0x80000000, 0x00000000 ), + Int64.of( 0x7FFFFFFF, 0xFFFFFFFF ) + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + t.end(); }); @@ -437,16 +515,14 @@ tape( 'the function returns `true` if both arrays have equal values (mixed 64-bi out = hasEqualValues( y, x ); t.strictEqual( out, true, 'returns expected value' ); - // Values exceeding the maximum safe integer (2^60 and 2^64-2^11): + // Nonnegative values having the sign bit unset (2^53+1 and 2^63-1): x = new Uint64Array([ - 1, - Uint64.of( 268435456, 0 ), - Uint64.of( 4294967295, 4294965248 ) + Uint64.of( 0x00200000, 0x00000001 ), + Uint64.of( 0x7FFFFFFF, 0xFFFFFFFF ) ]); - y = new Float64Array([ - 1.0, - 1152921504606846976.0, - 18446744073709549568.0 + y = new Int64Array([ + Int64.of( 0x00200000, 0x00000001 ), + Int64.of( 0x7FFFFFFF, 0xFFFFFFFF ) ]); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); @@ -454,22 +530,68 @@ tape( 'the function returns `true` if both arrays have equal values (mixed 64-bi out = hasEqualValues( y, x ); t.strictEqual( out, true, 'returns expected value' ); - // Negative values and values exceeding the maximum safe integer (-2^63, -2^32, and 2^63-2^10): + // Safe integers (2^32-1, 2^32, and 2^53-1): + x = new Uint64Array( [ 0, UINT32_MAX, TWO_32, MAX_SAFE_INTEGER ] ); + y = new Float64Array( [ 0.0, UINT32_MAX, TWO_32, MAX_SAFE_INTEGER ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + x = new Int64Array([ - Int64.of( 2147483648, 0 ), - -4294967296, + MIN_SAFE_INTEGER, + -TWO_32, -1, 0, 1, - Int64.of( 2147483647, 4294966272 ) + TWO_32, + MAX_SAFE_INTEGER ]); y = new Float64Array([ - -9223372036854775808.0, - -4294967296.0, + MIN_SAFE_INTEGER, + -TWO_32, -1.0, 0.0, 1.0, - 9223372036854774784.0 + TWO_32, + MAX_SAFE_INTEGER + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Unsafe integers which are exactly representable as double-precision floating-point numbers (2^53, 2^60, and 2^64-2^11): + x = new Uint64Array([ + Uint64.of( 0x00200000, 0x00000000 ), + Uint64.of( 0x10000000, 0x00000000 ), + Uint64.of( 0xFFFFFFFF, 0xFFFFF800 ) + ]); + y = new Float64Array([ + TWO_53, + 0x1000000000000000, + 0xFFFFFFFFFFFFF800 + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Unsafe integers which are exactly representable as double-precision floating-point numbers (-2^63, -2^53, 2^53, and 2^63-2^10): + x = new Int64Array([ + Int64.of( 0x80000000, 0x00000000 ), + Int64.of( 0xFFE00000, 0x00000000 ), + Int64.of( 0x00200000, 0x00000000 ), + Int64.of( 0x7FFFFFFF, 0xFFFFFC00 ) + ]); + y = new Float64Array([ + -TWO_63, + -TWO_53, + TWO_53, + 0x7FFFFFFFFFFFFC00 ]); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); @@ -478,29 +600,29 @@ tape( 'the function returns `true` if both arrays have equal values (mixed 64-bi t.strictEqual( out, true, 'returns expected value' ); // Lower precision integer arrays: - x = new Uint64Array( [ 0, 1, 2, 4294967295 ] ); - y = new Uint32Array( [ 0, 1, 2, 4294967295 ] ); + x = new Uint64Array( [ 0, 1, 2, UINT32_MAX ] ); + y = new Uint32Array( [ 0, 1, 2, UINT32_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); out = hasEqualValues( y, x ); t.strictEqual( out, true, 'returns expected value' ); - x = new Int64Array( [ -2147483648, -1, 0, 2147483647 ] ); - y = new Int32Array( [ -2147483648, -1, 0, 2147483647 ] ); + x = new Int64Array( [ INT32_MIN, -1, 0, INT32_MAX ] ); + y = new Int32Array( [ INT32_MIN, -1, 0, INT32_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); out = hasEqualValues( y, x ); t.strictEqual( out, true, 'returns expected value' ); - x = new Uint64Array( [ 0, 1, 2, 255 ] ); - y = new Uint8Array( [ 0, 1, 2, 255 ] ); + x = new Uint64Array( [ 0, 1, 2, UINT8_MAX ] ); + y = new Uint8Array( [ 0, 1, 2, UINT8_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); - x = new Int64Array( [ -128, -1, 0, 127 ] ); - y = new Int8Array( [ -128, -1, 0, 127 ] ); + x = new Int64Array( [ INT8_MIN, -1, 0, INT8_MAX ] ); + y = new Int8Array( [ INT8_MIN, -1, 0, INT8_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); @@ -513,8 +635,8 @@ tape( 'the function returns `true` if both arrays have equal values (mixed 64-bi t.strictEqual( out, true, 'returns expected value' ); // Unsigned 32-bit values exceeding the maximum 32-bit signed integer (2^31 and 2^32-1): - x = new Int64Array( [ 0, 2147483648, 4294967295 ] ); - y = new Uint32Array( [ 0, 2147483648, 4294967295 ] ); + x = new Int64Array( [ 0, INT32_MAX+1, UINT32_MAX ] ); + y = new Uint32Array( [ 0, INT32_MAX+1, UINT32_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, true, 'returns expected value' ); @@ -676,6 +798,7 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix y = new Int64Array( [ 0, 0, -1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); + t.end(); }); @@ -720,6 +843,30 @@ tape( 'the function returns `false` if both arrays do not have equal values (64- out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); + // Same low word, but different high words (1 and 2^32+1): + x = new Uint64Array( [ Uint64.of( 0x00000000, 0x00000001 ) ] ); + y = new Uint64Array( [ Uint64.of( 0x00000001, 0x00000001 ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same high word, but different low words (2^32 and 2^32+1): + x = new Uint64Array( [ Uint64.of( 0x00000001, 0x00000000 ) ] ); + y = new Uint64Array( [ Uint64.of( 0x00000001, 0x00000001 ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsafe integers which are indistinguishable when converted to double-precision floating-point numbers (2^53 and 2^53+1): + x = new Uint64Array( [ Uint64.of( 0x00200000, 0x00000000 ) ] ); + y = new Uint64Array( [ Uint64.of( 0x00200000, 0x00000001 ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsafe integers which are indistinguishable when converted to double-precision floating-point numbers (2^64-1 and 2^64-2): + x = new Uint64Array( [ Uint64.of( 0xFFFFFFFF, 0xFFFFFFFF ) ] ); + y = new Uint64Array( [ Uint64.of( 0xFFFFFFFF, 0xFFFFFFFE ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + t.end(); }); @@ -738,47 +885,101 @@ tape( 'the function returns `false` if both arrays do not have equal values (64- out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); + // Values differing only in the sign bit (2^63-1 and -1): + x = new Int64Array( [ Int64.of( 0x7FFFFFFF, 0xFFFFFFFF ) ] ); + y = new Int64Array( [ -1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same low word, but different high words (-1 and 2^32-1): + x = new Int64Array( [ Int64.of( 0xFFFFFFFF, 0xFFFFFFFF ) ] ); + y = new Int64Array( [ Int64.of( 0x00000000, 0xFFFFFFFF ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsafe integers which are indistinguishable when converted to double-precision floating-point numbers (2^53 and 2^53+1): + x = new Int64Array( [ Int64.of( 0x00200000, 0x00000000 ) ] ); + y = new Int64Array( [ Int64.of( 0x00200000, 0x00000001 ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsafe integers which are indistinguishable when converted to double-precision floating-point numbers (-2^53 and -2^53-1): + x = new Int64Array( [ Int64.of( 0xFFE00000, 0x00000000 ) ] ); + y = new Int64Array( [ Int64.of( 0xFFDFFFFF, 0xFFFFFFFF ) ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + t.end(); }); -tape( 'the function returns `false` if both arrays do not have equal values (mixed 64-bit integer arrays)', function test( t ) { +tape( 'the function returns `false` if both arrays do not have equal values (mixed 64-bit unsigned integer arrays)', function test( t ) { var out; var x; var y; // Same bit pattern, but different values (2^64-1 and -1): - x = new Uint64Array( [ 0, Uint64.of( 4294967295, 4294967295 ) ] ); + x = new Uint64Array( [ 0, Uint64.of( 0xFFFFFFFF, 0xFFFFFFFF ) ] ); y = new Int64Array( [ 0, -1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - x = new Int64Array( [ 0, -1 ] ); - y = new Uint64Array( [ 0, Uint64.of( 4294967295, 4294967295 ) ] ); + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same bit pattern, but different values (2^63 and -2^63): + x = new Uint64Array( [ Uint64.of( 0x80000000, 0x00000000 ) ] ); + y = new Int64Array( [ Int64.of( 0x80000000, 0x00000000 ) ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + x = new Uint64Array( [ 0, 1 ] ); y = new Int64Array( [ 0, 2 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); // Same low word, but different high words (2^32+1 and 1): - x = new Uint64Array( [ Uint64.of( 1, 1 ) ] ); + x = new Uint64Array( [ Uint64.of( 0x00000001, 0x00000001 ) ] ); y = new Float64Array( [ 1.0 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); x = new Uint64Array( [ 1 ] ); - y = new Float64Array( [ 4294967297.0 ] ); + y = new Float64Array( [ TWO_32+1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); // Same high word, but different low words (2^32+1 and 2^32+2): - x = new Uint64Array( [ Uint64.of( 1, 1 ) ] ); - y = new Float64Array( [ 4294967298.0 ] ); + x = new Uint64Array( [ Uint64.of( 0x00000001, 0x00000001 ) ] ); + y = new Float64Array( [ TWO_32+2 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsafe integers which are not exactly representable as double-precision floating-point numbers (2^53+1 versus 2^53): + x = new Uint64Array( [ Uint64.of( 0x00200000, 0x00000001 ) ] ); + y = new Float64Array( [ TWO_53 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + + // Note: as a double-precision floating-point number, the literal 2^53+1 rounds to 2^53 and, thus, does not equal the exact 64-bit integer 2^53+1: + y = new Float64Array( [ TWO_53+1 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Unsafe integers which are not exactly representable as double-precision floating-point numbers (2^64-1 versus 2^64): + x = new Uint64Array( [ Uint64.of( 0xFFFFFFFF, 0xFFFFFFFF ) ] ); + y = new Float64Array( [ TWO_64-1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); + out = hasEqualValues( y, x ); + t.strictEqual( out, false, 'returns expected value' ); + // Values which cannot be represented as 64-bit unsigned integers: x = new Uint64Array( [ 1 ] ); y = new Float64Array( [ 1.5 ] ); @@ -803,66 +1004,60 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix // 2^64 (which would wrap to zero if naively truncated to 64 bits): x = new Uint64Array( [ 0 ] ); - y = new Float64Array( [ 18446744073709551616.0 ] ); + y = new Float64Array( [ TWO_64 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - // Values which cannot be represented as 64-bit signed integers (-2^63 versus 2^63 and -2^63-2^11): - x = new Int64Array( [ Int64.of( 2147483648, 0 ) ] ); - y = new Float64Array( [ 9223372036854775808.0 ] ); - out = hasEqualValues( x, y ); - t.strictEqual( out, false, 'returns expected value' ); + t.end(); +}); - y = new Float64Array( [ -9223372036854777856.0 ] ); - out = hasEqualValues( x, y ); - t.strictEqual( out, false, 'returns expected value' ); +tape( 'the function returns `false` if both arrays do not have equal values (mixed 64-bit signed integer arrays)', function test( t ) { + var out; + var x; + var y; - x = new Int64Array( [ -1 ] ); - y = new Float64Array( [ 1.0 ] ); + // Unsafe integers which are not exactly representable as double-precision floating-point numbers (-2^53-1 versus -2^53): + x = new Int64Array( [ Int64.of( 0xFFDFFFFF, 0xFFFFFFFF ) ] ); + y = new Float64Array( [ -TWO_53 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - y = new Float64Array( [ -1.5 ] ); - out = hasEqualValues( x, y ); + out = hasEqualValues( y, x ); t.strictEqual( out, false, 'returns expected value' ); - // Same low word bit pattern (-1 and 2^32-1): - y = new Uint32Array( [ 4294967295 ] ); + // Values which cannot be represented as 64-bit signed integers (-2^63 versus 2^63 and -2^63-2^11): + x = new Int64Array( [ Int64.of( 0x80000000, 0x00000000 ) ] ); + y = new Float64Array( [ TWO_63 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - out = hasEqualValues( y, x ); - t.strictEqual( out, false, 'returns expected value' ); - - // Non-numeric values: - x = new Uint64Array( [ 1, 2 ] ); - y = [ '1', '2' ]; + y = new Float64Array( [ -TWO_63-2048 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - y = [ true, true ]; + // 2^63-1 (which, as a double-precision floating-point number, rounds to 2^63 and cannot be represented as a 64-bit signed integer): + x = new Int64Array( [ Int64.of( 0x7FFFFFFF, 0xFFFFFFFF ) ] ); + y = new Float64Array( [ TWO_63-1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - y = new BooleanArray( [ true, true ] ); + x = new Int64Array( [ -1 ] ); + y = new Float64Array( [ 1.0 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - out = hasEqualValues( y, x ); + y = new Float64Array( [ -1.5 ] ); + out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - y = new Complex128Array( [ 1.0, 0.0, 2.0, 0.0 ] ); + // Same low word bit pattern (-1 and 2^32-1): + y = new Uint32Array( [ UINT32_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); out = hasEqualValues( y, x ); t.strictEqual( out, false, 'returns expected value' ); - x = new Int64Array( [ -1, 2 ] ); - y = [ '-1', '2' ]; - out = hasEqualValues( x, y ); - t.strictEqual( out, false, 'returns expected value' ); - t.end(); }); @@ -889,12 +1084,18 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix t.strictEqual( out, false, 'returns expected value' ); // Same low word, but different high words (2^32 and 0): - x = new Uint64Array( [ Uint64.of( 1, 0 ) ] ); + x = new Uint64Array( [ Uint64.of( 0x00000001, 0x00000000 ) ] ); y = new Uint32Array( [ 0 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); - x = new Int64Array( [ Int64.of( 1, 0 ) ] ); + x = new Int64Array( [ Int64.of( 0x00000001, 0x00000000 ) ] ); + y = new Int32Array( [ 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // Same low word, but different high words (-2^32 and 0): + x = new Int64Array( [ Int64.of( 0xFFFFFFFF, 0x00000000 ) ] ); y = new Int32Array( [ 0 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); @@ -909,7 +1110,7 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix t.strictEqual( out, false, 'returns expected value' ); // Same bit pattern in the low word (2^32-1 and -1): - x = new Uint64Array( [ 4294967295 ] ); + x = new Uint64Array( [ UINT32_MAX ] ); y = new Int32Array( [ -1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); @@ -917,9 +1118,9 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix out = hasEqualValues( y, x ); t.strictEqual( out, false, 'returns expected value' ); - // Negative 32-bit values can never equal unsigned 64-bit values (-2^31): - x = new Uint64Array( [ 2147483648 ] ); - y = new Int32Array( [ -2147483648 ] ); + // Negative 32-bit values can never equal unsigned 64-bit values (2^31 and -2^31): + x = new Uint64Array( [ 0x80000000 ] ); + y = new Int32Array( [ INT32_MIN ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); @@ -934,7 +1135,7 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix // Same bit pattern in the low word (-1 and 2^32-1): x = new Int64Array( [ -1 ] ); - y = new Uint32Array( [ 4294967295 ] ); + y = new Uint32Array( [ UINT32_MAX ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); @@ -942,8 +1143,8 @@ tape( 'the function returns `false` if both arrays do not have equal values (mix t.strictEqual( out, false, 'returns expected value' ); // Negative 64-bit values can never equal unsigned 32-bit values (-2^31 and 2^31): - x = new Int64Array( [ -2147483648 ] ); - y = new Uint32Array( [ 2147483648 ] ); + x = new Int64Array( [ INT32_MIN ] ); + y = new Uint32Array( [ INT32_MAX+1 ] ); out = hasEqualValues( x, y ); t.strictEqual( out, false, 'returns expected value' ); From 0c3917a38bfc8b8e39d9e87cfc72f869312e8fc7 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 18:15:22 +0000 Subject: [PATCH 23/29] feat: add arrest/is-equal-int64array --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../assert/is-equal-int64array/lib/index.js | 54 ++++++++++++++++ .../assert/is-equal-int64array/lib/main.js | 61 +++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/lib/main.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/lib/index.js b/lib/node_modules/@stdlib/assert/is-equal-int64array/lib/index.js new file mode 100644 index 000000000000..5210357509f5 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/lib/index.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +/** +* Test if two arguments are both Int64Arrays and have equal values. +* +* @module @stdlib/assert/is-equal-int64array +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* var isEqualInt64Array = require( '@stdlib/assert/is-equal-int64array' ); +* +* var x = new Int64Array( [ 1, 2, 3 ] ); +* var y = new Int64Array( [ 1, 2, 3 ] ); +* +* var out = isEqualInt64Array( x, y ); +* // returns true +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* var isEqualInt64Array = require( '@stdlib/assert/is-equal-int64array' ); +* +* var x = new Int64Array( [ 1, 2, 3 ] ); +* var y = new Int64Array( [ 1, 2, 4 ] ); +* +* var out = isEqualInt64Array( x, y ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/lib/main.js b/lib/node_modules/@stdlib/assert/is-equal-int64array/lib/main.js new file mode 100644 index 000000000000..88809d5b0813 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/lib/main.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 isInt64Array = require( '@stdlib/assert/is-int64array' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); + + +// MAIN // + +/** +* Tests if two arguments are both Int64Arrays and have equal values. +* +* @param {*} v1 - first value +* @param {*} v2 - second value +* @returns {boolean} boolean result +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* +* var x = new Int64Array( [ 1, 2, 3 ] ); +* var y = new Int64Array( [ 1, 2, 3 ] ); +* +* var out = isEqualInt64Array( x, y ); +* // returns true +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* +* var x = new Int64Array( [ 1, 2, 3 ] ); +* var y = new Int64Array( [ 1, 2, 4 ] ); +* +* var out = isEqualInt64Array( x, y ); +* // returns false +*/ +function isEqualInt64Array( v1, v2 ) { + return ( isInt64Array( v1 ) && isInt64Array( v2 ) && hasEqualValues( v1, v2 ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = isEqualInt64Array; From abe4b760bcf2170246cb18b72778694f49b79bb4 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 18:18:53 +0000 Subject: [PATCH 24/29] test: add test --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../assert/is-equal-int64array/test/test.js | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/test/test.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/test/test.js b/lib/node_modules/@stdlib/assert/is-equal-int64array/test/test.js new file mode 100644 index 000000000000..e767d7ed2813 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/test/test.js @@ -0,0 +1,136 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var Int64Array = require( '@stdlib/array/int64' ); +var typedarray = require( '@stdlib/array/typed' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var Int64 = require( '@stdlib/number/int64/ctor' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var isEqualInt64Array = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isEqualInt64Array, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided two Int64Arrays having equal values', function test( t ) { + var x; + var y; + + x = new Int64Array( [ 1, 2, 3 ] ); + t.strictEqual( isEqualInt64Array( x, x ), true, 'returns expected value' ); + + x = new Int64Array( [ 1, 2, 3 ] ); + y = new Int64Array( [ 1, 2, 3 ] ); + t.strictEqual( isEqualInt64Array( x, y ), true, 'returns expected value' ); + + x = new Int64Array( [ -1, -2, -3 ] ); + y = new Int64Array( [ -1, -2, -3 ] ); + t.strictEqual( isEqualInt64Array( x, y ), true, 'returns expected value' ); + + x = new Int64Array( [ 0, 0, 0 ] ); + y = new Int64Array( [ 0, 0, 0 ] ); + t.strictEqual( isEqualInt64Array( x, y ), true, 'returns expected value' ); + + // Values exceeding the maximum safe integer (-2^63 and 2^63-1): + x = new Int64Array( [ Int64.of( 2147483648, 0 ), Int64.of( 2147483647, 4294967295 ) ] ); // eslint-disable-line max-len + y = new Int64Array( [ Int64.of( 2147483648, 0 ), Int64.of( 2147483647, 4294967295 ) ] ); // eslint-disable-line max-len + t.strictEqual( isEqualInt64Array( x, y ), true, 'returns expected value' ); + + x = new Int64Array( 0 ); + y = new Int64Array( 0 ); + t.strictEqual( isEqualInt64Array( x, y ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided two Int64Arrays having equal values', function test( t ) { + var x; + var y; + var i; + + x = [ + '', + 'beep', + 5, + 3.14, + -3.14, + 0.0, + -0.0, + true, + false, + null, + void 0, + [ 1.0 ], + {}, + function noop() {}, + typedarray( 10, 'float64' ), + typedarray( 10, 'int32' ), + typedarray( 10, 'uint32' ), + [ 1.0, 2.0, 3.0 ], + [ NaN, NaN, NaN ], + new Int64Array( [ 1, 2, 3 ] ), + new Int64Array( [ 1, 2, 3 ] ), + new Int64Array( [ 1, 2, 3 ] ), + new Int64Array( [ 1, 2, 3 ] ), + new Int64Array( [ 1, -2, 3 ] ), + new Int64Array( [ Int64.of( 2147483648, 0 ) ] ), + new Int64Array( [ -1 ] ) + ]; + y = [ + 'abc', + 'boop', + -5, + -3.14, + 3.14, + -0.0, + 0.0, + false, + true, + void 0, + null, + [ -1.0 ], + {}, + function noop() {}, + typedarray( 10, 'float64' ), + typedarray( 10, 'uint32' ), + new Int64Array( 10 ), + [ 2.0, 4.0, 6.0 ], + [ NaN, NaN, NaN ], + new Int64Array( [ 2, 4, 6 ] ), + new Int64Array( [ 1, 2 ] ), + new Uint64Array( [ 1, 2, 3 ] ), + typedarray( [ 1.0, 2.0, 3.0 ], 'float64' ), + new Int64Array( [ 1, 2, 3 ] ), + new Int64Array( [ Int64.of( 2147483648, 1 ) ] ), + new Uint64Array( [ Uint64.of( 4294967295, 4294967295 ) ] ) + ]; + for ( i = 0; i < x.length; i++ ) { + t.strictEqual( isEqualInt64Array( x[ i ], y[ i ] ), false, 'returns expected value when provided '+x[ i ]+' and '+y[ i ] ); + } + t.end(); +}); From 0d0d7a530d02cb01c4137e6874fe921a541c7992 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 18:26:14 +0000 Subject: [PATCH 25/29] bench: add benchmarks --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../benchmark/benchmark.length.js | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/benchmark/benchmark.length.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/benchmark/benchmark.length.js b/lib/node_modules/@stdlib/assert/is-equal-int64array/benchmark/benchmark.length.js new file mode 100644 index 000000000000..3665237aae1b --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/benchmark/benchmark.length.js @@ -0,0 +1,98 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pow = require( '@stdlib/math/base/special/pow' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var Int64Array = require( '@stdlib/array/int64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var isEqualInt64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = new Int64Array( zeroTo( len ) ); + var y = new Int64Array( zeroTo( len ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var bool; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isEqualInt64Array( x, y ); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); From 2f96e87ad780a8a83d402e449c6396ecd327c181 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 18:29:07 +0000 Subject: [PATCH 26/29] docs: add docs --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../assert/is-equal-int64array/docs/repl.txt | 32 ++++++++++++ .../is-equal-int64array/docs/types/index.d.ts | 51 +++++++++++++++++++ .../is-equal-int64array/docs/types/test.ts | 36 +++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/repl.txt new file mode 100644 index 000000000000..6f63b2fe2c36 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/repl.txt @@ -0,0 +1,32 @@ + +{{alias}}( v1, v2 ) + Tests if two arguments are both Int64Arrays and have equal values. + + Parameters + ---------- + v1: any + First input value. + + v2: any + Second input value. + + Returns + ------- + bool: boolean + Boolean indicating whether two arguments are equal. + + Examples + -------- + > var x = new {{alias:@stdlib/array/int64}}( [ 1, 2, 3 ] ); + > var y = new {{alias:@stdlib/array/int64}}( [ 1, 2, 3 ] ); + > var bool = {{alias}}( x, y ) + true + + > x = new {{alias:@stdlib/array/int64}}( [ 1, 2, 3 ] ); + > y = new {{alias:@stdlib/array/int64}}( [ 1, 2, 4 ] ); + > bool = {{alias}}( x, y ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/index.d.ts new file mode 100644 index 000000000000..7567eb0db0fa --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/index.d.ts @@ -0,0 +1,51 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests if two arguments are both Int64Arrays and have equal values. +* +* @param v1 - first input value +* @param v2 - second input value +* @returns boolean indicating whether two arguments are equal +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* +* var x = new Int64Array( [ 1, 2, 3 ] ); +* var y = new Int64Array( [ 1, 2, 3 ] ); +* +* var out = isEqualInt64Array( x, y ); +* // returns true +* +* @example +* var Int64Array = require( '@stdlib/array/int64' ); +* +* var x = new Int64Array( [ 1, 2, 3 ] ); +* var y = new Int64Array( [ 1, 2, 4 ] ); +* +* var out = isEqualInt64Array( x, y ); +* // returns false +*/ +declare function isEqualInt64Array( v1: any, v2: any ): boolean; + + +// EXPORTS // + +export = isEqualInt64Array; diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/test.ts new file mode 100644 index 000000000000..0fcd7f55c03b --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/docs/types/test.ts @@ -0,0 +1,36 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +import isEqualInt64Array = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isEqualInt64Array( 3.14, 3.14 ); // $ExpectType boolean + isEqualInt64Array( null, null ); // $ExpectType boolean + isEqualInt64Array( 'beep', 'boop' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isEqualInt64Array(); // $ExpectError + isEqualInt64Array( 3.14 ); // $ExpectError + isEqualInt64Array( 'beep', 'beep', 3.14 ); // $ExpectError +} From a0798de4b4abd5fc29516a2b480990adb2e7b50a Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 18:29:36 +0000 Subject: [PATCH 27/29] docs: add examples --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - 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: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../is-equal-int64array/examples/index.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/examples/index.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/examples/index.js b/lib/node_modules/@stdlib/assert/is-equal-int64array/examples/index.js new file mode 100644 index 000000000000..b297318d4ea5 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +var Int64Array = require( '@stdlib/array/int64' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var isEqualInt64Array = require( './../lib' ); + +var x = new Int64Array( [ 1, 2, 3 ] ); +var y = new Int64Array( [ 1, 2, 3 ] ); +var out = isEqualInt64Array( x, y ); +console.log( out ); +// => true + +x = new Int64Array( [ 1, 2, 3 ] ); +y = new Uint64Array( [ 1, 2, 3 ] ); +out = isEqualInt64Array( x, y ); +console.log( out ); +// => false + +x = new Int64Array( [ 1, 2, 3 ] ); +y = new Int64Array( [ 1, 2, 4 ] ); +out = isEqualInt64Array( x, y ); +console.log( out ); +// => false From 77b83fc35ce6f7628968424c7253432035793171 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 18:30:31 +0000 Subject: [PATCH 28/29] docs: add readme --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../assert/is-equal-int64array/README.md | 104 ++++++++++++++++++ .../assert/is-equal-int64array/package.json | 76 +++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/README.md create mode 100644 lib/node_modules/@stdlib/assert/is-equal-int64array/package.json diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md b/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md new file mode 100644 index 000000000000..ce5ca52eb973 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md @@ -0,0 +1,104 @@ + + +# isEqualInt64Array + +> Test if two arguments are both Int64Arrays and have equal values. + +
+ +## Usage + +```javascript +var isEqualInt64Array = require( '@stdlib/assert/is-equal-int64array' ); +``` + +#### isEqualInt64Array( v1, v2 ) + +Tests if two arguments are both Int64Arrays and have equal values. + +```javascript +var Int64Array = require( '@stdlib/array/int64' ); + +var x = new Int64Array( [ 1, 2 ] ); +var y = new Int64Array( [ 1, 2 ] ); +var bool = isEqualInt64Array( x, y ); +// returns true + +bool = isEqualInt64Array( x, new Int64Array( [ 1, 3 ] ) ); +// returns false +``` + +
+ + + +
+ +
+ + + +
+ +## Examples + + + +```javascript +var Int64Array = require( '@stdlib/array/int64' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var isEqualInt64Array = require( '@stdlib/assert/is-equal-int64array' ); + +var x = new Int64Array( [ 1, 2, 3 ] ); +var y = new Int64Array( [ 1, 2, 3 ] ); +var out = isEqualInt64Array( x, y ); +// returns true + +x = new Int64Array( [ 1, 2, 3 ] ); +y = new Uint64Array( [ 1, 2, 3 ] ); +out = isEqualInt64Array( x, y ); +// returns false + +x = new Int64Array( [ 1, 2, 3 ] ); +y = new Int64Array( [ 1, 2, 4 ] ); +out = isEqualInt64Array( x, y ); +// returns false +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/package.json b/lib/node_modules/@stdlib/assert/is-equal-int64array/package.json new file mode 100644 index 000000000000..d44cc6896414 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/package.json @@ -0,0 +1,76 @@ +{ + "name": "@stdlib/assert/is-equal-int64array", + "version": "0.0.0", + "description": "Test if two arguments are both Int64Arrays and have equal values.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdassert", + "assertion", + "assert", + "utilities", + "utility", + "utils", + "util", + "equal", + "same", + "strict", + "is", + "isequal", + "isstrictequal", + "type", + "check", + "valid", + "validate", + "test", + "typed", + "array", + "int64", + "int64array" + ] +} From 2bd8f8ec77e286775f386f39f0bc1ab9b28b5000 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 00:29:16 +0200 Subject: [PATCH 29/29] docs: add links Signed-off-by: Athan --- .../@stdlib/assert/is-equal-int64array/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md b/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md index ce5ca52eb973..10aaa4401f17 100644 --- a/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md +++ b/lib/node_modules/@stdlib/assert/is-equal-int64array/README.md @@ -20,7 +20,7 @@ limitations under the License. # isEqualInt64Array -> Test if two arguments are both Int64Arrays and have equal values. +> Test if two arguments are both [Int64Arrays][@stdlib/array/int64] and have equal values.
@@ -32,7 +32,7 @@ var isEqualInt64Array = require( '@stdlib/assert/is-equal-int64array' ); #### isEqualInt64Array( v1, v2 ) -Tests if two arguments are both Int64Arrays and have equal values. +Tests if two arguments are both [Int64Arrays][@stdlib/array/int64] and have equal values. ```javascript var Int64Array = require( '@stdlib/array/int64' ); @@ -99,6 +99,8 @@ out = isEqualInt64Array( x, y );