Scientific Notation

Primitive Data Types

Scientific Notation

🙋 Need help? Ask an expert now!

When working with large numbers, scientific notation is exceptionally helpful. In scientific notation, the letter 'e' represents "10 to the power of". For example, "1.51E+1" means the same thing as "1.51x10^1". Let's review some examples of scientific notation below.

ScientificNotationExample.java
package exlcode;

public class ScientificNotationExample {

  public static double exampleVariableOne = 1E+3;
  public static double exampleVariableTwo = 1E+12;
  public static double exampleVariableThree = 1E-4;

  public static void main(String[] args) {
    System.out.println(exampleVariableOne);
    System.out.println(exampleVariableTwo);
    System.out.println(exampleVariableThree);
  }
}

In the section on the long datatype, we discussed the difficulty of writing very large numbers. Scientific notation solves that problem. It can also be used to represent small numbers with many decimal places. The format of scientific notation in Java is exactly the same as you have learned and used in science and math classes. Remember that an uppercase 'E' or lowercase 'e' can be used to represent "10 to the power of". Scientific notation can be printed as output on the console if it passes a certain number. Using System.out.println(exampleVariableOne); as an example, smaller numbers will still read out "1000" instead of "1E+3".

Edit Me on GitHub!

Application Question

Which option below express 1000 in scientific notation?