Floating Point Conversion Calculator

Interactive tool for converting and visualizing floating-point numbers across standard and custom formats. Convert between FP32, FP16, BF16, TF32, FP8, etc. while inspecting binary representations and precision loss.

Live URL: https://sw23.github.io/fp-conv/

Features

  • Format presets: FP64, FP32, FP16, BF16, TF32, OCP FP4/FP6/FP8
  • Integer formats: INT32, UINT32, INT16, UINT16, INT8, UINT8, INT4, UINT4
  • OCP format support: Full support for Open Compute Project microscaling formats
  • Custom formats: Define any bit layout (0–15 exponent bits, 0–112 mantissa bits)
  • Interactive editing: Toggle individual bits and see decimal/hex updates
  • Precision analysis: Calculate absolute and relative error between formats
  • Special values: Explore zero, infinity, NaN, subnormals, and boundary cases
  • Rounding modes: Implements IEEE 754 rounding modes (ties to even, ties away from zero, toward zero, toward +inf, and toward −inf)
  • Fixed-point mode: Set exponent bits to 0 for fractional representations
  • Shareable links: Bookmark or share a conversion via URL parameters (input/output format, value, and rounding mode)
  • Mobile-friendly: Works on screens of all sizes
  • WebMCP API: AI agents can perform conversions via WebMCP

Supported Formats

The following standard formats are supported, in addition to any custom format you define (up to 15 exponent bits and 112 mantissa bits). Interactive pages have been created to help explain and visualize each standard format:

MCP Server

The fp-conv-mcp npm package provides a local Model Context Protocol server, giving agents direct local access to floating point format conversions.

Example client configuration (VS Code, .vscode/mcp.json):

{
  "servers": {
    "fp-conv": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "fp-conv-mcp"]
    }
  }
}

See the package README for full usage, per-client setup, and debugging instructions.

Command-Line Tool

The fp-conv-cli npm package provides a cross-platform command-line version of the converter (Windows, macOS, and Linux), reusing the same conversion engine as the web app and MCP server. The installed command is fp-conv.

npx fp-conv-cli convert 3.14 --from fp32 --to fp16

It supports encode, decode, convert, info, and list commands with human-readable or --json output. See the package README for full usage and examples.

Development

See CONTRIBUTING.md for local setup, testing, linting, serving the site, and the oracle test-vector workflow.

License

MIT © 2026 Spencer Williams. See LICENSE.