Skip to main content
Glama

Floating Point Conversion Calculator

fp-conv-mcp fp-conv-cli Unit Tests

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 FP8 and 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)

  • Overflow behavior: Configurable overflow (Infinity/NaN vs. max normal).

  • NaN handling: Convert a NaN to the output's canonical quiet NaN, or keep its sign and payload as IEEE 754 §6.2.3 describes (details)

  • Fixed-point mode: Set exponent bits to 0 for fractional representations

  • Light and dark modes: Switch between light and dark themes based on your preference

  • Basic and advanced views: Additional details shown in advanced mode. Defaults based on the screen width until you choose

  • Shareable links: Bookmark or share a conversion via URL parameters (input/output format, value, rounding mode, overflow behavior, NaN handling, and view mode)

  • Mobile-friendly: Works on screens of all sizes

  • WebMCP API: AI agents can perform conversions via WebMCP

Related MCP server: DevKits MCP Server

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.

Available Tools

5 tools
convert_formatConvert formatA
Read-only

Convert a value or bit pattern from one floating-point or integer format to another. Returns full encoding details for both formats and precision loss analysis.

Inputs: inputFormat (required), outputFormat (required), bits, value, +3 more.

decode_bitsDecode bitsA
Read-only

Decode a binary or hexadecimal bit-pattern into a specified format. Returns the decimal value and full component breakdown.

Inputs: bits (required), format (required).

encode_numberEncode numberA
Read-only

Encode a decimal number (or special value like Infinity / NaN) into a specified floating-point or integer format. Returns binary, hex, and component breakdown.

Inputs: value (required), format (required), overflowMode, roundingMode.

get_format_infoGet format infoA
Read-only

Get detailed information about a floating-point or integer format, including value range (max/min normal, subnormal), bias, and special value support.

Inputs: format (required).

list_formatsList formatsA
Read-only

List all available floating-point and integer format presets supported by this converter. Returns format keys, names, categories, and parameters (bits, exponent, mantissa, etc.).

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct role: listing formats, encoding, decoding, converting between formats, and retrieving detailed format metadata. The only mild overlap is between list_formats and get_format_info, but the former is collection-level and the latter is single-format detail, so selection is unambiguous.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: list_formats, encode_number, decode_bits, convert_format, get_format_info. The convention is predictable throughout.

    Tool Count5/5

    Five tools are well-scoped for a floating-point format converter. The set covers discovery, metadata lookup, encoding, decoding, and conversion without redundant tools.

    Completeness5/5

    The tool surface covers the full lifecycle for this domain: discovering formats, inspecting format details, encoding values, decoding bit patterns, and converting between formats with precision-loss analysis. No obvious operational gap remains for a format converter.

    Maintenance

    ActivityActive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables comprehensive color manipulation, conversion between 22+ formats (HEX, RGB, HSL, CMYK, LAB, etc.), palette generation, gradient creation, and accessibility compliance checking. Supports framework-specific outputs for CSS, Swift, Android, Flutter, and Tailwind with high-precision conversions and visualization capabilities.
      25
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to perform accurate local computations including arbitrary-precision math, date handling, unit conversion, subnet calculations, encoding, hashing, and text analysis, all without network calls or API keys.
      27
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables LLMs to run arbitrary-precision integer and bitwise operations, endianness swaps, IEEE 754 float decomposition, hashing/checksum/modular math, data codecs, statistics, and trigonometry through 29 specialized tools. Its chained batch execution engine lets multiple dependent steps run in one call, eliminating multi-turn round-trip overhead.
      29
      16 npm
      20
      MIT