About stdlib...
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Unsigned 64-bit integer.
npm install @stdlib/number-uint64-ctorAlternatively,
- To load the package in a website via a
scripttag without installation and bundlers, use the ES Module available on theesmbranch (see README). - If you are using Deno, visit the
denobranch (see README for usage intructions). - For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the
umdbranch (see README).
The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.
To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
var Uint64 = require( '@stdlib/number-uint64-ctor' );Unsigned 64-bit integer constructor.
var x = new Uint64( 5 );
// returns <Uint64>Static property returning the constructor name.
var str = Uint64.name;
// returns 'Uint64'Size (in bytes) of the underlying value.
var nbytes = Uint64.BYTES_PER_ELEMENT;
// returns 8Size (in bytes) of the underlying value.
var x = new Uint64( 5 );
var nbytes = x.BYTES_PER_ELEMENT;
// returns 8Size (in bytes) of the underlying value.
var x = new Uint64( 5 );
var nbytes = x.byteLength;
// returns 8High 32-bit word of an unsigned 64-bit integer.
var x = Uint64.from( [ 1234, 5678 ] );
var w = x.hi;
// returns 1234Low 32-bit word of an unsigned 64-bit integer.
var x = Uint64.from( [ 1234, 5678 ] );
var w = x.lo;
// returns 5678Creates a new unsigned 64-bit integer from an array-like object containing a high and low word.
var x = Uint64.from( [ 1234, 5678 ] );
// returns <Uint64>Creates a new unsigned 64-bit integer from a high and low word.
var x = Uint64.of( 1234, 5678 );
// returns <Uint64>These methods do not mutate a Uint64 instance and, instead, return an unsigned 64-bit integer representation.
Returns a string representation of a Uint64 instance.
var x = new Uint64( 5 );
var str = x.toString();
// returns '5'Returns a JSON representation of a Uint64 instance. JSON.stringify() implicitly calls this method when stringifying a Uint64 instance.
var x = new Uint64( 5 );
var o = x.toJSON();
// returns { 'type': 'Uint64', 'words': [ 0, 5 ] }To revive a Uint64 instance from a JSON string, see @stdlib/number/uint64/reviver.
Converts a Uint64 instance to a primitive value.
var x = new Uint64( 5 );
var v = x.valueOf();
// e.g., returns <bigint>- An unsigned 64-bit integer has a range of [
0,2^64-1].
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","words":[0,1234]}'This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2026. The Stdlib Authors.