wire / wire-format / ieee754-float

IEEE 754 floating-point (binary32/binary64)

IEEE 754 is the standard for floating-point arithmetic. Binary32 (float): 1 sign bit, 8 exponent bits (bias 127), 23 mantissa bits (24 with implicit leading 1). Binary64 (double): 1 sign, 11 exponent (bias 1023), 52 mantissa (53 with implicit). Special values: 0 (exp=0, mant=0), subnormal (exp=0, mant!=0), infinity (exp=all 1s, mant=0), NaN (exp=all 1s, mant!=0).

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: IEEE 754 floating-point (binary32/binary64)

wire format

spec: IEEE 754-2019

IEEE 754 is the standard for floating-point arithmetic. Binary32 (float): 1 sign bit, 8 exponent bits (bias 127), 23 mantissa bits (24 with implicit leading 1). Binary64 (double): 1 sign, 11 exponent (bias 1023), 52 mantissa (53 with implicit). Special values: 0 (exp=0, mant=0), subnormal (exp=0, mant!=0), infinity (exp=all 1s, mant=0), NaN (exp=all 1s, mant!=0).

fieldsizemeaning
Sign1 bit0 = positive, 1 = negative.
Exponent (binary32)8 bitsBiased exponent. Bias = 127. Actual exponent = stored - 127. Range: -126 to +127 (0 and 255 reserved).
Exponent (binary64)11 bitsBiased exponent. Bias = 1023. Actual exponent = stored - 1023. Range: -1022 to +1023.
Mantissa (binary32)23 bitsFractional part. Implicit leading 1 for normal numbers (24-bit precision). Subnormals have no implicit 1.
Mantissa (binary64)52 bitsFractional part. Implicit leading 1 for normal numbers (53-bit precision).
ZerospecialExponent=0, mantissa=0. Signed zero: +0 (0x00000000) and -0 (0x80000000).
SubnormalspecialExponent=0, mantissa!=0. Value = (-1)^sign * 2^(-126) * (mantissa/2^23) for binary32.
InfinityspecialExponent=all 1s, mantissa=0. Signed: +inf and -inf.
NaNspecialExponent=all 1s, mantissa!=0. Quiet NaN (MSB of mantissa=1) vs Signaling NaN (MSB=0).

example:

40 49 0f db

binary32: +3.14159265 (pi) = 0x40490FDB


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/ieee754-float or /wire-format/ieee754-float.json