Skip to main content
Engineering LibreTexts

5: Expressions

  • Page ID
    54205
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    This section describes how to form basic Fortran 95/2003/2008 expressions and perform arithmetic operations (i.e., add, subtract, multiple, divide, etc.). Expressions are formed using literals (actual values), variables, and operators (i.e., +, -, *, /, etc.). The previous chapter provides an explanation of what variables are and a summary of the five Fortran data types.

    • 5.1: Literals
      The simplest expression is a direct value, referred to as a literal. Since literals are actual values, not variables, they cannot be changed.
    • 5.2: Arithmetic Operations
      This section summarizes the basic arithmetic operations.
    • 5.3: Order of Operations
      Fortran follows the standard mathematical order of operations or precedence of operations. That is, multiplication and division are performed before addition and subtraction. Further, in accordance with mathematical standards, the exponentiation operation is performed before multiplication and division.
    • 5.4: Intrinsic Functions
      Intrinsic functions are standard built-in functions that are provided by Fortran. These include a rich set of standard functions, including the typical mathematical standard functions.
    • 5.5: Mixed Mode
      In general, mathematical operations should be performed on variables of the same type. When both integer and real values or variables are used in the same statement, it is called mixed mode.
    • 5.6: Examples
    • 5.7: Exercises


    This page titled 5: Expressions is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Ed Jorgensen via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?