Created
June 18, 2018 17:08
-
-
Save jido/7ece9b47b884e186e7b88e46769771f4 to your computer and use it in GitHub Desktop.
Binary decimal format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bit 63 = sign | |
Subnormal | |
0.0-9.999 999 999 999 999E-511 | |
Stored as uint64 | |
Normal fp | |
Bit 62-53 = exponent | |
Bit 52-0 = mantissa | |
Mantissa range 0-8 999 999 999 999 999 | |
Add 1 000 000 000 000 000 to cover 1.0-9.99eX | |
Exponent 0 and 1 used for subnormal | |
Exponent 0x3FF used for ±infinity | |
Remaining: 2-0x3FE (1021 values), subnormal adds 1 exponent | |
That is a range -511 to +510 | |
Can make it symmetrical, -511 to +511 with some shifting. | |
Subnormal values don't actually use the upper range of exponent = 1. | |
Infinity doesn't actually need the lower range of exponent 0x3FF. | |
So by taking away 0x00100000 00000000 the normal exponent can take values 1-0xFE, add 0 for subnormal and there are now 1023 values (-511 to 511) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment