search

goog.math.Integer

Provided By

Constructs a two's-complement integer an array containing bits of the integer in 32-bit (signed) pieces, given in little-endian order (i.e., lowest-order bits in the first piece), and the sign of -1 or 0.

See the from* functions below for other convenient ways of constructing Integers.

The internal representation of an integer is an array of 32-bit signed pieces, along with a sign (0 or -1) that indicates the contents of all the other 32-bit pieces out to infinity. We use 32-bit pieces because these are the size of integers on which JavaScript performs bit-operations. For operations like addition and multiplication, we split each number into 16-bit pieces, which can easily be multiplied within JavaScript's floating-point representation without overflow or change in sign.

new Integer( bits, sign )

Parameters
bits(Array<number>|null)

Array containing the bits of the number.

signnumber

The sign of the number: -1 for negative and 0 positive.

Instance Methods

Static Functions

Static Properties

Classes