lab.faris0x.dev

Floating point toolkit

Convert values between number bases, normalise binary numbers, build a custom floating-point format, or inspect IEEE 754 single and double precision. The working is shown explicitly.

Floating point toolkit

Enter a value with an optional fractional part, for example 1011.101 or 2D.8.

Base conversion

Base 2

1011.101 exact

Base 8

13.5 exact

Base 10

11.625 exact

Base 16

B.A exact
LaTeX source
\documentclass[11pt]{article}
\usepackage[a4paper,margin=2.2cm]{geometry}
\usepackage{amsmath,amssymb}
\setlength{\parindent}{0pt}
\begin{document}
\section*{Floating point toolkit}
\section*{Base conversion}
Base 2: \texttt{1011.101}
Base 8: \texttt{13.5}
Base 10: \texttt{11.625}
Base 16: \texttt{B.A}
\end{document}

Bases and normalisation

Binary, octal, denary and hexadecimal conversions use exact integer and fractional arithmetic. Terminating expansions are shown in full; recurring expansions are marked with parentheses around the repeating block, and a truncated expansion ends with an ellipsis.

Normalising writes a binary value as ±1.xxxx × 2e. The sign, exponent and stored mantissa are reported separately.

Floating-point formats

A custom format uses one sign bit, a biased exponent and an implied leading 1. The bias is 2e−1 − 1, and the reserved top exponent represents infinity or NaN.

IEEE 754 uses 8 exponent bits and 23 fraction bits for single precision, or 11 exponent bits and 52 fraction bits for double precision. The toolkit reports the exact bit fields and the decoded value.

Export

Each result includes a export with the conversions, normalised form or bit fields, so the working can be copied or downloaded as a .tex file.