Answers to Unexpected negative value in Int32Array ( 1 )

  1. 2017-09-05 22:09

    Int32Array allows 32 bits per value, with 32nd bit (from the right) being reserved to specify the sign of the number. The number you're trying to fit is (699044815921).toString(2).length == 40 bits long, so 8 leftmost bits are discarded, 32nd bit is interpreted as a sign bit, and you get what you get as a result.

Leave a reply to - Unexpected negative value in Int32Array

◀ Go back