\documentclass[twoside,10pt]{j3}
\renewcommand{\hdate}{26 September 2006}
\renewcommand{\vers}{J3/06-312}
\renewcommand{\draft}{}
\input pdftest
% AMS Math package
\usepackage[fleqn]{amsmath}
% Package for tables that can span page boundaries. I tried to put
% \RequirePackage{longtable} in j3.cls, but that caused a duplicate
% definition of the table counter.
\usepackage{longtable}
\setlength{\LTcapwidth}{5in} % LongTable caption width, default was 4in
% Specifications for indexing
\usepackage{index}
\makeindex
\newindex{r}{irr}{irp}{} % Index r, raw; index r, processed
% Get the multicol package, which is used for setting the indexes
\usepackage{multicol}
% Get the alltt package, which is used for verbatim text in \tt font.
\usepackage{alltt}
% Get graphicx package for encapsulated postscript figures.
\usepackage{graphicx}
% Use the ifthen package for complicated tests.
\usepackage{ifthen}
% Use the underscore package so we don't have to quote the accursed things
% all the time.
\usepackage[strings]{underscore}
\usepackage[UKenglish]{babel}
% Use the hyperref package for live links in pdf and dvi files.
% This must be the last package loaded.
% Setup is output-type-dependent
\input txtest
\input pdftest
% So now we set it up again, independent of output-type. Huh?
\hypersetup{%
hypertexnames=false,%
plainpages=false,%
linktocpage=true%
}
\usepackage{xr}
\externaldocument{foo}
% Available options
%\newboolean{EnhancedModules}
\newboolean{FeatureBITS}
\newboolean{FeatureBLOCK}
\newboolean{FeatureCoArrays}
\newboolean{FeatureMACROS}
% Set options...
%This option no longer exists.
%\setboolean{EnhancedModules}{true}
\setboolean{FeatureBITS}{true}
\setboolean{FeatureBLOCK}{true}
\setboolean{FeatureCoArrays}{true}
\setboolean{FeatureMACROS}{true}
%
% Option effects.
%
\def\Enabled{enabled}
\ifthenelse{\boolean{FeatureCoArrays}}
{\newcommand{\coarrays}[1]{#1}
\def\CoArrays{enabled} % Defined = enabled
\newcommand{\notcoarrays}[1]{}}
{\newcommand{\coarrays}[1]{}
\def\noCoArrays{} % Defined = empty (no CoArrays)
\newcommand{\notcoarrays}[1]{#1}}
\ifthenelse{\boolean{FeatureBITS}}
{\newcommand{\bits}[1]{#1}
\def\Bits{enabled} % Defined = enabled
\newcommand{\notbits}[1]{}}
{\newcommand{\bits}[1]{}
\def\noBits{} % Defined = empty (no Bits)
\newcommand{\notbits}[1]{#1}}
\ifthenelse{\boolean{FeatureBLOCK}}
{\newcommand{\block}[1]{#1}
\newcommand{\notblock}[1]{}}
{\newcommand{\block}[1]{}
\newcommand{\notblock}[1]{#1}}
\ifthenelse{\boolean{FeatureMACROS}}
{\newcommand{\macros}[1]{#1}
\newcommand{\notmacros}[1]{}}
{\newcommand{\macros}[1]{}
\newcommand{\notmacros}[1]{#1}}
\begin{document}
\hfuzz=1pt
\vfuzz=10pt
\raggedbottom % so we don't get gobs of white inside of pages
\vspace*{-40pt}
\begin{tabbing}
Subject: \hspace*{0.25in}\=Reorganization of Subclause 7.1\\
From: \>Van Snyder\\
\end{tabbing}
\vspace*{-20pt}
Every time I try to read about operations, it's really tedious because
they are defined in 7.1.2 and 7.1.3, the interpretations are given in
7.2, and the rules of evaluation are given in 7.1.8. The problem is that
the matrix was sliced in the wrong direction. In what follows, I've
moved {\secfont 7.3 Precedence of operators} to be after {\secfont 7.1.1
Form of an expression}, {\secfont 7.1.8.1 Evaluation of operations} to be
between that and {\secfont 7.1.2 Intrinsic operations}, each
``interpretation'' subclause from {\secfont 7.2 Interpretation of
operations} to be after the appropriate definition, and each
``evaluation'' subclause from {\secfont 7.1.8 Evaluation} to be after the
appropriate ``interpretation'' subclause. The only things I removed were
cross references that became unnecessary. I changed ``interpretation of
an expression has been established'' to ``interpretation of the \dots\
operation is established,'' and the wording of some cross references. If
this reorganization is done, it should be done after 06-296 is
considered. Here's the new outline for Clause 7:
\begin{enum}
\item[\ref{D7:Expressions}] Expressions
\begin{enum}
\setlength{\labelwidth}{36pt}
\item[\ref{D7:Form of an expression}] Form of an expression [unchanged]
\item[\ref{D7:Precedence of operators}] Precedence of operators [unchanged]
\item[\ref{D7:Evaluation of operations}] Evaluation of operations
\item[\ref{D7:Intrinsic operations}] Intrinsic operations
\begin{enum}
\setlength{\labelwidth}{44pt}
\item[\ref{D7:Numeric intrinsic operations}] Numeric intrinsic operations
\begin{enum}
\setlength{\labelwidth}{54pt}
\item[\ref{D7:Interpretation of numeric intrinsic operations}]
Interpretation of numeric intrinsic operations
\item[\ref{D7:Interpretation of numeric intrinsic operations}]
Interpretation of numeric intrinsic operations
\item[\ref{D7:Integer division}] Integer division
\item[\ref{D7:Complex exponentiation}] Complex exponentiation
\item[\ref{D7:Evaluation of numeric intrinsic operations}]
Evaluation of numeric intrinsic operations
\end{enum}
\item[\ref{D7:Character intrinsic operation}]
Character intrinsic operation
\begin{enum}
\setlength{\labelwidth}{54pt}
\item[\ref{D7:Interpretation of the character intrinsic operation}]
Interpretation of the character intrinsic operation
\item[\ref{D7:Evaluation of the character intrinsic operation}]
Evaluation of the character intrinsic operation
\end{enum}
\item[\ref{D7:Logical intrinsic operations}] Logical intrinsic operations
\begin{enum}
\setlength{\labelwidth}{54pt}
\item[\ref{D7:Interpretation of logical intrinsic operations}]
Interpretation of logical intrinsic operations
\item[\ref{D7:Evaluation of logical intrinsic operations}]
Evaluation of logical intrinsic operations
\end{enum}
\item[\ref{D7:Bits intrinsic operations}] Bits intrinsic operations
\begin{enum}
\setlength{\labelwidth}{54pt}
\item[\ref{D7:Interpretation of bits intrinsic operations}]
Interpretation of bits intrinsic operations
\item[\ref{D7:Evaluation of bits intrinsic operations}]
Evaluation of bits intrinsic operations
\end{enum}
\item[\ref{D7:Relational intrinsic operations}]
Relational intrinsic operations
\begin{enum}
\setlength{\labelwidth}{54pt}
\item[\ref{D7:Interpretation of relational intrinsic operations}]
Interpretation of relational intrinsic operations
\item[\ref{D7:Evaluation of relational intrinsic operations}]
Evaluation of relational intrinsic operations
\end{enum}
\end{enum}
\item[\ref{D7:Defined operations}] Defined operations
\begin{enum}
\setlength{\labelwidth}{44pt}
\item[\ref{D7:Interpretation of a defined operation}]
Interpretation of a defined operation
\item[\ref{D7:Evaluation of a defined operation}]
Evaluation of a defined operation
\end{enum}
\item[\ref{D7:Evaluation of operands}] Evaluation of operands [unchanged]
\item[\ref{D7:Integrity of parentheses}] Integrity of parentheses
[cross reference wording changed]
\item[\ref{D7:Type, type parameters, and shape of an expression}]
Type, type parameters, and shape of an expression [unchanged]
\item[\ref{D7:Conformability rules for intrinsic operations}]
Conformability rules for elemental operations [unchanged]
\item[\ref{D7:Specification expression}] Specification expression
[unchanged]
\item[\ref{D7:Initialization expression}] Initialization expression
[unchanged]
\end{enum}
\item[\ref{D7:Assignment}] Assignment [and all its subsubclauses] [unchanged]
\end{enum}
A clause with only two subclauses is kind of pathetic. Maybe we should
split clause {\secfont 7 Expressions and assignment} into clauses
{\secfont 7 Expressions} and {\secfont 8 Assignment}, which would increase
the clause number of each succeeding clause.
\newpage
\renewcommand{\draft}{Revised parts of Clause 7}
\setcounter{page}{137}
\setcounter{chapter}{6}
\setcounter{section}{1}
\setcounter{subsection}{1}
\chapter{Expressions and assignment}
[Text is unchanged.]
\divn\section{Expressions}
[Text is unchanged.]
\divn\subsection{Form of an expression}
[Text is unchanged.]
\divn\subsection{Precedence of operators}
[Was {\secfont 7.3}. Text is unchanged.]
\divn\subsection{Evaluation of operations}
[Was {\secfont 7.1.8.1}. Text is unchanged.]
\divn\subsection{Intrinsic operations}
\mindex{intrinsic operations|(}
An \tdef{intrinsic operation}\mindexd{operation!intrinsic} is either an
intrinsic unary operation or an intrinsic binary operation.
An \tdef{intrinsic unary operation} is an operation of the form
\si{intrinsic-operator}~$x_2$ where $x_2$ is of an intrinsic type
(\ref{D4:Intrinsic types}) listed in Table
\ref{T:Type of operands and results for intrinsic binary operators} for
the unary intrinsic operator.
An \tdef{intrinsic binary operation} is an operation of the form $x_1$
~\si{intrinsic-operator}~$x_2$ where $x_1$ and $x_2$ are of the
intrinsic types (\ref{D4:Intrinsic types}) listed in Table
\ref{T:Type of operands and results for intrinsic binary operators} for
the binary intrinsic operator and are in shape conformance
(\ref{D7:Conformability rules for intrinsic operations}).
The interpretations defined in subclause \ref{D7:Intrinsic operations}
apply to both scalars and arrays; the interpretation for arrays is
obtained by applying the interpretation for scalars element by element.
The type, type parameters and interpretation of an expression that
consists of an intrinsic operation are independent of the type and type
parameters of the context or any larger expression in which it appears.
\begin{note}
For example, if X is of type real, J is of type integer, and INT is the
real-to-integer intrinsic conversion function, the expression INT~(X~+~J)
is an integer expression and X~+~J is a real expression.
\end{note}
\begin{longtable}{|cccc|}
% Label isn't the same as the caption, so \jcaption can't be used
\caption{\label{T:Type of operands and results for intrinsic binary
operators}\textbf{Type of operands and results for intrinsic operators}}\\[-10pt]
\hline
Intrinsic operator & Type of & Type of & Type of \\
\st{op} & $x_1$ & $x_2$ & $[x_1]$ \st{op} $x_2$\\
\hline
& & & \\[-10pt]
\hline
\endfirsthead
\ccaption{Type of operands and results for intrinsic operators}\\[-10pt]
\hline
Intrinsic operator & Type of & Type of & Type of \\
\st{op} & $x_1$ & $x_2$ & $[x_1]$ \st{op} $x_2$\\
\hline
& & & \\[-10pt]
\hline
\endhead
Unary +, -- & & I, R, Z & I, R, Z \\
\hline
& I & I, R, Z & I, R, Z \\
Binary +, --, *, /, ** & R & I, R, Z & R, R, Z \\
& Z & I, R, Z & Z, Z, Z \\
\hline
// & C & C & C \\
\bits{ & B & B & B \\ }
\hline
\notbits{ & I & I, R, Z & L, L, L \\ }
\notbits{.EQ., .NE., & R & I, R, Z & L, L, L \\ }
\notbits{==, /= & Z & I, R, Z & L, L, L \\ }
\bits{ & I & I, R, Z, B & L, L, L, L \\ }
\bits{.EQ., .NE., & R & I, R, Z, B & L, L, L, L \\ }
\bits{==, /= & Z & I, R, Z, B & L, L, L, L \\ }
& C & C & L \\
\hline
& I & I, R & L, L \\
.GT., .GE., .LT., .LE. & R & I, R & L, L \\
$>$, $>$=, $<$, $<$= & C & C & L \\
\hline
\notbits{.NOT. & & L & L \\ }
\bits{.NOT. & & L, B & L, B \\ }
\hline
\notbits{.AND., .OR., .EQV., .NEQV. & L & L & L \\ }
\bits{ & L & L & L \\ }
\bits{.AND., .OR., .EQV., .NEQV. & B & B,I & B \\ }
\bits{ & I & B & B \\ }
\hline
\multicolumn{4}{|l|}{
Note: \parbox[t]{4.5in}{The symbols I, R, Z, C,
\notbits{and L}\bits{L, and B} stand for the types
integer, real, complex, character,
\notbits{and logical}\bits{logical, and bits}, respectively.
Where more than one type for $x_{2}$ is given, the type of the
result of the operation is given in the same relative position in
the next column. For the intrinsic operators with operands of
type character, the kind type parameters of the operands shall be
the same.}
}\\
\hline
\end{longtable}
\divn\subsubsection{Numeric intrinsic operations}
\mindex{numeric intrinsic operation}\mindex{operation!numeric intrinsic}
A \tdef{numeric intrinsic operation} is an intrinsic operation for which
the \si{intrinsic-operator} is a numeric operator (+, --, *, /, or **).
A \tdef{numeric intrinsic operator} is the operator in a numeric
intrinsic operation.
\divn\paragraph{Interpretation of numeric intrinsic operations}
The two operands of numeric intrinsic binary operations may be of
different numeric types or different kind type parameters. Except for a
value raised to an integer power, if the operands have different types or
kind type parameters, the effect is as if each operand that differs in
type or kind type parameter from those of the result is converted to the
type and kind type parameter of the result before the operation is
performed. When a value of type real or complex is raised to an integer
power, the integer operand need not be converted.
A numeric operation is used to express a numeric computation. Evaluation
of a numeric operation produces a numeric value. The permitted data
types for operands of the numeric intrinsic operations are specified in
\ref{D7:Intrinsic operations}.
The numeric operators and their interpretation in an expression are given
in Table \ref{T:Interpretation of the numeric intrinsic operators}, where
$x_{1}$ denotes the operand to the left of the operator and $x_{2}$
denotes the operand to the right of the operator.
\begin{longtable}{|clcl|}
\jcaption{Interpretation of the numeric intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endfirsthead
\ccaption{Interpretation of the numeric intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endhead
\kw*{**} & Exponentiation & $x_1$ ** $x_2$ & Raise $x_1$ to the power $x_2$\\
\kw*{/} & Division & $x_1$ / $x_2$ & Divide $x_1$ by $x_2$\\
\kw*{*} & Multiplication & $x_1$ * $x_2$ & Multiply $x_1$ by $x_2$\\
\kw*{-} & Subtraction & $x_1$ - $x_2$ & Subtract $x_2$ from $x_1$\\
- & Negation & - $x_2$ & Negate $x_2$\\
\kw*{+} & Addition & $x_1$ + $x_2$ & Add $x_1$ and $x_2$\\
+ & Identity & + $x_2$ & Same as $x_2$\\
\hline
\end{longtable}
The interpretation of a division operation depends on the types of the
operands (\ref{D7:Integer division}).
If $x_{1}$ and $x_{2}$ are of type integer and $x_{2}$ has a negative
value, the interpretation of $x_{1}$~**~$x_{2}$ is the same as the
interpretation of 1/($x_{1}$~**~ABS~($x_{2}$)), which is subject to the
rules of integer division (\ref{D7:Integer division}).
\begin{note}
For example, 2~**~(--3) has the value of 1/(2~**~3), which is zero.
\end{note}
\divn\paragraph{Integer division}
One operand of type integer may be divided by another operand of type
integer. Although the mathematical quotient of two integers is not
necessarily an integer, Table \ref{T:Type of operands and results for
intrinsic binary operators} specifies that an expression involving the
division operator with two operands of type integer is interpreted as an
expression of type integer. The result of such an operation is the
integer closest to the mathematical quotient and between zero and the
mathematical quotient inclusively.
\begin{note}
For example, the expression (--8) /~3 has the value (--2).
\end{note}
\divn\paragraph{Complex exponentiation}
In the case of a complex value raised to a complex power, the value of
the operation $x_{1}$~**~$x_{2}$ is the principal value of
$x_{1}^{x_{2}}$.
\divn\paragraph{Evaluation of numeric intrinsic operations}
Once the interpretation of a numeric intrinsic operation is established,
the processor may evaluate any mathematically equivalent expression,
provided that the integrity of parentheses is not violated.
Two expressions of a numeric type are mathematically equivalent if, for
all possible values of their primaries, their mathematical values are
equal. However, mathematically equivalent expressions of numeric type
may produce different computational results.
\begin{note}
Any difference between the values of the expressions (1./3.)*3. and 1. is
a computational difference, not a mathematical difference. The
difference between the values of the expressions 5/2 and 5./2. is a
mathematical difference, not a computational difference.
The mathematical definition of integer division is given in
\ref{D7:Integer division}.
\end{note}
\begin{note}
The following are examples of expressions with allowable alternative
forms that may be used by the processor in the evaluation of those
expressions. A, B, and C represent arbitrary real or complex operands; I
and J represent arbitrary integer operands; and X, Y, and Z represent
arbitrary operands of numeric type.
\begin{longtable}{p{0.25in} p{3.00in} lll}
& \dul{Expression} & \dul{Allowable alternative form} \\
\endfirsthead
& \dul{Expression} & \dul{Allowable alternative form} \\
\endhead
& X + Y & Y + X \\
& X * Y & Y * X \\
& -X + Y & Y - X \\
& X + Y + Z & X + (Y + Z) \\
& X - Y + Z & X - (Y - Z) \\
& X * A / Z & X * (A / Z) \\
& X * Y - X * Z & X * (Y - Z) \\
& A / B / C & A / (B * C) \\
& A / 5.0 & 0.2 * A \\
\end{longtable}
The following are examples of expressions with forbidden alternative
forms that shall not be used by a processor in the evaluation of those
expressions.
\begin{tabular}{p{0.25in} p{3.00in} lll}
& \dul{Expression} & \dul{Forbidden alternative form} \\
& I / 2 & 0.5 * I \\
& X * I / J & X * (I / J) \\
& I / J / A & I / (J * A) \\
& (X + Y) + Z & X + (Y + Z) \\
& (X * Y) - (X * Z) & X * (Y - Z) \\
& X * (Y - Z) & X * Y - X * Z \\
\end{tabular}
\end{note}
The execution of any numeric operation whose result is not defined by the
arithmetic used by the processor is prohibited.
Raising a negative-valued primary of type real to a real power is prohibited.
In addition to the parentheses required to establish the desired
interpretation, parentheses may be included to restrict the alternative
forms that may be used by the processor in the actual evaluation of the
expression. This is useful for controlling the magnitude and accuracy of
intermediate values developed during the evaluation of an expression.
\begin{note}
For example, in the expression
\begin{alltt}
A + (B - C)
\end{alltt}
the parenthesized expression (B -- C) shall be evaluated and then added
to A.
The inclusion of parentheses may change the mathematical value of an
expression. For example, the two expressions
\begin{alltt}
A * I / J
A * (I / J)
\end{alltt}
may have different mathematical values if I and J are of type integer.
\end{note}
Each operand in a numeric intrinsic operation has a type that may
depend on the order of evaluation used by the processor.
\begin{note}
For example, in the evaluation of the expression
\begin{alltt}
Z + R + I
\end{alltt}
where Z, R, and I represent data objects of complex, real, and integer
type, respectively, the type of the operand that is added to I
may be either complex or real, depending on which pair of operands (Z and
R, R and I, or Z and I) is added first.
\end{note}
\divn\subsubsection{Character intrinsic operation}
The \tdef{character intrinsic operation} is the intrinsic operation for which
the \si{intrinsic-operator} is (//) and both operands are of type character.
The operands shall have the same kind type parameter.
The \tdef{character intrinsic operator} is the operator in a character
intrinsic operation.
\divn\paragraph{Interpretation of the character intrinsic operation}
The character intrinsic operator // is used to concatenate two operands
of type character with the same kind type parameter. Evaluation of the
character intrinsic operation produces a result of type character.
The interpretation of the character intrinsic operator // when used to
form an expression is given in Table
\ref{T:Interpretation of the character intrinsic operator //},
where $x_{1}$ denotes the operand to the
left of the operator and $x_{2}$ denotes the operand to the right of the
operator.
\begin{longtable}{|clcl|}
\jcaption{Interpretation of the character intrinsic operator //}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endhead
\kw*{//} & Concatenation & $x_1$ // $x_2$ & Concatenate $x_1$ with $x_2$ \\
\hline
\end{longtable}
The result of the character intrinsic operation // is a character string
whose value is the value of $x_1$ concatenated on the right with the
value of $x_2$ and whose length is the sum of the lengths of $x_1$
and $x_2$. Parentheses used to specify the order of evaluation have no
effect on the value of a character expression.
\begin{note}
For example, the value of ('AB'~ //~'CDE')~ //~'F' is the string
'ABCDEF'. Also, the value of 'AB'~ //~('CDE'~ //~ 'F') is the string
'ABCDEF'.
\end{note}
\divn\paragraph{Evaluation of the character intrinsic operation}
A processor is only required to evaluate as much of the character
intrinsic operation as is required by the context in which the expression
appears.
\begin{note}
For example, the statements
\begin{alltt}
CHARACTER (LEN = 2) C1, C2, C3, CF
C1 = C2 // CF (C3)
\end{alltt}
do not require the function CF to be evaluated, because only the value of
C2 is needed to determine the value of C1 because C1 and C2 both have a
length of 2.
\end{note}
\divn\subsubsection{Logical intrinsic operations}
\mindex{logical intrinsic operation}\mindex{operation!logical intrinsic}
A \tdef{logical intrinsic operation} is an intrinsic operation for which the
\si{intrinsic-operator} is .AND., .OR., .XOR., .NOT., .EQV., or .NEQV. and both
operands are of type logical.
A \tdef{logical intrinsic operator} is the operator in a logical intrinsic
operation.
\divn\paragraph{Interpretation of logical intrinsic operations}
A logical operation is used to express a logical computation. Evaluation
of a logical operation produces a result of type logical. The permitted
types for operands of the logical intrinsic operations are specified
in \ref{D7:Intrinsic operations}.
The logical operators and their interpretation when used to form an
expression are given in Table \ref{T:Interpretation of the logical
intrinsic operators}, where $x_1$ denotes the operand to the left of
the operator and $x_2$ denotes the operand to the right of the
operator.
\begin{longtable}{|lm{1.875in}lm{2in}|}
\jcaption{Interpretation of the logical intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endfirsthead
\ccaption{Interpretation of the logical intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endhead
\kw*{.NOT.} & Logical negation & .NOT. $x_2$ & True if $x_2$ is false\\
\kw*{.AND.} & Logical conjunction & $x_1$ .AND. $x_2$ & True if $x_1$ and
$x_2$ are both true\\
\kw*{.OR.} & Logical inclusive disjunction & $x_1$ .OR. $x_2$ & True if $x_1$ and/or
$x_2$ is true\\
\kw*{.EQV.} & Logical equivalence & $x_1$ .EQV. $x_2$ & True if both $x_1$ and $x_2$
are true or both are false\\
\kw*{.NEQV.} & Logical nonequivalence & $x_1$ .NEQV. $x_2$ & True if either $x_1$ or
$x_2$ is true, but not both\\
\bits{\kw*{.XOR.} & Logical nonequivalence & $x_1$ .XOR. $x_2$ & True if either $x_1$ or
$x_2$ is true, but not both\\}
\hline
\end{longtable}
The values of the logical intrinsic operations are shown in Table
\ref{T:The values of operations involving logical intrinsic operators}.
\notbits{
\begin{longtable}{|ccccccc|}
\jcaption{The values of operations involving logical intrinsic operators}\\[-10pt]
\hline
$x_1$ & $x_2$ & .NOT. $x_2$ & $x_1$ .AND. $x_2$ & $x_1$ .OR. $x_2$ & $x_1$ .EQV. $x_2$ & $x_1$ .NEQV. $x_2$\\
\hline
& & & & & & \\[-10pt]
\hline
\endfirsthead
\ccaption{The values of operations involving logical intrinsic operators}\\[-10pt]
\hline
$x_1$ & $x_2$ & .NOT. $x_2$ & $x_1$ .AND. $x_2$ & $x_1$ .OR. $x_2$ & $x_1$ .EQV. $x_2$ & $x_1$ .NEQV. $x_2$\\
\hline
& & & & & & \\[-10pt]
\hline
\endhead
true & true & false & true & true & true & false \\
true & false & true & false & true & false & true \\
false & true & false & false & true & false & true \\
false & false & true & false & false & true & false \\
\hline
\end{longtable}
}
\bits{
\begin{longtable}{|cccccccc|}
\jcaption{The values of operations involving logical intrinsic operators}\\[-10pt]
\hline
$x_1$ & $x_2$ & .NOT. $x_2$ & $x_1$ .AND. $x_2$ & $x_1$ .OR. $x_2$ & $x_1$ .EQV. $x_2$ & $x_1$ .NEQV. $x_2$ & $x_1$ .XOR. $x_2$ \\
\hline
& & & & & & & \\[-10pt]
\hline
\endfirsthead
\ccaption{The values of operations involving logical intrinsic operators}\\[-10pt]
\hline
$x_1$ & $x_2$ & .NOT. $x_2$ & $x_1$ .AND. $x_2$ & $x_1$ .OR. $x_2$ & $x_1$ .EQV. $x_2$ & $x_1$ .NEQV. $x_2$ & $x_1$ .XOR. $x_2$ \\
\hline
& & & & & & & \\[-10pt]
\hline
\endhead
true & true & false & true & true & true & false & false \\
true & false & true & false & true & false & true & true \\
false & true & false & false & true & false & true & true \\
false & false & true & false & false & true & false & false \\
\hline
\end{longtable}
}
\divn\paragraph{Evaluation of logical intrinsic operations}
Once the interpretation of a logical intrinsic operation is established,
the processor may evaluate any other expression that is logically
equivalent, provided that the integrity of parentheses in any expression
is not violated.
\begin{note}
For example, for the variables L1, L2, and L3 of type logical, the
processor may choose to evaluate the expression
\begin{alltt}
L1 .AND. L2 .AND. L3
\end{alltt}
as
\begin{alltt}
L1 .AND. (L2 .AND. L3)
\end{alltt}
\end{note}
Two expressions of type logical are logically equivalent if their values
are equal for all possible values of their primaries.
\bits{
\divn\subsubsection{Bits intrinsic operations}
\mindex{bits intrinsic operation}\mindex{operation!intrinsic bits}
A \tdef{bits intrinsic operation} is an intrinsic operation for which the
\si{intrinsic-operator} is //, .AND., .OR., .XOR., .NOT., .EQV., or .NEQV. and
at least one operand is of type bits.
A \tdef{bits intrinsic operator} is the operator in a bits intrinsic operation.
\divn\paragraph{Interpretation of bits intrinsic operations}
For bits intrinsic operations other than concatenation (//), the two operands
may be of different types or different kind type parameters. The effect is as
if each operand that differs in type or kind type parameter from those of the
result is converted to the type and kind type parameter of the result before
the operation is performed.
Bit operations are used to express bitwise operations on sequences of bits, or
to concatenate such sequences. Evaluation of a bits operation produces a
result of type bits. The permitted types of operands of the bits intrinsic
operations are specified in \ref{D7:Intrinsic operations}.
The bits operators and their interpretation when used to form an expression are
given in Table \ref{T:Interpretation of the bits intrinsic operators}, where
$x_1$ denotes the operand of type bits to the left of the operator and $x_2$
denotes the operand of type bits to the right of the operator.
%\begin{longtable}{|lm{1.375in}lm{2.4in}|}
\begin{longtable}{|clcl|}
\jcaption{Interpretation of the bits intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endfirsthead
\ccaption{Interpretation of the bits intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endhead
\kw*(//) & Concatenation & $x_1$ // $x_2$ & Concatenation of $x_1$ and $x_2$ \\
\kw*{.NOT.} & Bitwise NOT & .NOT. $x_2$ & Bitwise NOT of $x_2$ \\
\kw*{.AND.} & Bitwise AND & $x_1$ .AND. $x_2$ & Bitwise AND of $x_1$ and $x_2$ \\
\kw*{.OR.} & Bitwise inclusive OR & $x_1$ .OR. $x_2$ & Bitwise OR of $x_1$ and $x_2$ \\
\kw*{.EQV.} & Bitwise equivalence & $x_1$ .EQV. $x_2$ & Bitwise equivalence of $x_1$ and $x_2$ \\
\kw*{.NEQV.} & Bitwise nonequivalence & $x_1$ .NEQV. $x_2$ & Bitwise nonequivalence of $x_1$ and $x_2$ \\
\kw*{.XOR.} & Bitwise exclusive OR & $x_1$ .XOR. $x_2$ & Bitwise exclusive OR of $x_1$ and $x_2$ \\
\hline
\end{longtable}
The leftmost KIND($x_1$) bits of the result of the bits concatenation operation
are the value of $x_1$ and the rightmost KIND($x_2$) bits of the result are the
value of $x_2$.
For a bits intrinsic operation other than //, the result value is computed
separately for each pair of bits at corresponding positions in each operand.
The value of each bit operation, for bits denoted $b_1$ and $b_2$ are given in
Table \ref{T:The values of bits intrinsic operations other than //}.
\begin{longtable}{|cccccccc|}
\jcaption{The values of bits intrinsic operations other than //}\\[-10pt]
\hline
$x_1$ & $x_2$ & .NOT. $x_2$ & $x_1$ .AND. $x_2$ & $x_1$ .OR. $x_2$ & $x_1$ .EQV. $x_2$ & $x_1$ .NEQV. $x_2$ & $x_1$ .XOR. $x_2$ \\
\hline
& & & & & & & \\[-10pt]
\hline
\endfirsthead
\ccaption{The values of bits intrinsic operations other than //}\\[-10pt]
\hline
$x_1$ & $x_2$ & .NOT. $x_2$ & $x_1$ .AND. $x_2$ & $x_1$ .OR. $x_2$ & $x_1$ .EQV. $x_2$ & $x_1$ .NEQV. $x_2$ & $x_1$ .XOR. $x_2$ \\
\hline
& & & & & & & \\[-10pt]
\hline
\endhead
1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 \\
1 & 0 & 1 & 0 & 1 & 0 & 1 & 1 \\
0 & 1 & 0 & 0 & 1 & 0 & 1 & 1 \\
0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\
\hline
\end{longtable}
}%bits
\bits{
\divn\paragraph{Evaluation of bits intrinsic operations}
Once the interpretation of a bits operation is established, the processor
may evaluate any other expression that is computationally equivalent,
provided that the integrity of parentheses in any expression is not
violated.
}%bits
\ifx \Bits \Enabled
\begin{note}
For example, for the variables B1, B2, and B3 of type bits, the processor may
choose to evaluate the expression
\begin{alltt}
B1 .XOR. B2 .XOR. B3
\end{alltt}
as
\begin{alltt}
B1 .XOR. (B2 .XOR. B3)
\end{alltt}
\end{note}
\else
\noBits
\fi % Bits enabled
\bits{%
Two expressions of type bits are computationally equivalent if their
values are equal for all possible values of their primaries.
}%bits
\divn\subsubsection{Relational intrinsic operations}
\mindex{relational intrinsic operation}\mindex{operation!relational intrinsic}
A \tdef{relational intrinsic operator} is an \si{intrinsic-operator} that is
.EQ., .NE., .GT., .GE., .LT., .LE., ==, /=, $>$, $>$=, $<$, or $<$=.
The operators $<$, $<$=, $>$, $>$=, ==, and /= always
have the same interpretations as the operators .LT., .LE., .GT., .GE.,
.EQ., and .NE., respectively.
A \tdef{relational intrinsic operation} is an intrinsic operation for
which the \si{intrinsic-operator} is a relational intrinsic operator.
A \tdef{numeric relational intrinsic operation} is a relational intrinsic
operation for which both operands are of numeric type.
A \tdef{character relational intrinsic operation} is a relational
intrinsic operation for which both operands are of type character. The
kind type parameters of the operands of a character relational intrinsic
operation shall be the same.
\bits{A \tdef{bits relational intrinsic operation} is a relational
intrinsic operation for which at least one of the operands is of type
bits.}
\bits{%
If both operands of a bits relational operation do not have the same
kind type parameter, the operand with the smaller kind type parameter is
converted to the same kind as the other operand. If one operand of a bits
relational operation is not of type bits, it is converted to type bits
with the same kind type parameter as the other operand. Any conversion
takes place before the operation is evaluated.
}% bits
\divn\paragraph{Interpretation of relational intrinsic operations}
A relational intrinsic operation is used to compare values of two
operands using the relational intrinsic operators .LT., .LE., .GT., .GE.,
.EQ., .NE., $<$, $<$=, $>$, $>$=, ==, and /=. The permitted types
for operands of the relational intrinsic operators are specified in
\ref{D7:Intrinsic operations}.
\begin{note}
As shown in Table \ref{T:Type of operands and results for intrinsic
binary operators}, a relational intrinsic operator cannot be used to
compare the value of an expression of a numeric type with one of type
character or logical. Also, two operands of type logical cannot be
compared, a complex operand may be compared with another numeric operand
only when the operator is .EQ., .NE., ==, or /=, and two character
operands cannot be compared unless they have the same kind type parameter
value.
\end{note}
Evaluation of a relational intrinsic operation produces a result of type
default logical.
The interpretation of the relational intrinsic operators is given in
Table \ref{T:Interpretation of the relational intrinsic operators}, where
$x_1$ denotes the operand to the left of the operator and $x_2$
denotes the operand to the right of the operator.
\begin{longtable}{|clcl|}
\jcaption{Interpretation of the relational intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endfirsthead
\ccaption{Interpretation of the relational intrinsic operators}\\[-10pt]
\hline
Operator & Representing & Use of operator & Interpretation\\
\hline
& & & \\[-10pt]
\hline
\endhead
\kw*{.LT.} & Less than & $x_1$ .LT. $x_2$ & $x_1$ less than $x_2$\\
\kw*{$<$} & Less than & $x_1$ $<$ $x_2$ & $x_1$ less than $x_2$\\
\kw*{.LE.} & Less than or equal to & $x_1$ .LE. $x_2$ & $x_1$ less than
or equal to $x_2$\\
\kw*{$<$=} & Less than or equal to & $x_1$ $<$= $x_2$ & $x_1$ less than
or equal to $x_2$\\
\kw*{.GT.} & Greater than & $x_1$ .GT. $x_2$ & $x_1$ greater than $x_2$\\
\kw*{$>$} & Greater than & $x_1$ $>$ $x_2$ & $x_1$ greater than $x_2$\\
\kw*{.GE.} & Greater than or equal to & $x_1$ .GE. $x_2$ & $x_1$ greater than or
equal to $x_2$\\
\kw*{$>$=} & Greater than or equal to & $x_1$ $>$= $x_2$ & $x_1$ greater than or
equal to $x_2$\\
\kw*{.EQ.} & Equal to & $x_1$ .EQ. $x_2$ & $x_1$ equal to $x_2$\\
\kw*{==} & Equal to & $x_1$ == $x_2$ & $x_1$ equal to $x_2$\\
\kw*{.NE.} & Not equal to & $x_1$ .NE. $x_2$ & $x_1$ not equal to $x_2$\\
\kw*{/=} & Not equal to & $x_1$ /= $x_2$ & $x_1$ not equal to $x_2$\\
\hline
\end{longtable}
A numeric relational intrinsic operation is interpreted as having the logical
value true if and only if the values of the operands satisfy the relation
specified by the operator.
In the numeric relational operation
\begin{tabular}{p{0.25in} p{1.75in} p{1.25in} lll}
& $x_1$ \si{rel-op} $x_2$ \\
\end{tabular}
if the types or kind type parameters of $x_1$ and $x_2$ differ, their
values are converted to the type and kind type parameter of the
expression $x_1$~+~ $x_2$ before evaluation.
A character relational intrinsic operation is interpreted as having the logical
value true if and only if the values of the operands satisfy the relation
specified by the operator.
For a character relational intrinsic operation, the operands are compared
one character at a time in order, beginning with the first character of
each character operand. If the operands are of unequal length, the
shorter operand is treated as if it were extended on the right with
blanks to the length of the longer operand. If both $x_1$ and $x_2$
are of zero length, $x_1$ is equal to $x_2$; if every character of
$x_1$ is the same as the character in the corresponding position in
$x_2$, $x_1$ is equal to $x_2$. Otherwise, at the first position
where the character operands differ, the character operand $x_1$ is
considered to be less than $x_2$ if the character value of $x_1$ at
this position precedes the value of $x_2$ in the collating sequence
(\ref{D4:Collating sequence}); $x_1$ is greater than $x_2$ if the
character value of $x_1$ at this position follows the value of $x_2$
in the collating sequence.
\begin{note}
The collating sequence depends partially on the processor; however, the
result of the use of the operators .EQ., .NE., ==, and /= does not depend
on the collating sequence.
For nondefault character types, the blank padding character is processor
dependent.
\end{note}
\bits{
A bits relational intrinsic operation is interpreted as having the logical
value true if and only if the values of the operands satisfy the relation
specified by the operator.
For a bits relational intrinsic operation, $x_1$ and $x_2$ are equal if and
only if each corresponding bit has the same value. If $x_1$ and $x_2$ are not
equal, and the leftmost unequal corresponding bit of $x_1$ is 1 and $x_2$ is 0
then $x_1$ is greater than $x_2$; otherwise $x_1$ is less than $x_2$.
}%bits
\divn\paragraph{Evaluation of relational intrinsic operations}
Once the interpretation of a relational intrinsic operation is
established, the processor may evaluate any other expression that is
relationally equivalent, provided that the integrity of parentheses in any
expression is not violated.
\begin{note}
For example, the processor may choose to evaluate the expression
\begin{alltt}
I > J
\end{alltt}
where I and J are integer variables, as
\begin{alltt}
J - I < 0
\end{alltt}
\end{note}
Two relational intrinsic operations are relationally equivalent if their
logical values are equal for all possible values of their primaries.
\mindex{intrinsic operations|)}
\divn\subsection{Defined operations}
A \tdef{defined operation}\mindexd{operation!defined} is either a defined unary
operation or a defined binary operation.
A \tdef{defined unary operation} is an operation that has the form
\si{defined-unary-op}~ $x_2$ or \si{intrinsic-operator}~ $x_2$ and that is
defined by a function and a generic interface
(\ref{D4:Derived-type definition}, \ref{D12:Generic interfaces}).
A function defines the unary operation \emph{op}~$x_2$ if
\begin{enum}
\item the function is specified with a FUNCTION (\ref{D12:Function
subprogram}) or ENTRY (\ref{D12:ENTRY statement}) statement that
specifies one dummy argument $d_2$,
\item either
\begin{enum}
\item a generic interface (\ref{D12:Interface block}) provides the
function with a \si{generic-spec} of OPERATOR~(\st{op}), or
\item there is a generic binding (\ref{D4:Derived-type
definition}) in the declared type of $x_2$ with a
\si{generic-spec} of OPERATOR~(\st{op}) and there is a corresponding
binding to the function in the dynamic type of $x_2$,
\end{enum}
\item the type of $d_2$ is compatible with the dynamic type of $x_2$,
\item the type parameters, if any, of $d_2$ match the corresponding
type parameters of $x_2$, and
\item either
\begin{enum}
\item the rank of $x_2$ matches that of $d_2$ or
\item the function is elemental and there is no other function that
defines the operation.
\end{enum}
\end{enum}
If $d_2$ is an array, the shape of $x_2$ shall match the shape of $d_2$.
A \tdef{defined binary operation} is an operation that has the form
$x_1$~\si{defined-binary-op}~$x_2$ or $x_1$ \si{intrinsic-operator}
$x_{2}$ and that is defined by a function and a generic interface.
A function defines the binary operation $x_1$~\emph{op}~$x_2$ if
\begin{enum}
\item the function is specified with a FUNCTION (\ref{D12:Function
subprogram}) or ENTRY (\ref{D12:ENTRY statement}) statement that
specifies two dummy arguments, $d_1$ and $d_2$,
\item either
\begin{enum}
\item a generic interface (\ref{D12:Interface block}) provides the
function with a \si{generic-spec} of OPERATOR~ (\st{op}), or
\item there is a generic binding (\ref{D4:Derived-type
definition}) in the declared type of $x_1$ or $x_2$ with a
\si{generic-spec} of OPERATOR~(\st{op}) and there is a corresponding
binding to the function in the dynamic type of $x_1$ or $x_2$,
respectively,
\end{enum}
\item the types of $d_1$ and $d_2$ are compatible with the dynamic
types of $x_1$ and $x_2$, respectively,
\item the type parameters, if any, of $d_1$ and $d_2$ match the
corresponding type parameters of $x_1$ and $x_2$, respectively, and
\item either
\begin{enum}
\item the ranks of $x_1$ and $x_2$ match those of $d_1$ and $d_2$ or
\item the function is elemental, $x_1$ and $x_2$ are conformable,
and there is no other function that defines the operation.
\end{enum}
\end{enum}
If $d_1$ or $d_2$ is an array, the shapes of $x_1$ and $x_2$ shall match
the shapes of $d_1$ and $d_2$, respectively.
\begin{note}
An intrinsic operator may be used as the operator in a defined operation.
In such a case, the generic properties of the operator are extended.
\end{note}
An \tdef{extension operation}\mindex{operation!extension} is a defined
operation in which the operator is of the form \si{defined-unary-op} or
\si{defined-binary-op}.
Such an operator is called an \tdef{extension operator}.
The operator used in an extension operation may be such that a generic
interface for the operator may specify more than one function.
A \tdef{defined elemental operation} is a defined operation for which the
function is elemental (\ref{D12:Elemental procedures}).
\divn\subsubsection{Interpretation of a defined operation}
The interpretation of a defined operation is provided by the function that
defines the operation. The type, type parameters and interpretation of an
expression that consists of a defined operation are independent of the
type and type parameters of the context or any larger expression in which
it appears.
\divn\subsubsection{Evaluation of a defined operation}
Once the interpretation of a defined operation is established, the
processor may evaluate any other expression that is equivalent, provided
that the integrity of parentheses is not violated.
Two expressions of derived type are equivalent if their values are equal
for all possible values of their primaries.
\divn\subsection{Evaluation of operands}
[Was {\secfont 7.1.8.2}. Text is unchanged.]
\divn\subsection{Integrity of parentheses}
\mindex{parentheses}
\mindex{evaluation!parentheses}
The rules for evaluation specified in subclause \ref{D7:Intrinsic operations}
state certain conditions under which a processor may evaluate an expression
that is different from the one specified by applying the rules given in
\ref{D7:Form of an expression} and rules for interpretation specified in
subclause \ref{D7:Intrinsic operations}. However, any expression in
parentheses shall be treated as a data entity.
\begin{note}
For example, in evaluating the expression A~+~ (B~--~C) where A, B, and C
are of numeric types, the difference of B and C shall be evaluated before
the addition operation is performed; the processor shall not evaluate the
mathematically equivalent expression (A~+~ B)~--~C.
\end{note}
\divn\subsection{Type, type parameters, and shape of an expression}
[Was {\secfont 7.1.4}. Text is unchanged.]
\divn\subsection{Conformability rules for elemental operations}
\label{D7:Conformability rules for intrinsic operations}
[Was {\secfont 7.1.5}. Text is unchanged].
\divn\subsection{Specification expression}
[Was {\secfont 7.1.6}. Text is unchanged].
\divn\subsection{Initialization expression}
[Was {\secfont 7.1.7}. Text is unchanged].
\divn\section{Assignment}
[Was {\secfont 7.4}. Text is unchanged.]
\end{document}