integer.js
No description.

File Location

/goog/math/integer.js

Classes

goog.math.Integer
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.

Public Protected Private

Global Functions

goog.math.Integer.carry16_(bitsindex)
Carries any overflow from the given index into later entries.
Arguments:
bits : Array.<number>
Array of 16-bit values in little-endian order.
index : number
The index in question.
code »
goog.math.Integer.fromBits(bits) !goog.math.Integer
Returns a Integer representing the value that comes by concatenating the given entries, each is assumed to be 32 signed bits, given in little-endian order (lowest order bits in the lowest index), and sign-extending the highest order 32-bit value.
Arguments:
bits : Array.<number>
The bits of the number, in 32-bit signed pieces, in little-endian order.
Returns: !goog.math.Integer  The corresponding Integer value.
code »
goog.math.Integer.fromInt(value) !goog.math.Integer
Returns an Integer representing the given (32-bit) integer value.
Arguments:
value : number
A 32-bit integer value.
Returns: !goog.math.Integer  The corresponding Integer value.
code »
goog.math.Integer.fromNumber(value) !goog.math.Integer
Returns an Integer representing the given value, provided that it is a finite number. Otherwise, zero is returned.
Arguments:
value : number
The value in question.
Returns: !goog.math.Integer  The corresponding Integer value.
code »
goog.math.Integer.fromString(stropt_radix) !goog.math.Integer
Returns an Integer representation of the given string, written using the given radix.
Arguments:
str : string
The textual representation of the Integer.
opt_radix : number=
The radix in which the text is written.
Returns: !goog.math.Integer  The corresponding Integer value.
code »

Directory math

File Reference