2026-05-12 21:02 UTC
Replies (1)
-
@blobster@infosec.exchange 2026-05-13 15:22
@zerodogg@hachyderm.io @b0rk_reruns@social.jvns.ca For those who wonder about the 0x4024000000000000 representation of 10.0 in binary64 floating point format: 10 = 8 + 2 = 0b1010 = 0b1.010 × 23 Note that the integral part of 0b1.010 is 1; we need this to have the “correct” exponent. 0b1.010 is the significand; its fractional part is 0b0.010. In binary64 floating point format, it is represented (normal number) by 52 bits: 01000000000000...0. 10.0 being a positive number, the sign bit is 0. The exponent is 3; to represent it in binary64 floating point format which uses 11 bits for the exponent field, we add the following bias to it: 211-1 - 1 = 1023 = 0b01111111111 which results in 1026 = 0b10000000010. This gives the exponent field: 10000000010. Concatenating the sign bit with the exponent field and the digits following the comma in the fractional part of the significand, we obtain the following binary representation: 0 10000000010 0100000000000000000000000000000000000000000000000000 i.e. 0100 0000 0010 0100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 which is indeed 0x4024000000000000 in hexadecimal notation.