Talk:Integer

From Valve Developer Community
Jump to navigation Jump to search

Integer size vs. Range

In the article, it says that a long has twice the memory and range of a normal int, when the range is actually the square of the int's range (in binary, adding a bit doubles the range). Same for short; its range is the square root of the int's range quanta 03:50, 19 January 2010 (UTC)

This article is in fact incorrect.
the value range of an integer is -2147483648 - 2147483647
the range of a short is -32768 - 32767
so the range of an unsigned short is 0 - 65535 (correct explained in the article)
but the range of positive values of an unsigned short is still smaller than that one of an signed integer
--Sacaldur