Bitlump Float Twiddler
Input
Closest representable value
Sign
Exponent
Mantissa
Fields
Raw
Bits
Conditions
Negative
Zero
Subnormal
Infinity
NaN
To Bitlump
Closest representable value, to decimal digits
To Bitlump
| Sign | Exponent | Mantissa | ||
|---|---|---|---|---|
| Fields | ||||
| Raw | ||||
| Bits | ||||
| Conditions |
Negative
Zero
Subnormal
Infinity
NaN
|
|||
| To Bitlump | ||||
| Closest representable value, to decimal digits | ||||
| To Bitlump | ||||
IEEE 754 binary format
An IEEE 754 floating point number consists of three bit-fields: the sign bit, the exponent, and the mantissa.
Sign
The top bit is the sign bit.
Exponent
A floating point number has a base-2 exponent, indicating the power of two by which the mantissa must be multiplied.
In a XXX-bit XXX-precision float, the exponent field is bits.
An exponent field of all 0-bits indicates the value is zero or a subnormal number, and the true exponent is XXX. An exponent field of all 1-bits indicates an Infinity or NaN. In all other cases, the exponent field is stored biased by XXX, so the true exponent value is the raw value minus XXX.
Mantissa
The mantissa is the binary fraction which must be multiplied by 2exponent to produce the final value.
In a XXX-bit XXX-precision float, the mantissa field stores XXX bits. These are the bits after the mantissa's binary point; the single leading bit, before the binary point, is implied. The implied bit's value is usually 1, but it is 0 for subnormal numbers (see above) and zero. Therefore, the true value of the mantissa is in the range 1 ≤ mantissa < 2, except for subnormal numbers and zero, where it is in the range 0 ≤ mantissa < 1.
Value
The overall value is given by:
signvalue × 2exponent × mantissa
where signvalue is 1 if the number is positive or -1 if negative.
Limits and constants
The following limits and attributes apply to IEEE 754 XXX-precision floating point numbers.
| Number of bits | |
|---|---|
| Sign bit | 1 bit, mask XXX |
| Exponent bits | XXX bits (biased +XXX), mask XXX |
| Mantissa bits | XXX bits (not including implied leading bit), mask XXX |
| Exponent range | 2XXX to 2XXX |
| Smallest subnormal value | XXX, XXX |
| Largest subnormal value | XXX, XXX |
| Smallest normal value | XXX, XXX |
| Largest normal value | XXX, XXX |
| Decimal digits required for lossless round-trip |
XXX |