Datatype long - what does high and low mean? Datatype long - what does high and low mean? json json

Datatype long - what does high and low mean?


high and low in this case designate the higher and lower order bits of the long number.

There's an interesting explanation of high and low order bits here:

Now, high/low order refers to the place value of the bits or words. For instance, in base 10, if we have four digits ABCD, the A digit has a place value of thousands, B hundreds, C tens, and D ones. In binary this is similar, except place values grow by powers of 2 - you'd have A eights, B fours, C twos, and D ones.

The high-order bit is the bit with the highest place value in a given block of bits. This may be a byte, word, dword, or whatever. The high-order word is the word containing the high-order bit; at least two words are required for this to make sense. Low order is similar, but using the least-significant place value instead.

Let's assume our Long has 64 bits. low would be the base 10 representation of the 32 lower order bits (typically on the right) whereas high would be the base 10 representation of the 32 higher order bits (typically on the left).

That specific Long representation seems to originate from the Long library, a tool that helps tp represent long numbers in javascript.

Reading the source on GitHub is a treasure of insight on why this representation is chosen, but most importantly:

// 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.

You were able to interact with the value with toNumber because they've implemented it in the library.


That ain't regular JSON, where the value of an object can only be string, number, object, array, true, false or null. See http://www.json.org/.

The API you are using must be replying with something which is derived from JSON.

Which API are you programming against?

I'm guessing that the API is trying to emulate/forcing a 64-bit integer, similar to LARGE_INTEGER, a Win32 construct.

The value you are looking at is probably 342 * 2^32 + 600206158, in other words 1469479021390.