Skip to main content
Call Eric:863-698-8266
CURRYCONTROLS.COMControls & Automation Knowledge Hub

PLC & Data

IEEE 754 Floating Point Inspector

Convert between a floating point value and its raw 32-bit representation, showing sign, exponent, mantissa, and the two Modbus registers in either word order.

Inputs

Calculated reference results

Value
12.5
Raw hex
0x41480000
Modbus registers, high word first
16712, 0

0x4148, 0x0000 — often called big-endian or ABCD

Modbus registers, low word first
0, 16712

Often called word-swapped or CDAB. Very common on field devices.

Sign bit
0 (positive)
Exponent
10000010 (130, unbiased 3)
Mantissa
10010000000000000000000
Full bit pattern
0 10000010 10010000000000000000000

The arithmetic

  1. 32-bit pattern: 0 10000010 10010000000000000000000
  2. High word (first 16 bits) = 16712, low word = 0
  3. Value = 12.5

What this does not account for

  • Modbus does not define word order for 32-bit values. If a float reads as a huge number, a near-zero number, or nonsense, try swapping the word order before assuming the device is faulty.
  • Some devices additionally swap bytes within each word, giving four possible arrangements. Read a value you already know, such as a flow rate shown on the device display, to identify which one applies.
  • Single precision carries about 7 significant decimal digits. Values above roughly 16.7 million stop resolving single units.

How this is calculated

An IEEE 754 single precision value occupies 32 bits: one sign bit, eight exponent bits, and 23 mantissa bits. Across a Modbus link it spans two 16-bit registers, and because the standard does not define which register comes first, the same 32 bits read as a completely different number if the word order is wrong.

Formulas

value = (-1)^sign x 1.mantissa x 2^(exponent - 127)

Assumptions and limitations built into this calculator

  • IEEE 754 single precision, 32 bits.
  • Register values are shown for the two common word orders. Byte-swapped variants exist and are not enumerated.

Frequently asked questions

My Modbus float reads as garbage. What is wrong?
Almost always word order. Swap the two 16-bit registers and read again. If it is still wrong, try swapping bytes within each word. Verify against a value the device displays locally.

Direct contact

Have a controls question?

Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.