diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/README.md b/lib/node_modules/@stdlib/number/uint64/ctor/README.md
new file mode 100644
index 000000000000..c671f2193dcb
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/README.md
@@ -0,0 +1,216 @@
+
+
+# Uint64
+
+> Unsigned 64-bit integer.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var Uint64 = require( '@stdlib/number/uint64/ctor' );
+```
+
+#### Uint64( value )
+
+Unsigned 64-bit integer constructor.
+
+```javascript
+var x = new Uint64( 5 );
+// returns
+```
+
+* * *
+
+## Properties
+
+#### Uint64.name
+
+Static property returning the constructor name.
+
+```javascript
+var str = Uint64.name;
+// returns 'Uint64'
+```
+
+#### Uint64.BYTES_PER_ELEMENT
+
+Size (in bytes) of the underlying value.
+
+```javascript
+var nbytes = Uint64.BYTES_PER_ELEMENT;
+// returns 8
+```
+
+#### Uint64.prototype.BYTES_PER_ELEMENT
+
+Size (in bytes) of the underlying value.
+
+```javascript
+var x = new Uint64( 5 );
+
+var nbytes = x.BYTES_PER_ELEMENT;
+// returns 8
+```
+
+### Instance
+
+A `Uint64` instance has the following methods...
+
+## Methods
+
+### Accessor Methods
+
+These methods do **not** mutate a `Uint64` instance and, instead return an unsigned 64-bit integer representation.
+
+#### Uint64.prototype.toString()
+
+Returns a string representation of a `Uint64` instance.
+
+```javascript
+var x = new Uint64( 5 );
+var str = x.toString();
+// returns '5'
+```
+
+#### Uint64.prototype.toJSON()
+
+Returns a [JSON][json] representation of a `Uint64` instance. [`JSON.stringify()`][mdn-json-stringify] implicitly calls this method when stringifying a `Uint64` instance.
+
+```javascript
+var x = new Uint64( 5 );
+
+var o = x.toJSON();
+/*
+ {
+ "type": "Uint64",
+ "value": '5'
+ }
+*/
+```
+
+To [revive][mdn-json-parse] a `Uint64` number from a [JSON][json] `string`, see [@stdlib/number/uint64/reviver][@stdlib/number/uint64/reviver].
+
+#### Uint64.prototype.valueOf()
+
+Converts a `Uint64` instance to a primitive value.
+
+```javascript
+var x = new Uint64( 5 );
+var v = x.valueOf();
+// returns 5.0
+```
+
+
+
+
+
+* * *
+
+
+
+
+
+## Notes
+
+- The underlying value is stored as an unsigned 64-bit integer.
+- An unsigned 64-bit integer has a range of \[`0`, `2^64-1`\].
+
+
+
+
+
+* * *
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Uint64 = require( '@stdlib/number/uint64/ctor' );
+
+var x = new Uint64( 1234 );
+
+console.log( 'type: %s', typeof x );
+// => 'type: object'
+
+console.log( 'str: %s', x );
+// => 'str: 1234'
+
+console.log( 'JSON: %s', JSON.stringify( x ) );
+// => 'JSON: {"type":"Uint64","value":"1234"}'
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[json]: http://www.json.org/
+
+[mdn-json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
+
+[mdn-json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
+
+[@stdlib/number/uint64/reviver]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/number/uint64/reviver
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/benchmark/benchmark.js b/lib/node_modules/@stdlib/number/uint64/ctor/benchmark/benchmark.js
new file mode 100644
index 000000000000..6bd879e1b100
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/benchmark/benchmark.js
@@ -0,0 +1,120 @@
+/**
+* @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 randi = require( '@stdlib/random/base/randi' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var Uint64 = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var z;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ z = new Uint64( i );
+ if ( isnan( z ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( !( z instanceof Uint64 ) ) {
+ b.fail( 'should return a Uint64 instance' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+// TODO: because `value` should be private?
+
+/*
+bench( format( '%s::get:value', pkg ), function benchmark( b ) {
+ var v;
+ var z;
+ var i;
+
+ z = new Uint64( randu() );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = z.value;
+ if ( isnan( v ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnan( v ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+*/
+
+bench( format( '%s:toString', pkg ), function benchmark( b ) {
+ var o;
+ var z;
+ var i;
+
+ z = new Uint64( randi() );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = z.toString();
+ if ( typeof o !== 'string' ) {
+ b.fail( 'should return a string' );
+ }
+ }
+ b.toc();
+ if ( typeof o !== 'string' ) {
+ b.fail( 'should return a string' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s:toJSON', pkg ), function benchmark( b ) {
+ var o;
+ var z;
+ var i;
+
+ z = new Uint64( randi() );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = z.toJSON();
+ if ( typeof o !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( typeof o !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/docs/repl.txt b/lib/node_modules/@stdlib/number/uint64/ctor/docs/repl.txt
new file mode 100644
index 000000000000..e994f8b39a08
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/docs/repl.txt
@@ -0,0 +1,63 @@
+
+{{alias}}( value )
+ Unsigned 64-bit integer constructor.
+
+ Parameters
+ ----------
+ value: number | string | Array | Uint32Array | BigInt
+ Numeric or BigInt or composite value.
+
+ Returns
+ -------
+ v: Uint64
+ Unsigned 64-bit integer.
+
+ Examples
+ --------
+ > var x = new {{alias}}( 5 )
+
+ > x.toString()
+ '5'
+
+
+{{alias}}.name
+ Constructor name.
+
+ Examples
+ --------
+ > var str = {{alias}}.name
+ 'Uint64'
+
+
+{{alias}}.BYTES_PER_ELEMENT
+ Size (in bytes) of the underlying value.
+
+ Returns
+ -------
+ s: integer
+ Size (in bytes) of the underlying value.
+
+ Examples
+ --------
+ > var s = {{alias}}.BYTES_PER_ELEMENT
+ 8
+
+
+{{alias}}.prototype.BYTES_PER_ELEMENT
+ Size (in bytes) of the underlying value.
+
+ Returns
+ -------
+ s: integer
+ Size (in bytes) of the underlying value.
+
+ Examples
+ --------
+ > var x = new {{alias}}( 5 )
+
+ > var s = x.BYTES_PER_ELEMENT
+ 8
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/docs/types/index.d.ts b/lib/node_modules/@stdlib/number/uint64/ctor/docs/types/index.d.ts
new file mode 100644
index 000000000000..d88e404c90ed
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/docs/types/index.d.ts
@@ -0,0 +1,105 @@
+/*
+* @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
+
+/**
+* Unsigned 64-bit integer.
+*/
+declare class Uint64 {
+ /**
+ * Unsigned 64-bit integer constructor.
+ *
+ * @param value - numeric value
+ * @returns unsigned 64-bit integer
+ *
+ * @example
+ * var x = new Uint64( 5 );
+ * // returns
+ */
+ constructor( value: number | string | Array | Uint32Array | BigInt );
+ // TODO: do we need to import Uint32Array and BigInt here as well?
+
+ /**
+ * Read-only property returning the value.
+ *
+ * @returns value
+ */
+ // readonly value: number;
+ // TODO: because private
+
+ /**
+ * Size (in bytes) of the underlying value.
+ *
+ * @returns size of the underlying value.
+ *
+ * @example
+ * var nbytes = Uint64.BYTES_PER_ELEMENT;
+ * // returns 8
+ */
+ readonly BYTES_PER_ELEMENT: 8;
+
+ /**
+ * Serializes an unsigned 64-bit integer as a string.
+ *
+ * @returns serialized unsigned 64-bit integer
+ *
+ * @example
+ * var x = new Uint64( 5 );
+ *
+ * var str = x.toString();
+ * // returns '5'
+ */
+ toString(): string;
+
+ /**
+ * Serializes an unsigned 64-bit integer as a JSON object.
+ *
+ * ## Notes
+ *
+ * - `JSON.stringify()` implicitly calls this method when stringifying a `Uint64` instance.
+ *
+ *
+ * @returns serialized unsigned 64-bit integer
+ *
+ * @example
+ * var x = new Uint64( 5 );
+ *
+ * var obj = x.toJSON();
+ * // returns { 'type': 'Uint64', 'value': '5' }
+ */
+ toJSON(): any;
+
+ /**
+ * Converts an unsigned 64-bit integer to a primitive value.
+ *
+ * @returns primitive value
+ *
+ * @example
+ * var x = new Uint64( 5 );
+ *
+ * var v = x.valueOf();
+ * // returns 5.0
+ */
+ valueOf(): number;
+}
+
+
+// EXPORTS //
+
+export = Uint64;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/docs/types/test.ts b/lib/node_modules/@stdlib/number/uint64/ctor/docs/types/test.ts
new file mode 100644
index 000000000000..5185ec865317
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/docs/types/test.ts
@@ -0,0 +1,65 @@
+/*
+* @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.
+*/
+
+/* eslint-disable @typescript-eslint/no-unused-expressions */
+
+import Uint64 = require( './index' );
+
+
+// TESTS //
+
+// The function returns a Unsigned 64-bit integer with the expected properties...
+{
+ const x = new Uint64( 5 ); // $ExpectType Uint64
+
+ // x.value; // $ExpectType number
+ // TODO: delete later cz private
+ x.BYTES_PER_ELEMENT; // $ExpectType 8
+}
+
+// Unsigned 64-bit integer comes with a `toString` method to serialize a number as a string...
+{
+ const x = new Uint64( 5 ); // $ExpectType Uint64
+
+ x.toString(); // $ExpectType string
+}
+
+// Unsigned 64-bit integer comes with a `toJSON` method to serialize a number as a JSON object....
+{
+ const x = new Uint64( 5 ); // $ExpectType Uint64
+
+ x.toJSON(); // $ExpectType any
+}
+
+// Unsigned 64-bit integer comes with a `valueOf` method to serialize a number to a primitive value...
+{
+ const x = new Uint64( 5 ); // $ExpectType Uint64
+
+ x.valueOf(); // $ExpectType number
+}
+
+// The compiler throws an error if the constructor is invoked without the `new` keyword...
+{
+ Uint64( 5 ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided an unsupported number of arguments...
+{
+ new Uint64( ); // $ExpectError
+ new Uint64( 5, 3 ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/examples/index.js b/lib/node_modules/@stdlib/number/uint64/ctor/examples/index.js
new file mode 100644
index 000000000000..f2c9595e4695
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/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( './../lib' );
+
+var x = new Uint64( 5 );
+
+console.log( 'type: %s', typeof x );
+// => 'type: object'
+
+console.log( 'str: %s', x );
+// => 'str: 5'
+
+console.log( 'JSON: %s', JSON.stringify( x ) );
+// => 'JSON: {"type":"Uint64","value":"5"}'
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/lib/asbiguint64.js b/lib/node_modules/@stdlib/number/uint64/ctor/lib/asbiguint64.js
new file mode 100644
index 000000000000..5fcce08cda6d
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/lib/asbiguint64.js
@@ -0,0 +1,46 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var BigInt = require( '@stdlib/bigint/ctor' );
+
+
+// MAIN //
+
+/**
+* Truncates a BigInt value to 64 least significant bits as an unsigned integer.
+*
+* @private
+* @param {BigInt} value - BigInt value to truncate
+* @returns {BigInt} Unsigned 64-bit BigInt
+*
+* @example
+* var x = asBigUint64( 0x0123456789abcdef0000n ).toString(16);
+* // returns '456789abcdef0000'
+*/
+function asBigUint64( value ) {
+ return BigInt.asUintN( 64, value );
+}
+
+
+// EXPORTS //
+
+module.exports = asBigUint64;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/lib/index.js b/lib/node_modules/@stdlib/number/uint64/ctor/lib/index.js
new file mode 100644
index 000000000000..34c9e26b59a8
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/lib/index.js
@@ -0,0 +1,40 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Unsigned 64-bit integer constructor.
+*
+* @module @stdlib/number/uint64/ctor
+*
+* @example
+* var Uint64 = require( '@stdlib/number/uint64/ctor' );
+*
+* var x = new Uint64( 5 );
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/lib/main.js b/lib/node_modules/@stdlib/number/uint64/ctor/lib/main.js
new file mode 100644
index 000000000000..8af8c5fe306a
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/lib/main.js
@@ -0,0 +1,347 @@
+/* eslint-disable max-len */
+/**
+* @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 BigInt = require( '@stdlib/bigint/ctor' );
+var Number = require( '@stdlib/number/ctor' );
+var ToPrimitiveSymbol = require( '@stdlib/symbol/to-primitive' );
+var Uint32Array = require( '@stdlib/array/uint32' );
+var format = require( '@stdlib/string/format' );
+var hasBigIntSupport = require( '@stdlib/assert/has-bigint-support' );
+var hasToPrimitiveSymbolSupport = require( '@stdlib/assert/has-to-primitive-symbol-support' ); // eslint-disable-line id-length
+var isArray = require( '@stdlib/assert/is-array' );
+var isBigInt = require( '@stdlib/assert/is-bigint' );
+var isNan = require( '@stdlib/assert/is-nan' );
+var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
+var isString = require( '@stdlib/assert/is-string' );
+var isUint32Array = require( '@stdlib/assert/is-uint32array' );
+var max = require( '@stdlib/math/base/special/max' );
+var setEnumerableReadOnly = require( '@stdlib/utils/define-read-only-property' );
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var trim = require( '@stdlib/string/trim' );
+var asBigUint64 = require( './asbiguint64.js' );
+var toStr = require( './tostring.js' );
+var toJSON = require( './tojson.js' );
+var valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare
+
+// TODO: should we add asm type annotations aggressively?
+var MAX_UINT32 = 0xffffffff;
+var TWO_32 = 0x100000000;
+
+
+// MAIN //
+
+/**
+* Unsigned 64-bit integer constructor.
+*
+* @constructor
+* @param {number|string|Array|Uint32Array|BigInt} value - numeric value or high low words or BigInt
+* TODO: Which ones should we keep and discard? Should we support any arraylike argument?
+* @param {boolean} useHighLow - use double word Uint32Array representation
+* @throws {TypeError} must invoke using the `new` keyword
+* @throws {TypeError} value must be a number or bla bla bla // TODO: update after review
+* @returns {Uint64} Unsigned 64-bit integer
+*
+* @example // TODO: add more example
+* var x = new Uint64( 5 );
+* // returns
+*/
+function Uint64( value, useHighLow ) {
+ // TODO: should we optimize number of vars?
+ var high;
+ var low;
+ var tmp;
+ var ih;
+ var il;
+ var i;
+
+ useHighLow |= !hasBigIntSupport();
+
+ if ( !( this instanceof Uint64 ) ) {
+ throw new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );
+ }
+
+ // TODO: current implementation uses either BigInt or Uint32Array for the internal representation
+ // Are there other better alternative instead of Uint32Array? How is plain old number array?
+ // Or an object with high and low props?
+
+ // TODO: make the `value` property private
+
+ if ( isBigInt( value ) ) {
+ value = asBigUint64( value );
+ if ( useHighLow ) {
+ high = Number( value >> BigInt( 32 ) );
+ low = Number( value & BigInt( MAX_UINT32 ) );
+ value = new Uint32Array( [ high, low ] );
+
+ // TODO: should we use value[0] = high, value[1] = low instead to avoid the intermediate array allocation?
+ }
+ }
+ else if ( isUint32Array( value ) ) {
+ if ( value.length === 2 ) {
+ if ( !useHighLow ) {
+ value = ( BigInt( value[ 0 ] ) << BigInt( 32 ) ) | BigInt( value[ 1 ] );
+ }
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Provided Uint32Array must have a length of 2. Value: `%s`.', value ) );
+ }
+ }
+ else if ( isArray( value ) ) {
+ if ( value.length === 2 ) {
+ if ( typeof value[ 0 ] === 'number' && typeof value[ 1 ] === 'number' ) {
+ if ( value[ 0 ] >= 0 && value[ 0 ] <= MAX_UINT32 && value[ 1 ] >= 0 && value[ 1 ] <= MAX_UINT32 ) {
+ value[ 0 ] >>>= 0;
+ value[ 1 ] >>>= 0;
+ if ( useHighLow ) {
+ value = new Uint32Array( value );
+ }
+ else {
+ value = ( BigInt( value[ 0 ] ) << BigInt( 32 ) ) | BigInt( value[ 1 ] );
+ }
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Provided numbers must be between 0 and %s. Value: `%s`.', MAX_UINT32, value ) );
+ }
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Provided array must contain only elements of type number. Value: `%s`.', value ) );
+ }
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Provided array must have a length of 2. Value: `%s`.', value ) );
+ }
+ }
+ else if ( isString( value ) ) {
+ // TODO: verify same parsing behavior as BigInt
+ if ( useHighLow ) {
+ value = trim( value );
+ if ( value.match( /^0x/i ) ) {
+ il = max( 2, value.length - 8 );
+ ih = max( 2, value.length - 16 );
+ high = Number( '0x' + value.slice( ih, il ) );
+ low = Number( '0x' + value.slice( il ) );
+ }
+ else if ( value.match( /^0o/i ) ) {
+ il = max( 2, value.length - 16 );
+ ih = max( 2, value.length - 32 );
+ high = Number( '0o' + value.slice( ih, il ) );
+ low = Number( '0o' + value.slice( il ) );
+ }
+ else if ( value.match( /^0b/i ) ) {
+ il = max( 2, value.length - 32 );
+ ih = max( 2, value.length - 64 );
+ high = Number( '0b' + value.slice( ih, il ) );
+ low = Number( '0b' + value.slice( il ) );
+ }
+ else if ( value.match( /[^0-9]/ ) ) {
+ high = low = NaN;
+ }
+ else {
+ i = ( value.length % 6 ) || 6; // processes the first chunk such as the remaining chunks are all evenly sized (6digit)
+ if ( i + 6 <= 9 ) { // takes big chunk when possible
+ i += 6;
+ }
+ high = 0;
+ low = Number( value.slice( 0, i ) );
+ for ( ; i < value.length; i += 6 ) {
+ tmp = Number( value.slice( i, i + 6 ) );
+ low = ( low * 1e6 ) + tmp;
+ tmp = ( low / TWO_32 ) >>> 0;
+ low -= tmp * TWO_32;
+ high = ( high * 1e6 ) + tmp;
+ tmp = ( high / TWO_32 ) >>> 0;
+ high -= tmp * TWO_32;
+ }
+ }
+
+ if ( !isNaN( high ) && !isNan( low ) ) {
+ value = new Uint32Array( [ high, low ] );
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Could not convert string to Uint64. Value: `%s`.', value ) );
+ }
+ }
+ else {
+ try {
+ value = asBigUint64( BigInt( value ) );
+ }
+ // eslint-disable-next-line no-unused-vars
+ catch ( error ) {
+ throw new TypeError( format( 'invalid argument. Could not convert string to Uint64. Value: `%s`.', value ) );
+ }
+ }
+ }
+ else if ( isNumber( value ) ) {
+ if ( value >= 0 && Number.isSafeInteger( value ) ) {
+ if ( useHighLow ) {
+ high = ( value / TWO_32 ) >>> 0;
+ low = value >>> 0;
+ value = new Uint32Array( [ high, low ] );
+ }
+ else {
+ value = asBigUint64( BigInt( value ) );
+ }
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Provided number must be between 0 and %s. Value: `%s`.', Number.MAX_SAFE_INTEGER, value ) );
+ }
+ }
+ else {
+ throw new TypeError( format( 'invalid argument. Must provide a number or string or Array or Uint32Array or BigInt. Value: `%s`.', value ) );
+ }
+
+ setEnumerableReadOnly( this, 'value', value );
+ return this;
+}
+
+/**
+* Constructor name.
+*
+* @name name
+* @memberof Uint64
+* @readonly
+* @type {string}
+* @default 'Uint64'
+*
+* @example
+* var name = Uint64.name;
+* // returns 'Uint64'
+*/
+setReadOnly( Uint64, 'name', 'Uint64' );
+
+/**
+* Size (in bytes) of the underlying value.
+*
+* @name BYTES_PER_ELEMENT
+* @memberof Uint64
+* @type {integer}
+* @returns {integer} size in bytes
+*
+* @example
+* var nbytes = Uint64.BYTES_PER_ELEMENT;
+* // returns 8
+*/
+setReadOnly( Uint64, 'BYTES_PER_ELEMENT', 8 );
+
+/**
+* Size (in bytes) of the underlying value.
+*
+* @name BYTES_PER_ELEMENT
+* @memberof Uint64.prototype
+* @type {integer}
+* @returns {integer} size in bytes
+*
+* @example
+* var x = new Uint64( 5 );
+*
+* var nbytes = x.BYTES_PER_ELEMENT;
+* // returns 8
+*/
+setReadOnly( Uint64.prototype, 'BYTES_PER_ELEMENT', 8 );
+
+/**
+* Serializes an unsigned 64-bit integer number as a string.
+*
+* @name toString
+* @memberof Uint64.prototype
+* @type {Function}
+* @returns {string} serialized unsigned 64-bit integer number
+*
+* @example
+* var str = new Uint64( 5 ).toString();
+* // returns '5'
+*
+* str = new Uint64( [ 1, 0 ] ).toString();
+* // returns '4294967296'
+*
+* str = new Uint64( 100000000001 ).toString();
+* // returns '100000000001'
+*
+*/
+setReadOnly( Uint64.prototype, 'toString', toStr );
+
+/**
+* Serializes an unsigned 64-bit integer number as a JSON object.
+*
+* ## Notes
+*
+* - `JSON.stringify()` implicitly calls this method when stringifying a `Uint64` instance.
+*
+* @name toJSON
+* @memberof Uint64.prototype
+* @type {Function}
+* @returns {Object} serialized unsigned 64-bit integer number
+*
+* @example
+* var x = new Uint64( 5 );
+*
+* var obj = x.toJSON();
+* // returns { 'type': 'Uint64', 'value': '5' }
+*/
+setReadOnly( Uint64.prototype, 'toJSON', toJSON );
+
+/**
+* Converts an unsigned 64-bit integer number to a primitive value.
+*
+* @name valueOf
+* @memberof Uint64.prototype
+* @type {Function}
+* @returns {number} primitive value
+*
+* @example
+* var x = new Uint64( 5 );
+*
+* var v = x.valueOf();
+* // returns 5.0
+*/
+setReadOnly( Uint64.prototype, 'valueOf', valueOf );
+
+/**
+* Returns the primitive value of an unsigned 64-bit integer number.
+*
+* @name toPrimitive
+* @memberof Uint64.prototype
+* @type {Function}
+* @param {string} hint - conversion hint
+* @returns {number} primitive value
+*
+* @example
+* var hasSymbol = require( '@stdlib/assert/has-to-primitive-symbol-support' );
+* var ToPrimitiveSymbol = require( '@stdlib/symbol/to-primitive' );
+*
+* var x = new Uint64( 5 );
+*
+* var v;
+* if ( hasSymbol() ) {
+* v = x[ ToPrimitiveSymbol ]( 'number' );
+* // returns 5.0
+* }
+*/
+if ( hasToPrimitiveSymbolSupport() ) {
+ setReadOnly( Uint64.prototype, ToPrimitiveSymbol, valueOf );
+}
+
+
+// EXPORTS //
+
+module.exports = Uint64;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/lib/tojson.js b/lib/node_modules/@stdlib/number/uint64/ctor/lib/tojson.js
new file mode 100644
index 000000000000..fd8df087dcbd
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/lib/tojson.js
@@ -0,0 +1,44 @@
+/* eslint-disable no-invalid-this */
+/**
+* @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';
+
+/**
+* Serializes an unsigned 64-bit integer as a JSON object.
+*
+* @private
+* @returns {Object} JSON representation
+*/
+function toJSON() {
+ var out = {};
+ out.type = 'Uint64';
+ if ( typeof this.value === 'bigint' ) {
+ out.value = this.value.toString();
+ }
+ else {
+ out.value = [ this.value[ 0 ], this.value[ 1 ] ];
+ }
+ // TODO: is it bad to have 2 different kind of json representation?
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = toJSON;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/lib/tostring.js b/lib/node_modules/@stdlib/number/uint64/ctor/lib/tostring.js
new file mode 100644
index 000000000000..0b55aeb6cc11
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/lib/tostring.js
@@ -0,0 +1,257 @@
+/**
+* @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.
+*/
+
+/* eslint-disable vars-on-top */
+/* eslint-disable stdlib/vars-order */
+/* eslint-disable no-invalid-this */
+
+'use strict';
+
+// MODULES //
+
+var lpad = require( '@stdlib/string/left-pad' );
+
+// Helper constants for toString base conversion
+var TWO_16 = 0x10000;
+var TWO_32 = 0x100000000;
+
+var POWERMAP = {
+ '2': {
+ 'power': 32,
+ 'divisor': 4294967296
+ },
+ '3': {
+ 'power': 20,
+ 'divisor': 3486784401
+ },
+ '4': {
+ 'power': 16,
+ 'divisor': 4294967296
+ },
+ '5': {
+ 'power': 13,
+ 'divisor': 1220703125
+ },
+ '6': {
+ 'power': 12,
+ 'divisor': 2176782336
+ },
+ '7': {
+ 'power': 11,
+ 'divisor': 1977326743
+ },
+ '8': {
+ 'power': 10,
+ 'divisor': 1073741824
+ },
+ '9': {
+ 'power': 10,
+ 'divisor': 3486784401
+ },
+ '10': {
+ 'power': 9,
+ 'divisor': 1000000000
+ },
+ '11': {
+ 'power': 9,
+ 'divisor': 2357947691
+ },
+ '12': {
+ 'power': 8,
+ 'divisor': 429981696
+ },
+ '13': {
+ 'power': 8,
+ 'divisor': 815730721
+ },
+ '14': {
+ 'power': 8,
+ 'divisor': 1475789056
+ },
+ '15': {
+ 'power': 8,
+ 'divisor': 2562890625
+ },
+ '16': {
+ 'power': 8,
+ 'divisor': 4294967296
+ },
+ '17': {
+ 'power': 7,
+ 'divisor': 410338673
+ },
+ '18': {
+ 'power': 7,
+ 'divisor': 612220032
+ },
+ '19': {
+ 'power': 7,
+ 'divisor': 893871739
+ },
+ '20': {
+ 'power': 7,
+ 'divisor': 1280000000
+ },
+ '21': {
+ 'power': 7,
+ 'divisor': 1801088541
+ },
+ '22': {
+ 'power': 7,
+ 'divisor': 2494357888
+ },
+ '23': {
+ 'power': 7,
+ 'divisor': 3404825447
+ },
+ '24': {
+ 'power': 6,
+ 'divisor': 191102976
+ },
+ '25': {
+ 'power': 6,
+ 'divisor': 244140625
+ },
+ '26': {
+ 'power': 6,
+ 'divisor': 308915776
+ },
+ '27': {
+ 'power': 6,
+ 'divisor': 387420489
+ },
+ '28': {
+ 'power': 6,
+ 'divisor': 481890304
+ },
+ '29': {
+ 'power': 6,
+ 'divisor': 594823321
+ },
+ '30': {
+ 'power': 6,
+ 'divisor': 729000000
+ },
+ '31': {
+ 'power': 6,
+ 'divisor': 887503681
+ },
+ '32': {
+ 'power': 6,
+ 'divisor': 1073741824
+ },
+ '33': {
+ 'power': 6,
+ 'divisor': 1291467969
+ },
+ '34': {
+ 'power': 6,
+ 'divisor': 1544804416
+ },
+ '35': {
+ 'power': 6,
+ 'divisor': 1838265625
+ },
+ '36': {
+ 'power': 6,
+ 'divisor': 2176782336
+ }
+};
+
+
+// MAIN //
+
+/**
+* Serializes an unsigned 64-bit integer as a string in the specified base.
+*
+* @private
+* @param {number} radix - The radix (base) to use for string conversion
+* @returns {string} The serialized unsigned 64-bit integer as a string.
+*
+* **Note**
+* This implementation handles 64-bit unsigned integers represented as either a BigInt or a pair of 32-bit words ([high, low]).
+* For non-BigInt values, the conversion uses a precomputed POWERMAP to select a divisor and chunk size for efficient base conversion.
+* The divisor values are chosen to be close to powers of 2^32 for each supported base, which is an unusual but efficient approach for chunked conversion.
+* The function pads the lower chunk with leading zeros to ensure correct digit alignment.
+*/
+function toString( radix ) { // eslint-disable-line stdlib/no-redeclare
+ // eslint-disable-next-line no-undefined
+ if ( radix === undefined ) {
+ radix = 10;
+ }
+ // TODO: validate base range (between 2 and 36)
+ if ( typeof this.value === 'bigint' ) {
+ return this.value.toString( radix );
+ }
+
+ var qr = chunkedDivMod( this.value, POWERMAP[ radix ].divisor );
+ var sq = qr[ 0 ].toString( radix );
+ var sr = qr[ 1 ].toString( radix );
+ if ( sq === '0' ) {
+ sq = '';
+ }
+ else {
+ sr = lpad( sr, POWERMAP[ radix ].power, '0' );
+ }
+
+ return sq + sr;
+}
+
+/**
+* Performs division and modulo for an unsigned 64-bit integer represented as high-low words.
+*
+* @private
+* @param {Uint32Array|Array} words - [high, low] 32-bit words
+* @param {number} divisor - positive integer close to `2^32` (actually works for 2^11 to 2^37)
+* @returns {Array} [ quotient, remainder ]
+*
+* @example
+* var x = chunkedDivMod( [ 1, 0 ], 1e9 );
+* // returns [ 4, 294967296 ]
+*/
+function chunkedDivMod( words, divisor ) {
+ var hi = words[0] >>> 0;
+ var lo = words[1] >>> 0;
+
+ var quo = ( hi / divisor ) >>> 0;
+ var rem = hi - ( divisor * quo );
+ var qrd;
+
+ if (divisor === TWO_32) {
+ return [ hi, lo ];
+ }
+
+ rem = ( rem * TWO_16 ) + ( lo >>> 16 );
+ qrd = ( rem / divisor ) >>> 0;
+
+ quo = ( quo * TWO_16 ) + qrd;
+ rem -= divisor * qrd;
+
+ rem = ( rem * TWO_16 ) + ( lo & 0xffff );
+ qrd = ( rem / divisor ) >>> 0;
+
+ quo = ( quo * TWO_16 ) + qrd;
+ rem -= divisor * qrd;
+
+ return [quo, rem];
+}
+
+
+// EXPORTS //
+
+module.exports = toString;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/lib/valueof.js b/lib/node_modules/@stdlib/number/uint64/ctor/lib/valueof.js
new file mode 100644
index 000000000000..87f538b63f2f
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/lib/valueof.js
@@ -0,0 +1,47 @@
+/* eslint-disable no-invalid-this */
+/**
+* @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 Number = require( '@stdlib/number/ctor' );
+
+
+// MAIN //
+
+/**
+* Converts an unsigned 64-bit integer to a primitive value.
+*
+* @private
+* @returns {number} primitive value
+*/
+function valueOf() { // eslint-disable-line stdlib/no-redeclare
+ if ( typeof this.value === 'bigint' ) {
+ return Number( this.value );
+ }
+
+ // TODO: implement conversion to number
+ return -1;
+}
+
+
+// EXPORTS //
+
+module.exports = valueOf;
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/package.json b/lib/node_modules/@stdlib/number/uint64/ctor/package.json
new file mode 100644
index 000000000000..b7753d345528
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/package.json
@@ -0,0 +1,65 @@
+{
+ "name": "@stdlib/number/uint64/ctor",
+ "version": "0.0.0",
+ "description": "Unsigned 64-bit integer.",
+ "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",
+ "stdtypes",
+ "types",
+ "data",
+ "structure",
+ "constructor",
+ "ctor",
+ "uint64",
+ "unsigned",
+ "64-bit",
+ "integer",
+ "int"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/number/uint64/ctor/test/test.js b/lib/node_modules/@stdlib/number/uint64/ctor/test/test.js
new file mode 100644
index 000000000000..5837078e298d
--- /dev/null
+++ b/lib/node_modules/@stdlib/number/uint64/ctor/test/test.js
@@ -0,0 +1,452 @@
+/**
+* @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 BigInt = require( '@stdlib/bigint/ctor' );
+var hasBigIntSupport = require( '@stdlib/assert/has-bigint-support' );
+var hasToPrimSymSupport = require( '@stdlib/assert/has-to-primitive-symbol-support' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var isUint32Array = require( '@stdlib/assert/is-uint32array' );
+var Uint32Array = require( '@stdlib/array/uint32' );
+var ToPrimitiveSymbol = require( '@stdlib/symbol/to-primitive' );
+var Uint64 = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof Uint64, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function is a constructor', function test( t ) {
+ var x = new Uint64( 5 );
+ t.strictEqual( x instanceof Uint64, true, 'is an instance' );
+ t.end();
+});
+
+tape( 'the constructor throws an error if not provided a number or string or Array or Uint32Array or BigInt', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ null,
+ void 0,
+ true,
+ false,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var x = new Uint64( value ); // eslint-disable-line no-unused-vars
+ };
+ }
+});
+
+tape( 'the constructor requires the `new` keyword', function test( t ) {
+ var ctor = Uint64;
+ t.throws( foo, TypeError, 'throws an error' );
+ t.end();
+
+ function foo() {
+ ctor( 5 );
+ }
+});
+
+tape( 'the constructor has a read-only `name` property', function test( t ) {
+ t.strictEqual( hasOwnProp( Uint64, 'name' ), true, 'has property' );
+ t.strictEqual( Uint64.name, 'Uint64', 'returns expected value' );
+ t.throws( foo, Error, 'throws an error' );
+ t.end();
+
+ function foo() {
+ Uint64.name = 'Foo';
+ }
+});
+
+tape( 'the constructor has a read-only `BYTES_PER_ELEMENT` property', function test( t ) {
+ t.strictEqual( hasOwnProp( Uint64, 'BYTES_PER_ELEMENT' ), true, 'has property' );
+ t.strictEqual( Uint64.BYTES_PER_ELEMENT, 8, 'returns expected value' );
+ t.throws( foo, Error, 'throws an error' );
+ t.end();
+
+ function foo() {
+ Uint64.BYTES_PER_ELEMENT = 4;
+ }
+});
+
+tape( 'the constructor prototype has a read-only `BYTES_PER_ELEMENT` property', function test( t ) {
+ t.strictEqual( hasOwnProp( Uint64.prototype, 'BYTES_PER_ELEMENT' ), true, 'has property' );
+ t.strictEqual( Uint64.prototype.BYTES_PER_ELEMENT, 8, 'returns expected value' );
+ t.throws( foo, Error, 'throws an error' );
+ t.end();
+
+ function foo() {
+ Uint64.prototype.BYTES_PER_ELEMENT = 4;
+ }
+});
+
+// TODO: commented out because value should be private right?
+/*
+tape( 'the constructor returns an instance having a property for accessing the underlying value', function test( t ) {
+ var x = new Uint64( 5 );
+ t.strictEqual( x.value.toString(), '5', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance which throws an error when attempting to mutate the value', function test( t ) {
+ var x = new Uint64( 5 );
+ t.throws( foo, Error, 'throws an error' );
+ t.end();
+
+ function foo() {
+ x.value = -5;
+ }
+});
+
+tape( 'the constructor returns an instance which stores a provided value as an unsigned 64-bit integer', function test( t ) {
+ var x = new Uint64( 3 );
+ t.strictEqual( x.value.toString(), '3', 'returns expected value' );
+ t.end();
+});
+*/
+
+tape( 'if provided a BigInt, the constructor stores the lower 64 bits', function test( t ) {
+ var x;
+
+ if ( !hasBigIntSupport() ) {
+ t.pass( 'environment does not support BigInt' );
+ t.end();
+ return;
+ }
+ x = new Uint64( BigInt( '18446744073709551616' ) );
+ t.strictEqual( x.toString(), '0', 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided a BigInt and a high-low flag, the constructor stores a Uint32Array', function test( t ) {
+ var x;
+
+ if ( !hasBigIntSupport() ) {
+ t.pass( 'environment does not support BigInt' );
+ t.end();
+ return;
+ }
+ x = new Uint64( BigInt( '18446744073709551616' ), true );
+ t.strictEqual( isUint32Array( x.value ), true, 'returns expected value' );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 0, 0 ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided a Uint32Array of length 2 and no high-low flag, the constructor stores the expected numeric value', function test( t ) {
+ var x;
+
+ x = new Uint64( new Uint32Array( [ 1, 2 ] ) );
+ t.strictEqual( x.toString(), '4294967298', 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided a Uint32Array of length 2 and a high-low flag, the constructor stores a Uint32Array value', function test( t ) {
+ var x;
+
+ x = new Uint64( new Uint32Array( [ 1, 2 ] ), true );
+ t.strictEqual( isUint32Array( x.value ), true, 'returns expected value' );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 2 ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided a Uint32Array which does not have length 2, the constructor throws an error', function test( t ) {
+ t.throws( badValue, TypeError, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ var x = new Uint64( new Uint32Array( 1 ) ); // eslint-disable-line no-unused-vars
+ }
+});
+
+tape( 'if provided an array of length 2 and no high-low flag, the constructor stores the expected numeric value', function test( t ) {
+ var x;
+
+ x = new Uint64( [ 1, 2 ] );
+ t.strictEqual( x.toString(), '4294967298', 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an array of length 2 and a high-low flag, the constructor stores a Uint32Array value', function test( t ) {
+ var x;
+
+ x = new Uint64( [ 1, 2 ], true );
+ t.strictEqual( isUint32Array( x.value ), true, 'returns expected value' );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 2 ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an array of length 2 with float values, the constructor coerces words to uint32', function test( t ) {
+ var x;
+
+ x = new Uint64( [ 1.9, 2.1 ], true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 2 ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an array with a length not equal to 2, the constructor throws an error', function test( t ) {
+ t.throws( badValue, TypeError, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ var x = new Uint64( [ 1 ] ); // eslint-disable-line no-unused-vars
+ }
+});
+
+tape( 'if provided an array containing non-number elements, the constructor throws an error', function test( t ) {
+ t.throws( badValue, TypeError, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ var x = new Uint64( [ '1', 2 ] ); // eslint-disable-line no-unused-vars
+ }
+});
+
+tape( 'if provided an array containing out-of-range numbers, the constructor throws an error', function test( t ) {
+ t.throws( badValue, TypeError, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ var x = new Uint64( [ -1, 2 ] ); // eslint-disable-line no-unused-vars
+ }
+});
+
+tape( 'if provided a valid integer-valued string and no high-low flag, the constructor stores the expected numeric value', function test( t ) {
+ var x;
+
+ x = new Uint64( '123456' );
+ t.strictEqual( x.toString(), '123456', 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an invalid string and no high-low flag, the constructor throws an error', function test( t ) {
+ t.throws( badValue, TypeError, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ var x = new Uint64( 'beep boop' ); // eslint-disable-line no-unused-vars
+ }
+});
+
+tape( 'if provided a string and a high-low flag, the constructor stores the same numeric value as in BigInt mode', function test( t ) {
+ var x;
+
+ x = new Uint64( '123456', true );
+ t.strictEqual( isUint32Array( x.value ), true, 'returns expected value' );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 0, 123456 ], 'returns expected value' );
+ t.strictEqual( x.toString(), '123456', 'returns expected value' );
+
+ x = new Uint64( '4294967296', true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 0 ], 'returns expected value' );
+ t.strictEqual( x.toString(), '4294967296', 'returns expected value' );
+
+ t.throws( badValue, TypeError, 'throws an error for invalid string' );
+ t.end();
+
+ function badValue() {
+ var x = new Uint64( 'beep boop', true ); // eslint-disable-line no-unused-vars
+ }
+});
+
+tape( 'if provided prefixed or whitespace-padded strings and a high-low flag, the constructor parses the expected numeric value', function test( t ) {
+ // TODO: generated tests, to be refined
+ var x;
+
+ x = new Uint64( ' 123456 ', true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 0, 123456 ], 'parses whitespace-padded decimal string' );
+ t.strictEqual( x.toString(), '123456', 'returns expected decimal string' );
+
+ x = new Uint64( '1234567890123', true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 287, 1912276171 ], 'parses chunked decimal string' );
+ t.strictEqual( x.toString(), '1234567890123', 'preserves decimal numeric value' );
+
+ x = new Uint64( '0x123456789abcdef0', true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 0x12345678, 0x9abcdef0 ], 'parses hexadecimal string' );
+ t.strictEqual( x.toString( 16 ), '123456789abcdef0', 'returns expected hexadecimal string' );
+
+ x = new Uint64( '0o10000000000000000', true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 0 ], 'parses octal string' );
+ t.strictEqual( x.toString(), '4294967296', 'returns expected decimal value for octal input' );
+
+ x = new Uint64( '0b100000000000000000000000000000000', true );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 0 ], 'parses binary string' );
+ t.strictEqual( x.toString(), '4294967296', 'returns expected decimal value for binary input' );
+
+ t.end();
+});
+
+tape( 'if provided a valid number and a high-low flag, the constructor stores high-low words', function test( t ) {
+ var x;
+
+ x = new Uint64( 4294967301, true );
+ t.strictEqual( isUint32Array( x.value ), true, 'returns expected value' );
+ t.deepEqual( [ x.value[ 0 ], x.value[ 1 ] ], [ 1, 5 ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an invalid number, the constructor throws an error', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ -1,
+ 3.14,
+ Number.MAX_SAFE_INTEGER + 1
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided '+values[i] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var x = new Uint64( value ); // eslint-disable-line no-unused-vars
+ };
+ }
+});
+
+tape( 'the constructor returns an instance which supports serializing an instance as a string', function test( t ) {
+ var x;
+
+ x = new Uint64( 5 );
+ t.strictEqual( x.toString(), '5', 'returns expected value' );
+
+ x = new Uint64( [ 1, 0 ], true );
+ t.strictEqual( x.toString( 16 ), '100000000', 'returns expected value' );
+
+ x = new Uint64( [ 0, 15 ], true );
+ t.strictEqual( x.toString( 16 ), 'f', 'returns expected value' );
+
+ x = new Uint64( [ 0, 5 ], true );
+ t.strictEqual( x.toString( 10 ), '5', 'returns expected value' );
+
+ x = new Uint64( 255 );
+ t.strictEqual( x.toString(16), 'ff', 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the constructor returns an instance which supports serializing an instance as a JSON object', function test( t ) {
+ var expected;
+ var x;
+
+ x = new Uint64( 5 );
+ expected = {
+ 'type': 'Uint64',
+ 'value': '5'
+ };
+ t.deepEqual( x.toJSON(), expected, 'returns expected value' );
+ t.strictEqual( JSON.stringify( x ), JSON.stringify( expected ), 'returns expected value' );
+
+ // TODO: test array format of toJSON if applicable after review
+ x = new Uint64( [ 1, 2 ], true );
+ expected = {
+ 'type': 'Uint64',
+ 'value': [ 1, 2 ]
+ };
+ t.deepEqual( x.toJSON(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the constructor returns an instance which supports converting an instance to a primitive value', function test( t ) {
+ var x;
+
+ x = new Uint64( 5 );
+ t.strictEqual( x.valueOf(), 5, 'returns expected value' );
+
+ x = new Uint64( [ 1, 0 ] );
+ t.strictEqual( x.valueOf(), 4294967296, 'returns expected value' );
+
+ x = new Uint64( [ 1, 0 ], true );
+ t.strictEqual( x.valueOf(), -1, 'returns expected value' );
+
+ x = new Uint64( 0 );
+ t.strictEqual( x.valueOf(), 0, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if an environment supports `Symbol.toPrimitive`, instances expose a toPrimitive method', function test( t ) {
+ var x;
+
+ if ( !hasToPrimSymSupport() ) {
+ t.pass( 'environment does not support Symbol.toPrimitive' );
+ t.end();
+ return;
+ }
+ x = new Uint64( 5 );
+ t.strictEqual( x[ ToPrimitiveSymbol ]( 'number' ), 5, 'returns expected value' );
+ t.end();
+});
+
+// TODO: we discussed that direct operations will not be supported without the functional utils
+// And should we actually remove the ToPrimitive function?
+/*
+tape( 'the constructor returns an instance which supports implicit type coercion', function test( t ) {
+ var x;
+ var y;
+
+ x = new Uint64( 10.0 );
+ t.strictEqual( x + 5, 15.0, 'returns expected value' );
+ t.strictEqual( x * 2, 20.0, 'returns expected value' );
+
+ x = new Uint64( 3.0 );
+ y = new Uint64( 2.0 );
+ t.strictEqual( x + y, 5, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if an environment supports `Symbol.toPrimitive`, the constructor returns an instance which supports type coercion', function test( t ) {
+ var x;
+
+ if ( !hasToPrimitiveSymbolSupport() ) {
+ t.ok( true, 'environment does not support Symbol.toPrimitive' );
+ t.end();
+ return;
+ }
+ x = new Uint64( 5 );
+
+ t.strictEqual( x[ ToPrimitiveSymbol ]( 'number' ), 5, 'returns expected value' );
+ t.strictEqual( x[ ToPrimitiveSymbol ]( 'default' ), 5, 'returns expected value' );
+ t.strictEqual( x[ ToPrimitiveSymbol ]( 'string' ), 5, 'returns expected value' );
+
+ x = new Uint64( -3.14 );
+ t.strictEqual( x[ ToPrimitiveSymbol ](), -3.140625, 'returns expected value' );
+
+ t.end();
+});
+*/