# 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.

- Calculator id: `ieee-754-float` · Category: Developer & IT (`developer`) · Tool name: `convert_ieee_754_float`
- Canonical page: https://tttkmbb.com/developer/ieee-754-float · This document: https://tttkmbb.com/developer/ieee-754-float.md · JSON definition: https://tttkmbb.com/developer/ieee-754-float.json

## Purpose

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.

**Use when:** 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.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | number |  | required | The number to encode; parsed as a JavaScript double first, then rounded to single precision when precision = single. |
| `precision` | enum: single \| double |  | optional, default "single" | IEEE 754 format: 1+8+23 bits (single) or 1+11+52 bits (double). |

## Output

| Field | 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. |

## 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.

## Data Sources

- Single-precision floating-point format – IEEE 754 binary32 (Wikipedia) — https://en.wikipedia.org/wiki/Single-precision_floating-point_format (reference, retrieved 2026-09-24)
- Double-precision floating-point format – IEEE 754 binary64 (Wikipedia) — https://en.wikipedia.org/wiki/Double-precision_floating-point_format (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/ieee-754-float?value=…`
- `POST https://tttkmbb.com/api/v1/calculate/ieee-754-float` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/ieee-754-float · OpenAPI operationId `convert_ieee_754_float` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "ieee-754-float", "inputs": {…}}`

## Example

- 1.0 in single precision: inputs `{"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: inputs `{"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
```

## Limitations

You want integer bit patterns (use bitwise-operations or base-converter) or need decimal-to-binary conversion of integers only. 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. All values are computed from the formula above; no measurement or live data is involved.

## 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

- [Bitwise Operations Calculator](https://tttkmbb.com/developer/bitwise-operations.md) — Manipulate the resulting bit pattern.
- [Number Base Converter](https://tttkmbb.com/math/base-converter.md) — Convert the hex word to binary or decimal.
- [Scientific Notation Converter](https://tttkmbb.com/math/scientific-notation.md) — Decimal scientific notation of the same value.
