Fix int ranges [closes #13]
This commit is contained in:
parent
c3259b0a65
commit
c670ff17e9
|
@ -36,10 +36,10 @@ Usually a signed representation is used,
|
||||||
which means that both negative and positive
|
which means that both negative and positive
|
||||||
numbers can be represented.
|
numbers can be represented.
|
||||||
A signed number of $n$ bits can contain any
|
A signed number of $n$ bits can contain any
|
||||||
integer between $2^{n-1}$ and $2^{n-1}-1$.
|
integer between $-2^{n-1}$ and $2^{n-1}-1$.
|
||||||
For example, the \texttt{int} type in C++ is
|
For example, the \texttt{int} type in C++ is
|
||||||
a signed type, and it can contain any
|
a signed type, and it can contain any
|
||||||
integer between $2^{31}$ and $2^{31}-1$.
|
integer between $-2^{31}$ and $2^{31}-1$.
|
||||||
|
|
||||||
The first bit in a signed representation
|
The first bit in a signed representation
|
||||||
is the sign of the number (0 for nonnegative numbers
|
is the sign of the number (0 for nonnegative numbers
|
||||||
|
|
Loading…
Reference in New Issue