diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/README.md b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/README.md new file mode 100644 index 000000000000..10cc3b7c42cc --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/README.md @@ -0,0 +1,118 @@ + + +# isEqual + +> Test whether two unsigned 64-bit integers are equal. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var isEqual = require( '@stdlib/number/uint64/base/assert/is-equal' ); +``` + +#### isEqual( a, b ) + +Tests whether two unsigned 64-bit integers are equal. + +```javascript +var Uint64 = require( '@stdlib/number/uint64/ctor' ); + +var a = new Uint64( 1234 ); +var b = Uint64.of( 0, 1234 ); + +var out = isEqual( a, b ); +// returns true +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var isEqual = require( '@stdlib/number/uint64/base/assert/is-equal' ); + +var a = new Uint64( 1234 ); +var b = Uint64.of( 0, 1234 ); +var out = isEqual( a, b ); +// returns true + +a = new Uint64( 1234 ); +b = new Uint64( 5678 ); +out = isEqual( a, b ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/benchmark/benchmark.js b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/benchmark/benchmark.js new file mode 100644 index 000000000000..c4c340339c6a --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/benchmark/benchmark.js @@ -0,0 +1,59 @@ +/** +* @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 MAX_SAFE_INTEGER = require( '@stdlib/constants/float64/max-safe-integer' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isEqual = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var y; + var i; + var v; + + x = discreteUniform( 100, 0, MAX_SAFE_INTEGER ); + y = []; + for ( i = 0; i < x.length; i++ ) { + y.push( new Uint64( x[i] ) ); + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = isEqual( y[ i % y.length ], y[ (i+1) % y.length ] ); + if ( typeof v !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( v ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/repl.txt b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/repl.txt new file mode 100644 index 000000000000..ff352be44ebd --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/repl.txt @@ -0,0 +1,27 @@ + +{{alias}}( a, b ) + Tests whether two unsigned 64-bit integers are equal. + + Parameters + ---------- + a: Uint64 + First unsigned 64-bit integer. + + b: Uint64 + Second unsigned 64-bit integer. + + Returns + ------- + out: boolean + Result. + + Examples + -------- + > var a = new {{alias:@stdlib/number/uint64/ctor}}( 1234 ); + > var b = {{alias:@stdlib/number/uint64/ctor}}.of( 0, 1234 ); + > var v = {{alias}}( a, b ) + true + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/types/index.d.ts b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/types/index.d.ts new file mode 100644 index 000000000000..671f2af22d67 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/types/index.d.ts @@ -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. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Uint64 } from '@stdlib/types/number'; + +/** +* Tests whether two unsigned 64-bit integers are equal. +* +* @param a - first unsigned 64-bit integer +* @param b - second unsigned 64-bit integer +* @returns boolean indicating if both unsigned 64-bit integers are equal +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* +* var a = new Uint64( 1234 ); +* var b = Uint64.of( 0, 1234 ); +* +* var v = isEqual( a, b ); +* // returns true +*/ +declare function isEqual( a: Uint64, b: Uint64 ): boolean; + + +// EXPORTS // + +export = isEqual; diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/types/test.ts b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/types/test.ts new file mode 100644 index 000000000000..bd9d36a872e9 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/docs/types/test.ts @@ -0,0 +1,67 @@ +/* +* @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 Uint64 = require( '@stdlib/number/uint64/ctor' ); +import isEqual = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + const a = new Uint64( 1234 ); + const b = Uint64.of( 0, 1234 ); + + isEqual( a, b ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided a first argument that is not an unsigned 64-bit integer... +{ + const b = new Uint64( 1234 ); + + isEqual( 'abc', b ); // $ExpectError + isEqual( 123, b ); // $ExpectError + isEqual( true, b ); // $ExpectError + isEqual( false, b ); // $ExpectError + isEqual( [], b ); // $ExpectError + isEqual( {}, b ); // $ExpectError + isEqual( ( x: number ): number => x, b ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument that is not an unsigned 64-bit integer... +{ + const a = new Uint64( 1234 ); + + isEqual( a, 'abc' ); // $ExpectError + isEqual( a, 123 ); // $ExpectError + isEqual( a, true ); // $ExpectError + isEqual( a, false ); // $ExpectError + isEqual( a, [] ); // $ExpectError + isEqual( a, {} ); // $ExpectError + isEqual( a, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const a = new Uint64( 1234 ); + const b = Uint64.of( 0, 1234 ); + + isEqual(); // $ExpectError + isEqual( a ); // $ExpectError + isEqual( a, b, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/examples/index.js b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/examples/index.js new file mode 100644 index 000000000000..abe8532007f9 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/examples/index.js @@ -0,0 +1,32 @@ +/** +* @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 Uint64 = require( '@stdlib/number/uint64/ctor' ); +var isEqual = require( './../lib' ); + +var a = new Uint64( 1234 ); +var b = Uint64.of( 0, 1234 ); +var out = isEqual( a, b ); +// returns true + +a = new Uint64( 1234 ); +b = new Uint64( 5678 ); +out = isEqual( a, b ); // eslint-disable-line no-unused-vars +// returns false diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/lib/index.js b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/lib/index.js new file mode 100644 index 000000000000..40e295691f99 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/lib/index.js @@ -0,0 +1,44 @@ +/** +* @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 whether two unsigned 64-bit integers are equal. +* +* @module @stdlib/number/uint64/base/assert/is-equal +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* var isEqual = require( '@stdlib/number/uint64/base/assert/is-equal' ); +* +* var a = new Uint64( 1234 ); +* var b = Uint64.of( 0, 1234 ); +* +* var v = isEqual( a, b ); +* // returns true +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/lib/main.js b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/lib/main.js new file mode 100644 index 000000000000..140a6d7362dc --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/lib/main.js @@ -0,0 +1,49 @@ +/** +* @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 // + + +// MAIN // + +/** +* Tests whether two unsigned 64-bit integers are equal. +* +* @param {Uint64} a - first unsigned 64-bit integer +* @param {Uint64} b - second unsigned 64-bit integer +* @returns {boolean} result +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* +* var a = new Uint64( 1234 ); +* var b = Uint64.of( 0, 1234 ); +* +* var v = isEqual( a, b ); +* // returns true +*/ +function isEqual( a, b ) { + return ( a.hi === b.hi && a.lo === b.lo ); +} + + +// EXPORTS // + +module.exports = isEqual; diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/package.json b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/package.json new file mode 100644 index 000000000000..61a8c8493c63 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/number/uint64/base/assert/is-equal", + "version": "0.0.0", + "description": "Test whether two unsigned 64-bit integers are equal.", + "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", + "stdmath", + "mathematics", + "math", + "uint64", + "unsigned", + "64-bit", + "integer", + "base", + "assert", + "test", + "validate", + "equality", + "compare", + "comparison", + "equal", + "eq" + ] +} diff --git a/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/test/test.js b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/test/test.js new file mode 100644 index 000000000000..b1682c9281fc --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/assert/is-equal/test/test.js @@ -0,0 +1,73 @@ +/** +* @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 hasBigIntSupport = require( '@stdlib/assert/has-bigint-support' ); +var BigInt = require( '@stdlib/bigint/ctor' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var isEqual = require( './../lib' ); + + +// VARIABLES // + +var HAS_BIGINT = hasBigIntSupport(); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isEqual, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function tests whether two unsigned 64-bit integers are equal', function test( t ) { + var a; + var b; + + a = new Uint64( 1234 ); + t.strictEqual( isEqual( a, a ), true, 'returns expected value' ); + + a = new Uint64( 1234 ); + b = Uint64.of( 0, 1234 ); + t.strictEqual( isEqual( a, b ), true, 'returns expected value' ); + + a = Uint64.from( [ 0, 1234 ] ); + b = Uint64.of( 0, 1234 ); + t.strictEqual( isEqual( a, b ), true, 'returns expected value' ); + + a = new Uint64( 1234 ); + a = new Uint64( 5678 ); + t.strictEqual( isEqual( a, b ), false, 'returns expected value' ); + + if ( HAS_BIGINT ) { + a = new Uint64( 1234 ); + b = new Uint64( BigInt( 1234 ) ); + t.strictEqual( isEqual( a, b ), true, 'returns expected value' ); + + a = new Uint64( 1234 ); + b = new Uint64( BigInt( 5678 ) ); + t.strictEqual( isEqual( a, b ), false, 'returns expected value' ); + } + + t.end(); +});