Float ieee754 convert
float-ieee754-convert · version 1.0.0 · Other utilities · free, no key needed
Convert binary16/32/64 decimal values and exact hex bits, returning fields, class, and the exact stored decimal.
Use when you need to: IEEE 754 float32 to hexadecimal bits encode decode · show exact decimal stored by a float · decode binary64 hex sign exponent fraction.
Decide before calling
Read the versioned contract and the supported scope below. Reuse float-ieee754-convert@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use float-ieee754-convert@1.0.0 for IEEE 754 float32 to hexadecimal bits encode decode. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- IEEE 754 float32 to hexadecimal bits encode decode
- show exact decimal stored by a float
- decode binary64 hex sign exponent fraction
- convert decimal to half precision binary16
- classify NaN infinity subnormal negative zero
- inspect floating point bit pattern
- round decimal to nearest representable float
Not supported
- decimal floating-point formats
- alternative rounding modes
- NaN payload selection when encoding decimal NaN
Behavior
- Implements IEEE 754-2019 binary interchange encodings; standard_version is IEEE 754-2019; Python 3.12 struct.
- Decimal finite input is parsed as an exact rational and rounded once to nearest representable binary16, binary32, or binary64 with ties to even; no JavaScript Number conversion is used.
- exact_decimal is the exact finite dyadic value in ordinary decimal notation; special tokens are NaN, Infinity, -Infinity, and -0. Decoding preserves every NaN payload in hex while classifying it as nan.
- max_input_bytes bounds the UTF-8 byte length of JSON.stringify(input), including keys, punctuation, and every field. Field bounds apply together with this whole-input bound.
- The explicit decimal exponent e or E must be an integer from -400 through 400 inclusive; an exponent outside that range is invalid_input, including for zero-valued input. max_decimal_input_bytes bounds the decimal value string. Hex input has exactly 4, 8, or 16 characters according to format.
- Every negative zero decimal spelling, including -0, -0.0, and -0e5, encodes only the sign bit and returns classification negative_zero, sign 1, and exact_decimal -0.
Input
format(one of "binary16", "binary32", "binary64", required)direction(one of "decimal_to_hex", "hex_to_decimal", required)value(string, required): min length 1; max length 128
Output
standard_version(string, required)format(one of "binary16", "binary32", "binary64", required)hex(string, required): min length 4; max length 16; pattern^[0-9a-f]+$classification(one of "zero", "negative_zero", "subnormal", "normal", "infinity", "nan", required)sign(integer, required): min 0; max 1biased_exponent(integer, required): min 0; max 2047exponent_bits(string, required): min length 5; max length 11; pattern^[01]+$fraction_bits(string, required): min length 10; max length 52; pattern^[01]+$exact_decimal(string, required): min length 1; max length 1200
Limits
- max input bytes: 256
- max decimal input bytes: 128
- max decimal exponent: 400
- max output bytes: 8192
Example
Request input:
{
"format": "binary32",
"direction": "decimal_to_hex",
"value": "0.1"
}
Response:
{
"result": {
"standard_version": "IEEE 754-2019; Python 3.12 struct",
"format": "binary32",
"hex": "3dcccccd",
"classification": "normal",
"sign": 0,
"biased_exponent": 123,
"exponent_bits": "01111011",
"fraction_bits": "10011001100110011001101",
"exact_decimal": "0.100000001490116119384765625"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "float-ieee754-convert",
"version": "1.0.0",
"input": {
"format": "binary32",
"direction": "decimal_to_hex",
"value": "0.1"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/float-ieee754-convert/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"format":"binary32","direction":"decimal_to_hex","value":"0.1"}'
The machine-readable contract is at /v1/tools/float-ieee754-convert/versions/1.0.0.
CLI
node cli.mjs run float-ieee754-convert 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Geohash convert: Encode decimal coordinates as a bounded Geohash or decode a Geohash to its exact bounding box and midpoint.
- Base64url encode: Encode supplied UTF-8 text or hexadecimal bytes as base64url and return the encoded string.
- Bytes unpack integers: Unpack raw hex bytes into exact signed or unsigned integer strings using an explicit endian layout.
- Bytes format human: Format an exact byte count as both SI and IEC strings and return the rounding mode used.
- Bytes pack integers: Pack exact decimal integer strings into raw hex bytes with explicit widths, endianness, and range checks.
- Bytes parse human: Parse an SI or IEC byte-size string and return an exact integer byte count using explicit rounding.