long.js
No description.

File Location

/goog/math/long.js

Classes

goog.math.Long
Constructs a 64-bit two's-complement integer, given its low and high 32-bit values as *signed* integers. See the from* functions below for more convenient ways of constructing Longs. The internal representation of a long is the two given signed, 32-bit values. 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. In the algorithms below, we frequently reduce the negative case to the positive case by negating the input(s) and then post-processing the result. Note that we must ALWAYS check specially whether those values are MIN_VALUE (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as a positive number, it overflows back into a negative). Not handling this case would often result in infinite recursion.

Public Protected Private

Global Functions

goog.math.Long.fromBits(lowBitshighBits) !goog.math.Long
Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
Arguments:
lowBits : number
The low 32-bits.
highBits : number
The high 32-bits.
Returns: !goog.math.Long  The corresponding Long value.
code »
goog.math.Long.fromInt(value) !goog.math.Long
Returns a Long representing the given (32-bit) integer value.
Arguments:
value : number
The 32-bit integer in question.
Returns: !goog.math.Long  The corresponding Long value.
code »
goog.math.Long.fromNumber(value) !goog.math.Long
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
Arguments:
value : number
The number in question.
Returns: !goog.math.Long  The corresponding Long value.
code »
goog.math.Long.fromString(stropt_radix) !goog.math.Long
Returns a Long representation of the given string, written using the given radix.
Arguments:
str : string
The textual representation of the Long.
opt_radix : number=
The radix in which the text is written.
Returns: !goog.math.Long  The corresponding Long value.
code »

Directory math

File Reference