46- and 64-bit integers

204 Views Asked by At

Some Cray supercomputers used to support 46-bit and 64-bit integer data types. What are the maximum and minimum values that we could express in a 46-bit integer? in a 64-bit integer?

Is my thinking correct that the ranges would be $\pm 2^{46}$ and $\pm 2^{64}$, correspondingly?

1

There are 1 best solutions below

0
On BEST ANSWER

Almost.

With $n$ bits, we can represent $2^n$ distinct values. For unsigned integer types, we can thus cover the range from $0$ to $2^n-1$. And with signed integer types (two's complement with symmetric range), we can cover $-2^{n-1}$ to $2^{n-1}-1$.