You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aymeric Beaumet edited this page Jan 19, 2015
·
7 revisions
Frequently Asked Questions
Why doesn't tweet.id contain the correct id? (#126)
TLDR: JavaScript does not support such big numbers without losing precision, do use tweet.id_str instead.
Explanations: current JavaScript implementations follow the IEEE 754 standard and therefore represents numeric values as double precision 64 bit floating point numbers. Those bits are split in three parts:
value: 52 bits
exponent: 11 bits
sign: 1 bit
This allows to store at most 53 bits, thus being too small to store Twitter ids which are 64 bit unsigned integers. Therefore when the Twitter API messages are parsed (using JSON.parse), it only stores a numeric approximation of the tweet id. The precise value is still accessible at tweet.id_str as a string (hence unaltered).