Fixed Point Converter

Working with fixed point values? Need to translate fracts between binary and decimal quickly? We have a tool that makes this easy. This tool requires JavaScript to be enabled in your browser.

Compilers offer a variety of data types to make development easier. This saves developers from having to make manual conversions, and allows compilers to optimize mixed-type calculations intelligently.

Certain Byte Craft Limited compilers can use fixed point values: fractional values between 0 and 1 of various precisions, and "accumulator" values with both small integer components and fractional components.

While our compilers understand fixed point, other applications may not do so yet. Windows calculator, for instance, won't convert fractional portions of numbers. Even JavaScript's own Number type performs binary operations only on 32 integer bits.

So we wrote a tool that deals with TR 18037 fixed-point fractional and accumulator types. It converts between decimal and binary representations of fractional and "accumulator" values.

To use it, enter a decimal, hex (0x) or binary (0b) number in the top. Select between "signed" or "unsigned", and click a target data type.

  • If you entered a decimal value, select the type you want to convert to. The result will be padded or truncated accordingly.
  • If you entered a hex or decimal value, specify the type of the input value. The result will be decimal.

Click the type button repeatedly to change between representations.

We've found this tool most useful to internalize how the bit positions of fixed point values "work": most of us can do powers of two in our head--but only for positive exponents!

Note: This tool actually performs the calculations on your local machine.