Home › Developer & IT › IEEE 754 Floating-Point Converter
IEEE 754 Floating-Point Converter
Encodes a decimal number as an IEEE 754 binary32 (single) or binary64 (double) value and reports the sign, exponent and mantissa bit fields, the hexadecimal and binary representation, the exact value actually stored and the rounding error.
When to use
You need the hex or binary encoding of a float, want to see why 0.1 is not exactly representable, or need to classify a value as normal, subnormal, zero or infinity.
Do not use when: You want integer bit patterns (use bitwise-operations or base-converter) or need decimal-to-binary conversion of integers only.
Formula
value = (−1)^sign × (1 + mantissa / 2^m) × 2^(biased_exponent − bias) for normal numbers; (−1)^sign × (mantissa / 2^m) × 2^(1 − bias) for subnormals; m = 23, bias = 127 (single) or m = 52, bias = 1023 (double)
Encoding uses a DataView (round-to-nearest-even as specified by IEEE 754-2019). Inputs are JavaScript doubles, so the double path never has a rounding error; the exact decimal is computed with integer arithmetic from the stored bits.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
value | number | yes | The number to encode; parsed as a JavaScript double first, then rounded to single precision when precision = single. | |
precision | enum: single | double | default single | IEEE 754 format: 1+8+23 bits (single) or 1+11+52 bits (double). |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
sign_bit | integer | 0 for positive, 1 for negative. | |
exponent_bits | string | The 8 (single) or 11 (double) biased exponent bits. | |
mantissa_bits | string | The 23 or 52 fraction bits (the leading 1 of normal numbers is implicit). | |
biased_exponent | integer | Exponent field as an unsigned integer (bias 127 for single, 1023 for double). | |
unbiased_exponent | integer | biased_exponent − bias; subnormals and zero use 2^(1 − bias) instead. | |
significand | number | 1.fraction for normal numbers (0.fraction for subnormals), so that value = (−1)^sign × significand × 2^exponent. | |
hex | string | All bits as a hex word, e.g. 0x3F800000. | |
binary | string | All 32 or 64 bits, sign first. | |
stored_value | number | The value actually representable in the chosen precision (rounded to nearest, ties to even). | |
stored_value_exact | string | Exact decimal expansion of the stored binary value. | |
rounding_error | number | value − stored_value (0 when the input is exactly representable). | |
classification | string | normal, subnormal, zero, infinity or nan. |
Example
1.0 in single precision: {"value":1,"precision":"single"} → {"sign_bit":0,"biased_exponent":127,"unbiased_exponent":0,"hex":"0x3F800000","exponent_bits":"01111111","mantissa_bits":"00000000000000000000000","stored_value":1,"rounding_error":0,"classification":"normal"}
0.1 in single precision: {"value":0.1,"precision":"single"} → {"hex":"0x3DCCCCCD","biased_exponent":123,"unbiased_exponent":-4,"stored_value":0.100000001490116,"stored_value_exact":"0.100000001490116119384765625","mantissa_bits":"10011001100110011001101","rounding_error":-1.4901161193847655e-9,"classification":"normal"}
GET https://tttkmbb.com/api/v1/calculate/ieee-754-float?value=1&precision=single
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/ieee-754-float(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/ieee-754-float · Markdown: https://tttkmbb.com/developer/ieee-754-float.md · JSON definition: https://tttkmbb.com/developer/ieee-754-float.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="ieee-754-float" - OpenAPI operationId:
convert_ieee_754_float - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
Why is 0.1 stored as 0.100000001490116?
0.1 has an infinite binary expansion (0.000110011…), so it is rounded to the nearest of the 2^23 fractions available at that exponent; the error of about 1.49 × 10⁻⁹ is the rounding_error output.
What is a subnormal number?
A value with exponent field 0 and a non-zero mantissa: it is scaled by 2^(1 − bias) without the implicit leading 1, filling the gap between zero and the smallest normal number (1.18 × 10⁻³⁸ for single).
Can I enter infinity or NaN?
Not directly (inputs must be finite), but values beyond 3.4 × 10³⁸ overflow to infinity in single precision and are classified as such.
Related calculators
- Bitwise Operations Calculator — Manipulate the resulting bit pattern.
- Number Base Converter — Convert the hex word to binary or decimal.
- Scientific Notation Converter — Decimal scientific notation of the same value.