What is scientific notation?

Scientific notation provides a compact way to write very large or very small numbers. Understanding scientific notation helps you grasp how floating-point numbers work - and crucially, their limitations.

Scientific notation follows this pattern: significand x 10^exponent. For example, 2.5 x 10^3 equals 2,500.

In C++, we use 'e' to represent "times 10 to the power of":

  • 2.5e3 means 2.5 x 10^3 = 2,500
  • 1.898e27 means 1.898 x 10^27
  • 3e-2 means 3 x 10^-2 = 0.03

Significant digits

The digits in the significand (the part before 'e') are called significant digits (or significant figures). More significant digits means greater precision.

  • 3.14 has 3 significant digits
  • 3.14159 has 6 significant digits
Key Concept
More digits in the significand equals greater precision.

Converting to scientific notation

Follow this procedure:

  1. Start with exponent zero
  2. Slide the decimal point until exactly one non-zero digit appears left of it
    • Each leftward movement increases the exponent by 1
    • Each rightward movement decreases the exponent by 1
  3. Remove leading zeros
  4. For trailing zeros:
    • Keep them if the original number had a decimal point
    • Remove them if the original number had no decimal point

Examples:

750.820 -> 7.50820e2 (6 significant digits)
0.0056300 -> 5.6300e-3 (5 significant digits)
85070 -> 8.507e4 (4 significant digits, trailing zero dropped)
85070. -> 8.5070e4 (5 significant digits, trailing zero kept due to decimal)

Why trailing zeros matter

When a number has a decimal point, trailing zeros indicate precision:

  • 125.0g means the measurement is precise to 0.1g
  • 125.000g means the measurement is precise to 0.001g

In scientific notation:

  • 125.0g = 1.250e2 (4 significant digits)
  • 125.000g = 1.25000e2 (6 significant digits)
Note
When C++ stores a floating-point number in memory, it stores just the value. There's no way to determine whether the original was 125.0 or 125.000 - both are stored as 125.

Now that we've covered scientific notation, we're ready to explore floating-point numbers.