math - Significance of the number -947483647 -
i'm migrating code compiler 32-bit integers 64-bit. found old code assumes highest possible integer 2147483647 , lowest possible -947483647.
i understand highest (maximum signed 32-bit integer), know makes lowest special? there nothing in business logic suggests integer (used id) can't below number.
searching google turns little except other code used 947483646 in variable called inf (infinity/highest possible number? in signed, two's-complement representation make "negative infinity" -947483647).
it may meaningless number, there few other hits using exact number other integers monster hp in video game (while searching other close-by numbers turn no results) makes me think there's behind it.
int32 datatype doesn't have value infinity, 1 can randomly chose magic number denote inf.
it's naturally select maximal integer value (2^31-1) +inf.
why (-2^31) not chosen -inf?
probably, because both +inf , -inf must have equal length when printed (10 chars each).
Comments
Post a Comment