    Next: Relational Operators Up: A quick tour of Previous: Intrinsic Numerical Operations   Contents

# Literal Constants

We can use value constants directly in the statements; such values are called literal constants.

For example, a number can be raised to an integer power

  Y = X**4 ; Z = X**(-6)

Both exponent values , are written directly in the source text.

For real constants, we need to use either decimal point notation or scientific notation (similar to floating point notation base 10: we have a mantissa, followed by an exponent of 10; the expenent is preceded by E)

  Y = X + 21.54    or    Y = X + 2.154E+1

For double precision constants, we always use scientific notation, but now the exponent marker E is replaced by D, from double:
  Y = X + 21.54D0  or   Y = X + 2.154D+1

For complex literal constants we need to specify a (real part, imaginary part) pair. To assign the number we do
  Z = ( 2.25, 4.1 )


Logical constants can take one of two values, written as

  Q = .TRUE.    or    Q = .FALSE.


Finally, character literal constants are delimited by single or double quotes

  C = 'A'   or     C = "A"


If the delimiter is part of the string, the convention is to write it twice inside the string, for example

  C = 'O''Malley'