Definition
Floating-Point Number Representation
Floating-point representation expresses a real number in the form
where
is the base, the exponent, and the mantissa (significand) written with digits in base . The mantissa is normalised: its leading digit is nonzero, so for that leading digit is necessarily and need not be stored — the binary implicit leading bit. The stored layout is a bit word partitioned into a sign bit, an exponent field, and the mantissa field. Floating-point is the standard number representation of real numbers on a computer, trading exactness for the ability to span a wide range of magnitudes with fixed storage.
Exponent Notation
A real number admits many decompositions
Non-unique decomposition
Every form is arithmetically equal; they differ only in where the radix point sits.
To make the representation unique in memory, the mantissa is normalised: exactly one nonzero digit sits before the radix point. The example then collapses to a single canonical form:
For
Layout
The first bit stores the sign of the represented number:
means positive, and means negative.
The exponent field stores the scale factor
IEEE 754
Definition
Link to originalIEEE 754
IEEE 754 is the dominant standard for floating-point number representation on computers, fixing
and a family of precisions via the parameter set Each format allocates a bit word into a one-bit sign, an exponent field of
bits, and a mantissa field of bits (the leading of a normalised mantissa is implicit, so only the fractional bits are stored). The exponent is encoded with an excess (bias) , so the stored bits represent .
Rounding
Rounding is important in numeric since computers can only store a certain number of bits, meaning a limited precision. There are multiple methods of rounding for floating point numbers.
Truncate
Truncating means removing a part of or the whole fractional part from a number.

Example: Truncating
Directed Rounding
Directed rounding refers to rounding an number in a specific direction:
- Round Towards Zero: Always rounds the number closer to zero.
- Round Away from Zero: Always rounds the number farther from zero.

Examples:
- Rounding Towards Zero:
- Round Away from Zero:
Round to Nearest
Rounding to the nearest refers to rounding a number to the closest value at a specified level of precision, such as the nearest integer, tenth, hundredth, or any other place value.

Precision of Rounding
