Floating Point Calculator
Convert a decimal number to IEEE 754 half, single or double precision: sign, exponent and mantissa bits, hex, the exact value actually stored and the rounding error.
Examples: 0.1, -6.25, 1e-7, 65504, Infinity, NaN
Sign (red), exponent (green), fraction (blue)
Hex
0x3DCCCCCD
Value Actually Stored
0.100000001490116119384765625
Rounding Error
1.490e-9 (1.49e-8 relative)
Sign
0 (positive)
Exponent
123 stored; 2^(123 − 127 = -4)
Class
Normal
Bias / Epsilon
127 / 1.1920929e-7
Largest Finite Value
3.4028235 × 10^38
IEEE 754 Floating-point Representation
Enter a decimal number and choose the format. The calculator shows the bit pattern, the hex code a program would store, the exact value those bits represent and how far it is from your input.
Formats
| Format | Bits (S/E/F) | Bias | Epsilon | Max | Decimal digits |
|---|---|---|---|---|---|
| Half (binary16) | 1 / 5 / 10 | 15 | 9.77 × 10⁻⁴ | 65,504 | ≈ 3.3 |
| Single (binary32) | 1 / 8 / 23 | 127 | 1.19 × 10⁻⁷ | 3.40 × 10³⁸ | ≈ 7.2 |
| Double (binary64) | 1 / 11 / 52 | 1023 | 2.22 × 10⁻¹⁶ | 1.80 × 10³⁰⁸ | ≈ 15.9 |
Conversion steps
- Write the number in binary and normalise to 1.f × 2e
- Sign bit 0 for positive, 1 for negative
- Store e + bias in the exponent field
- Store f (without the leading 1), rounded to nearest, ties to even
Worked examples
1. 0.1 as single precision (the default).0x3DCCCCCD; stored 0.100000001490116119384765625; error 1.49 × 10⁻⁹.
2. −6.25 single.0xC0C80000, exact.
3. 0.1 as double.0x3FB999999999999A = 0.1000000000000000055511151231257827…
4. 70,000 as half precision. Overflows to Infinity (max 65,504).
Never compare floating-point results for exact equality; test whether they are within a small tolerance.
Related tools
- Bits and hex: Binary Calculator. Byte sizes: Encoding Calculator.
Frequently Asked Questions
How is a number stored in IEEE 754?
As a sign bit, a biased exponent and a fraction (mantissa). For normal numbers value = (−1)^sign × 1.fraction × 2^(exponent − bias).
What are the bit layouts?
Half: 1 sign, 5 exponent, 10 fraction bits (bias 15). Single: 1, 8, 23 (bias 127). Double: 1, 11, 52 (bias 1023).
How do I convert −6.25 to single precision?
6.25 = 110.01₂ = 1.1001 × 2². Sign 1; exponent 2 + 127 = 129 = 10000001; fraction 1001 followed by zeros. Result 0xC0C80000.
Why is 0.1 not exact?
0.1 is a repeating fraction in binary (0.000110011…), so it must be rounded. As a float it is stored as 0.100000001490116…, which is why 0.1 + 0.2 does not equal 0.3 exactly in most languages.
What is the bias?
A constant added to the real exponent so it can be stored as an unsigned number: 127 for single precision, so an exponent field of 123 means 2⁻⁴.
What are subnormal numbers?
When the exponent field is all zeros, the hidden leading 1 becomes 0, allowing values smaller than the normal minimum (gradual underflow) at reduced precision.
How are infinity and NaN stored?
Exponent all ones: fraction zero means ±infinity; non-zero fraction means NaN (not a number), such as 0/0.
What is machine epsilon?
The gap between 1 and the next representable number: 2⁻¹⁰ (about 0.001) for half, 2⁻²³ (1.19 × 10⁻⁷) for single and 2⁻⁵² (2.22 × 10⁻¹⁶) for double.
How many decimal digits of precision are there?
About 3 for half, 7 for single and 15 to 17 for double.
Where is half precision used?
Graphics and machine learning (GPU training and inference), where memory and bandwidth matter more than precision. Its largest value is 65,504.
Related Calculators
Binary Calculator
Convert between decimal, binary, octal, and hexadecimal number systems. Perform bitwise AND, OR, XOR, NOT, and shift operations.
Big O Complexity Calculator
Estimate algorithm performance based on input size and time complexity class. Compare O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n).
Boolean Algebra Calculator
Evaluate Boolean logic gates (AND, OR, XOR, NAND, NOR) for up to 3 inputs. View truth table outputs and minterm expressions.
Encoding Calculator
Calculate string encoding sizes, byte representations, and storage requirements for different character encodings.
Hamming Distance Calculator
Calculate the Hamming distance between two binary values. Determine the number of differing bit positions and error detection capability.
CRC Calculator
Calculate Cyclic Redundancy Check (CRC) values using polynomial division. Enter data and generator polynomial to compute CRC checksum.
More in Computer Science · Engineering calculators · All calculators A–Z