Skip to content

Instantly share code, notes, and snippets.

@dwijnand
Last active December 19, 2015 17:25
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dwijnand/6210f2d623cf02c492e1 to your computer and use it in GitHub Desktop.
Save dwijnand/6210f2d623cf02c492e1 to your computer and use it in GitHub Desktop.
+-----------------------------------------------------------------------------------------------------+
| name | bits | bytes | min | actual min value | max | actual max value |
|---------+--------+--------+-------+----------------------------+--------+---------------------------|
| boolean | 1-bit | -- | false | | true | |
| byte | 8-bit | 1-byte | -2^7 | -128 | 2^7-1 | 127 |
| short | 16-bit | 2-byte | -2^15 | -32'768 | 2^15-1 | 32'767 |
| char | 16-bit | 2-byte | 0 | '\u0000' | 2^16-1 | '\uffff' (65535) |
| int | 32-bit | 4-byte | -2^31 | -2'147'483'648 | 2^31-1 | 2'147'483'647 |
| long | 64-bit | 8-byte | -2^63 | -9'223'372'036'854'775'808 | 2^63-1 | 9'223'372'036'854'775'807 |
| float | 32-bit | 4-byte | +/- -3.4028235 * 10^38 | +/- 3.4028235 * 10^38 |
| double | 64-bit | 8-byte | +/- -1.7976931348623157 * 10^308 | +/- 1.7976931348623157 * 10^308 |
+-----------------------------------------------------------------------------------------------------+
-10^308 -10^38 -2^63 -2^31 -2^15 -2^7 0 1 2^7 2^15 2^16 2^31 2^63 10^38 10^308
bool
|----- byte ---)
|------------ short ---------)
|----------- char ---------)
|-------------------- int ----------------------------)
|----------------------------- long -----------------------------------)
{------------------------------------- float ------------------------------------------}
{---------------------------------------------- double ---------------------------------------------------}
1b 8b 16b 32b 64b
1B 2B 4B 8B
bool
| byte |
|--- short ----|
|--- char ----|
|------------ int -------------|
|----------- float ------------|
|-------------------------- long -----------------------------|
|-------------------------- double ----------------------------|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment