From a91b0f94c0de8619797b64fbfd0b304f31a5f708 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Mon, 28 Sep 2026 18:51:15 +0000 Subject: [PATCH 01/11] feat: add is-same-uint64array --- 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: passed - 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/has-equal-values/lib/indices.js | 47 ++ .../base/assert/has-equal-values/lib/main.js | 190 ++++- .../base/assert/has-equal-values/test/test.js | 733 ++++++++++++++++++ .../assert/is-same-uint64array/lib/index.js | 54 ++ .../assert/is-same-uint64array/lib/main.js | 61 ++ .../assert/is-same-uint64array/package.json | 77 ++ 6 files changed, 1159 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/array/base/assert/has-equal-values/lib/indices.js create mode 100644 lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js create mode 100644 lib/node_modules/@stdlib/assert/is-same-uint64array/package.json 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; 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..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 @@ -20,13 +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 isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); -var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var isInt64Array = require( '@stdlib/assert/is-int64array' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var isUint64Array = require( '@stdlib/assert/is-uint64array' ); +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 reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); +var reinterpretInt64 = require( '@stdlib/strided/base/reinterpret-int64' ); +var reinterpretUint64 = require( '@stdlib/strided/base/reinterpret-uint64' ); +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 = 0x8000000000000000; // 2^63 +var TWO_64 = 0x10000000000000000; // 2^64 +var W = [ 0, 0 ]; // FUNCTIONS // @@ -112,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, 0x10000000000000000, 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, -0x8000000000000000, 0x8000000000000000, 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, -0x8000000000000000, 0x8000000000000000, 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 // @@ -135,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; @@ -158,6 +316,31 @@ function hasEqualValues( x, y ) { } return accessors( xo, yo ); } + // 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 ) ); + } + 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 ) ) { xr = reinterpret128( x, 0 ); @@ -173,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 ); } 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..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 @@ -25,10 +25,35 @@ 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 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 ) { @@ -119,6 +144,46 @@ 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(); }); @@ -165,6 +230,40 @@ 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` (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; @@ -241,6 +340,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(); }); @@ -287,6 +406,279 @@ 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' ); + + // 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(); +}); + +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' ); + + // 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(); +}); + +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' ); + + // Nonnegative values having the sign bit unset (2^53+1 and 2^63-1): + x = new Uint64Array([ + Uint64.of( 0x00200000, 0x00000001 ), + Uint64.of( 0x7FFFFFFF, 0xFFFFFFFF ) + ]); + y = new Int64Array([ + Int64.of( 0x00200000, 0x00000001 ), + Int64.of( 0x7FFFFFFF, 0xFFFFFFFF ) + ]); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // 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([ + MIN_SAFE_INTEGER, + -TWO_32, + -1, + 0, + 1, + TWO_32, + MAX_SAFE_INTEGER + ]); + y = new Float64Array([ + MIN_SAFE_INTEGER, + -TWO_32, + -1.0, + 0.0, + 1.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' ); + + out = hasEqualValues( y, x ); + t.strictEqual( out, true, 'returns expected value' ); + + // Lower precision integer arrays: + 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( [ 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, UINT8_MAX ] ); + y = new Uint8Array( [ 0, 1, 2, UINT8_MAX ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, true, 'returns expected value' ); + + 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' ); + + 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, 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' ); + + 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; @@ -387,6 +779,26 @@ 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(); }); @@ -421,6 +833,327 @@ 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' ); + + // 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(); +}); + +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' ); + + // 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 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( 0xFFFFFFFF, 0xFFFFFFFF ) ] ); + y = new Int64Array( [ 0, -1 ] ); + 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, 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( 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( [ 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( 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 ] ); + 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( [ TWO_64 ] ); + 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 signed integer arrays)', function test( t ) { + var out; + var x; + var y; + + // 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' ); + + out = hasEqualValues( y, x ); + 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( 0x80000000, 0x00000000 ) ] ); + y = new Float64Array( [ TWO_63 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + y = new Float64Array( [ -TWO_63-2048 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + // 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' ); + + 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( [ UINT32_MAX ] ); + 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 (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( 0x00000001, 0x00000000 ) ] ); + y = new Uint32Array( [ 0 ] ); + out = hasEqualValues( x, y ); + t.strictEqual( out, false, 'returns expected value' ); + + 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' ); + + // 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( [ UINT32_MAX ] ); + 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 and -2^31): + x = new Uint64Array( [ 0x80000000 ] ); + y = new Int32Array( [ INT32_MIN ] ); + 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( [ UINT32_MAX ] ); + 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( [ INT32_MIN ] ); + y = new Uint32Array( [ INT32_MAX+1 ] ); + 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; diff --git a/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js b/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js new file mode 100644 index 000000000000..e1a71fa34cb7 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-same-uint64array/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 Uint64Arrays and have the same values. +* +* @module @stdlib/assert/is-same-uint64array +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var isSameUint64Array = require( '@stdlib/assert/is-same-uint64array' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 3, 4 ] ); +* +* var out = isSameUint64Array( x, y ); +* // returns true +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var isSameUint64Array = require( '@stdlib/assert/is-same-uint64array' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 4, 4 ] ); +* +* var out = isSameUint64Array( x, y ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js b/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js new file mode 100644 index 000000000000..e8bc48174b0d --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-same-uint64array/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 isUint64Array = require( '@stdlib/assert/is-uint64array' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); + + +// MAIN // + +/** +* Tests if two arguments are both Uint64Arrays and have the same values. +* +* @param {*} v1 - first value +* @param {*} v2 - second value +* @returns {boolean} boolean result +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 3, 4 ] ); +* +* var out = isSameUint64Array( x, y ); +* // returns true +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 4, 4 ] ); +* +* var out = isSameUint64Array( x, y ); +* // returns false +*/ +function isSameUint64Array( v1, v2 ) { + return ( isUint64Array( v1 ) && isUint64Array( v2 ) && hasEqualValues( v1, v2 ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = isSameUint64Array; diff --git a/lib/node_modules/@stdlib/assert/is-same-uint64array/package.json b/lib/node_modules/@stdlib/assert/is-same-uint64array/package.json new file mode 100644 index 000000000000..fcb84dfb6391 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-same-uint64array/package.json @@ -0,0 +1,77 @@ +{ + "name": "@stdlib/assert/is-same-uint64array", + "version": "0.0.0", + "description": "Test if two arguments are both Uint64Arrays and have the same 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", + "issame", + "issamevalue", + "isequal", + "isstrictequal", + "type", + "check", + "valid", + "validate", + "test", + "typed", + "array", + "uint64" + ] +} From bb8c93863c65b6ddcce5c790aa683bc375d58c9a Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Mon, 28 Sep 2026 18:55:57 +0000 Subject: [PATCH 02/11] fix: implement is-equal-uint64array --- 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: 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-uint64array/lib/index.js | 54 +++++++++++++ .../assert/is-equal-uint64array/lib/main.js | 61 +++++++++++++++ .../assert/is-equal-uint64array/package.json | 77 +++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js new file mode 100644 index 000000000000..3dabe4706d8c --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/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 Uint64Arrays and have the equal values. +* +* @module @stdlib/assert/is-equal-uint64array +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 3, 4 ] ); +* +* var out = isEqualUint64Array( x, y ); +* // returns true +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 4, 4 ] ); +* +* var out = isEqualUint64Array( x, y ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js new file mode 100644 index 000000000000..28cfb4164c8a --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/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 isUint64Array = require( '@stdlib/assert/is-uint64array' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); + + +// MAIN // + +/** +* Tests if two arguments are both Uint64Arrays and have the equal values. +* +* @param {*} v1 - first value +* @param {*} v2 - second value +* @returns {boolean} boolean result +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 3, 4 ] ); +* +* var out = isEqualUint64Array( x, y ); +* // returns true +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); +* var y = new Uint64Array( [ 1, 2, 4, 4 ] ); +* +* var out = isEqualUint64Array( x, y ); +* // returns false +*/ +function isEqualUint64Array( v1, v2 ) { + return ( isUint64Array( v1 ) && isUint64Array( v2 ) && hasEqualValues( v1, v2 ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = isEqualUint64Array; diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json b/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json new file mode 100644 index 000000000000..514804e72c1c --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json @@ -0,0 +1,77 @@ +{ + "name": "@stdlib/assert/is-equal-uint64array", + "version": "0.0.0", + "description": "Test if two arguments are both Uint64Arrays and have the 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", + "same", + "equal", + "strict", + "is", + "issame", + "isequalvalue", + "isequal", + "isstrictequal", + "type", + "check", + "valid", + "validate", + "test", + "typed", + "array", + "uint64" + ] +} From 0229b40770ec2068f16a4a689ad36d5c47beedf9 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 03:54:58 +0000 Subject: [PATCH 03/11] 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 --- --- .../assert/is-equal-uint64array/test/test.js | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/test/test.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/test/test.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/test/test.js new file mode 100644 index 000000000000..10da6c61a772 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/test/test.js @@ -0,0 +1,129 @@ +/** +* @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 Uint64 = require( '@stdlib/number/uint64/ctor' ); +var isEqualUint64Array = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isEqualUint64Array, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided two Uint64Arrays having equal values', function test( t ) { + var x; + var y; + + x = new Uint64Array( [ 1, 2, 3 ] ); + t.strictEqual( isEqualUint64Array( x, x ), true, 'returns expected value' ); + + x = new Uint64Array( [ 1, 2, 3 ] ); + y = new Uint64Array( [ 1, 2, 3 ] ); + t.strictEqual( isEqualUint64Array( x, y ), true, 'returns expected value' ); + + x = new Uint64Array( [ 0, 0, 0 ] ); + y = new Uint64Array( [ 0, 0, 0 ] ); + t.strictEqual( isEqualUint64Array( x, y ), true, 'returns expected value' ); + + // Values exceeding the maximum safe integer (2^60 and 2^64-1): + x = new Uint64Array( [ Uint64.of( 268435456, 0 ), Uint64.of( 4294967295, 4294967295 ) ] ); // eslint-disable-line max-len + y = new Uint64Array( [ Uint64.of( 268435456, 0 ), Uint64.of( 4294967295, 4294967295 ) ] ); // eslint-disable-line max-len + t.strictEqual( isEqualUint64Array( x, y ), true, 'returns expected value' ); + + x = new Uint64Array( 0 ); + y = new Uint64Array( 0 ); + t.strictEqual( isEqualUint64Array( x, y ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided two Uint64Arrays 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 Uint64Array( [ 1, 2, 3 ] ), + new Uint64Array( [ 1, 2, 3 ] ), + new Uint64Array( [ 1, 2, 3 ] ), + new Uint64Array( [ 1, 2, 3 ] ), + new Uint64Array( [ Uint64.of( 268435456, 0 ) ] ), + new Uint64Array( [ Uint64.of( 4294967295, 4294967295 ) ] ) + ]; + 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 Uint64Array( 10 ), + [ 2.0, 4.0, 6.0 ], + [ NaN, NaN, NaN ], + new Uint64Array( [ 2, 4, 6 ] ), + new Uint64Array( [ 1, 2 ] ), + new Int64Array( [ 1, 2, 3 ] ), + typedarray( [ 1.0, 2.0, 3.0 ], 'float64' ), + new Uint64Array( [ Uint64.of( 268435456, 1 ) ] ), + new Int64Array( [ -1 ] ) + ]; + for ( i = 0; i < x.length; i++ ) { + t.strictEqual( isEqualUint64Array( x[ i ], y[ i ] ), false, 'returns expected value when provided '+x[ i ]+' and '+y[ i ] ); + } + t.end(); +}); From e7a241e6fdf4c9eedd9300848ddf15a2dfa1b235 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 04:06:57 +0000 Subject: [PATCH 04/11] bench: add 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 --- --- .../benchmark/benchmark.length.js | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/benchmark/benchmark.length.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/benchmark/benchmark.length.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/benchmark/benchmark.length.js new file mode 100644 index 000000000000..a0acf90e3c5c --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/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 format = require( '@stdlib/string/format' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pow = require( '@stdlib/math/base/special/pow' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var pkg = require( './../package.json' ).name; +var isEqualUint64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = new Uint64Array( zeroTo( len ) ); + var y = new Uint64Array( 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 = isEqualUint64Array( 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 efec2d2895151cc5e18187b217879050f3610333 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 04:11:21 +0000 Subject: [PATCH 05/11] docs: add types and 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: 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 --- --- .../docs/types/index.d.ts | 51 +++++++++++++++++++ .../is-equal-uint64array/docs/types/test.ts | 36 +++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/index.d.ts new file mode 100644 index 000000000000..75fe383d74b7 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/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 Uint64Arrays and have equal values. +* +* @param v1 - first input value +* @param v2 - second input value +* @returns boolean indicating whether two arguments are equal +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( [ 1, 2, 3 ] ); +* var y = new Uint64Array( [ 1, 2, 3 ] ); +* +* var out = isEqualUint64Array( x, y ); +* // returns true +* +* @example +* var Uint64Array = require( '@stdlib/array/uint64' ); +* +* var x = new Uint64Array( [ 1, 2, 3 ] ); +* var y = new Uint64Array( [ 1, 2, 4 ] ); +* +* var out = isEqualUint64Array( x, y ); +* // returns false +*/ +declare function isEqualUint64Array( v1: any, v2: any ): boolean; + + +// EXPORTS // + +export = isEqualUint64Array; diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/test.ts new file mode 100644 index 000000000000..e4d768c962c6 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/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 isEqualUint64Array = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isEqualUint64Array( 3.14, 3.14 ); // $ExpectType boolean + isEqualUint64Array( null, null ); // $ExpectType boolean + isEqualUint64Array( 'beep', 'boop' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isEqualUint64Array(); // $ExpectError + isEqualUint64Array( 3.14 ); // $ExpectError + isEqualUint64Array( 'beep', 'beep', 3.14 ); // $ExpectError +} From 852bdcee904a74f3540581a5b6ee7ae78852ea3d Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 04:15:16 +0000 Subject: [PATCH 06/11] docs: add repl txt --- 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 --- --- .../assert/is-equal-uint64array/docs/repl.txt | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/repl.txt diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/repl.txt new file mode 100644 index 000000000000..ff60b4d6b7e9 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/repl.txt @@ -0,0 +1,32 @@ + +{{alias}}( v1, v2 ) + Tests if two arguments are both Uint64Arrays 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/uint64}}( [ 1, 2, 3 ] ); + > var y = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 3 ] ); + > var bool = {{alias}}( x, y ) + true + + > x = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 3 ] ); + > y = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 4 ] ); + > bool = {{alias}}( x, y ) + false + + See Also + -------- + From ddfa01984069ef09e2296a54267764ba916377a7 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 04:28:42 +0000 Subject: [PATCH 07/11] docs: add 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 --- --- .../is-equal-uint64array/examples/index.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/examples/index.js diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/examples/index.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/examples/index.js new file mode 100644 index 000000000000..8be3d6ad00dc --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/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 isEqualUint64Array = require( './../lib' ); + +var x = new Uint64Array( [ 1, 2, 3 ] ); +var y = new Uint64Array( [ 1, 2, 3 ] ); +var out = isEqualUint64Array( x, y ); +console.log( out ); +// => true + +x = new Uint64Array( [ 1, 2, 3 ] ); +y = new Int64Array( [ 1, 2, 3 ] ); +out = isEqualUint64Array( x, y ); +console.log( out ); +// => false + +x = new Uint64Array( [ 1, 2, 3 ] ); +y = new Uint64Array( [ 1, 2, 4 ] ); +out = isEqualUint64Array( x, y ); +console.log( out ); +// => false From 1c34ce4036071ae55daa2a2d6471a04fe919740f Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 04:33:02 +0000 Subject: [PATCH 08/11] 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: 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 --- --- .../assert/is-equal-uint64array/README.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md b/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md new file mode 100644 index 000000000000..17950623eac2 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md @@ -0,0 +1,104 @@ + + +# isEqualUint64Array + +> Test if two arguments are both Uint64Arrays and have equal values. + +
+ +## Usage + +```javascript +var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); +``` + +#### isEqualUint64Array( v1, v2 ) + +Tests if two arguments are both Uint64Arrays and have equal values. + +```javascript +var Uint64Array = require( '@stdlib/array/uint64' ); + +var x = new Uint64Array( [ 1, 2 ] ); +var y = new Uint64Array( [ 1, 2 ] ); +var bool = isEqualUint64Array( x, y ); +// returns true + +bool = isEqualUint64Array( x, new Uint64Array( [ 1, 3 ] ) ); +// returns false +``` + +
+ + + +
+ +
+ + + +
+ +## Examples + + + +```javascript +var Int64Array = require( '@stdlib/array/int64' ); +var Uint64Array = require( '@stdlib/array/uint64' ); +var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); + +var x = new Uint64Array( [ 1, 2, 3 ] ); +var y = new Uint64Array( [ 1, 2, 3 ] ); +var out = isEqualUint64Array( x, y ); +// returns true + +x = new Uint64Array( [ 1, 2, 3 ] ); +y = new Int64Array( [ 1, 2, 3 ] ); +out = isEqualUint64Array( x, y ); +// returns false + +x = new Uint64Array( [ 1, 2, 3 ] ); +y = new Uint64Array( [ 1, 2, 4 ] ); +out = isEqualUint64Array( x, y ); +// returns false +``` + +
+ + + + + + + + + + + + + + From c60c58d9d83ddb2cdbabe0fe3bff508773e7b4a0 Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Tue, 29 Sep 2026 04:58:43 +0000 Subject: [PATCH 09/11] chore: cleanup --- 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: 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/assert/is-equal-uint64array/lib/index.js | 2 +- .../@stdlib/assert/is-equal-uint64array/lib/main.js | 2 +- .../@stdlib/assert/is-equal-uint64array/package.json | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js index 3dabe4706d8c..d8e425f16be7 100644 --- a/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Test if two arguments are both Uint64Arrays and have the equal values. +* Test if two arguments are both Uint64Arrays and have equal values. * * @module @stdlib/assert/is-equal-uint64array * diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js b/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js index 28cfb4164c8a..3d6eb6514b35 100644 --- a/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/lib/main.js @@ -27,7 +27,7 @@ var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); // MAIN // /** -* Tests if two arguments are both Uint64Arrays and have the equal values. +* Tests if two arguments are both Uint64Arrays and have equal values. * * @param {*} v1 - first value * @param {*} v2 - second value diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json b/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json index 514804e72c1c..aa55e99072a2 100644 --- a/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/assert/is-equal-uint64array", "version": "0.0.0", - "description": "Test if two arguments are both Uint64Arrays and have the equal values.", + "description": "Test if two arguments are both Uint64Arrays and have equal values.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -57,12 +57,10 @@ "utility", "utils", "util", - "same", "equal", + "same", "strict", "is", - "issame", - "isequalvalue", "isequal", "isstrictequal", "type", @@ -72,6 +70,7 @@ "test", "typed", "array", - "uint64" + "uint64", + "uint64array" ] } From 6560878af70e6e334315accd98e7c38ecfb3422b Mon Sep 17 00:00:00 2001 From: Divit Jain Date: Thu, 1 Oct 2026 10:41:02 +0000 Subject: [PATCH 10/11] chore: remove is-same-uint64array from PR scope Signed-off-by: Divit Jain --- 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: na - task: lint_license_headers status: passed --- --- .../assert/is-same-uint64array/lib/index.js | 54 ------------- .../assert/is-same-uint64array/lib/main.js | 61 --------------- .../assert/is-same-uint64array/package.json | 77 ------------------- 3 files changed, 192 deletions(-) delete mode 100644 lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js delete mode 100644 lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js delete mode 100644 lib/node_modules/@stdlib/assert/is-same-uint64array/package.json diff --git a/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js b/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js deleted file mode 100644 index e1a71fa34cb7..000000000000 --- a/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/index.js +++ /dev/null @@ -1,54 +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'; - -/** -* Test if two arguments are both Uint64Arrays and have the same values. -* -* @module @stdlib/assert/is-same-uint64array -* -* @example -* var Uint64Array = require( '@stdlib/array/uint64' ); -* var isSameUint64Array = require( '@stdlib/assert/is-same-uint64array' ); -* -* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); -* var y = new Uint64Array( [ 1, 2, 3, 4 ] ); -* -* var out = isSameUint64Array( x, y ); -* // returns true -* -* @example -* var Uint64Array = require( '@stdlib/array/uint64' ); -* var isSameUint64Array = require( '@stdlib/assert/is-same-uint64array' ); -* -* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); -* var y = new Uint64Array( [ 1, 2, 4, 4 ] ); -* -* var out = isSameUint64Array( x, y ); -* // returns false -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js b/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js deleted file mode 100644 index e8bc48174b0d..000000000000 --- a/lib/node_modules/@stdlib/assert/is-same-uint64array/lib/main.js +++ /dev/null @@ -1,61 +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 isUint64Array = require( '@stdlib/assert/is-uint64array' ); -var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); - - -// MAIN // - -/** -* Tests if two arguments are both Uint64Arrays and have the same values. -* -* @param {*} v1 - first value -* @param {*} v2 - second value -* @returns {boolean} boolean result -* -* @example -* var Uint64Array = require( '@stdlib/array/uint64' ); -* -* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); -* var y = new Uint64Array( [ 1, 2, 3, 4 ] ); -* -* var out = isSameUint64Array( x, y ); -* // returns true -* -* @example -* var Uint64Array = require( '@stdlib/array/uint64' ); -* -* var x = new Uint64Array( [ 1, 2, 3, 4 ] ); -* var y = new Uint64Array( [ 1, 2, 4, 4 ] ); -* -* var out = isSameUint64Array( x, y ); -* // returns false -*/ -function isSameUint64Array( v1, v2 ) { - return ( isUint64Array( v1 ) && isUint64Array( v2 ) && hasEqualValues( v1, v2 ) ); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = isSameUint64Array; diff --git a/lib/node_modules/@stdlib/assert/is-same-uint64array/package.json b/lib/node_modules/@stdlib/assert/is-same-uint64array/package.json deleted file mode 100644 index fcb84dfb6391..000000000000 --- a/lib/node_modules/@stdlib/assert/is-same-uint64array/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "@stdlib/assert/is-same-uint64array", - "version": "0.0.0", - "description": "Test if two arguments are both Uint64Arrays and have the same 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", - "issame", - "issamevalue", - "isequal", - "isstrictequal", - "type", - "check", - "valid", - "validate", - "test", - "typed", - "array", - "uint64" - ] -} From 83012d78466e6eb8292e312555e6cf6cdb1cf529 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 00:31:53 +0200 Subject: [PATCH 11/11] docs: add links Signed-off-by: Athan --- .../@stdlib/assert/is-equal-uint64array/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md b/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md index 17950623eac2..8e96ba470800 100644 --- a/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md +++ b/lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md @@ -20,7 +20,7 @@ limitations under the License. # isEqualUint64Array -> Test if two arguments are both Uint64Arrays and have equal values. +> Test if two arguments are both [Uint64Arrays][@stdlib/array/uint64] and have equal values.
@@ -32,7 +32,7 @@ var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); #### isEqualUint64Array( v1, v2 ) -Tests if two arguments are both Uint64Arrays and have equal values. +Tests if two arguments are both [Uint64Arrays][@stdlib/array/uint64] and have equal values. ```javascript var Uint64Array = require( '@stdlib/array/uint64' ); @@ -99,6 +99,8 @@ out = isEqualUint64Array( x, y );