Skip to content
Sahithyan's S1 -- Programming Fundamentals

Floating-point Numbers

IEEE 754 standard.

2 types:

  • single precision
  • double precision

Single precision

Uses bits.

  • sign bit - bit
  • exponent - bit
  • mantissa - bit

Sign bit

if positive or zero. if negative.

Exponent

Exponent field range - . In this range is defined for normal numbers. and are reserved for subnormal, infinite, signed zeros and NaN.

To support negative exponents, (half of ) is subtracted from this range. . This range is the representable range.

Mantissa

In scientific notation, the part that doesn’t contain the base and the power.

In binary scientific notation, there will always be exactly one bit before the dot. So the inital is not included in the mantissa.

Double precision

Uses bits.

  • sign bit - bit
  • exponent - bit
  • mantissa - bit

Sign bit

if positive or zero. if negative.

Exponent

Exponent field range - . In this range is defined for normal numbers. and are reserved for subnormal, infinite, signed zeros and NaN.

To support negative exponents, (half of ) is subtracted from this range. . This range is the representable range.

Mantissa

In scientific notation, the part that doesn’t contain the base and the power.

In binary scientific notation, there will always be exactly one bit before the dot. So we don’t include that one.