Skip to content

Commit

Permalink
Clean up fall-back value to have it in one place and be concise.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Sep 2, 2022
1 parent 2414675 commit 1d3fe94
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions chapters/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,12 @@ \section{Predefined Types and Classes}\label{predefined-types-and-classes}
The definitions use \lstinline!RealType!\indexinline{RealType}, \lstinline!IntegerType!\indexinline{IntegerType}, \lstinline!BooleanType!\indexinline{BooleanType}, \lstinline!StringType!\indexinline{StringType}, \lstinline!EnumType!\indexinline{EnumType} as mnemonics corresponding to machine representations.
These are called the \firstuse[primitive type]{primitive types}.

\begin{definition}[Fall-back value]\label{def:fall-back-value}\index{fall-back value}
When the start-value is needed and the \lstinline!start!-attribute is not provided, the fall-back value is used instead.
The fall-back value can be be used as guess-value in system of equations and when initializing variables in algorithm sections.
The fall-back value for variables of the different predefined types are defined below.
\end{definition}

\subsection{Real Type}\label{real-type}

The following is the predefined \lstinline!Real!\indexinline{Real} type:
Expand Down Expand Up @@ -1431,7 +1437,7 @@ \subsection{Real Type}\label{real-type}
The \lstinline!nominal! attribute is meant to be used for scaling purposes and to
define tolerances in relative terms, see \cref{attributes-start-fixed-nominal-and-unbounded}.

As a fall-back if there is neither value nor start-value then the closest value to \lstinline!0.0! consistent with the bounds (as default \lstinline!0.0!) shall be used.
The fall-back value is the closest value to \lstinline!0.0! consistent with the bounds.

\begin{nonnormative}
For external functions in C89, \lstinline!RealType! maps to \lstinline[language=C]!double!. In the mapping proposed in Annex~F of the C99 standard,
Expand Down Expand Up @@ -1461,7 +1467,7 @@ \subsection{Integer Type}\label{integer-type}

The minimal recommended number range for \lstinline!IntegerType! is from -2147483648 to +2147483647, corresponding to a two's-complement 32-bit integer implementation.

As a fall-back if there is neither value nor start-value then the closest value to \lstinline!0! consistent with the bounds (as default \lstinline!0!) shall be used.
The fall-back value is the closest value to \lstinline!0! consistent with the bounds.

\subsection{Boolean Type}\label{boolean-type}

Expand All @@ -1479,7 +1485,7 @@ \subsection{Boolean Type}\label{boolean-type}
\index{start@\robustinline{start}!attribute of \robustinline{Boolean}}%
\index{fixed@\robustinline{fixed}!attribute of \robustinline{Boolean}}%

As a fall-back if there is neither value nor start-value then \lstinline!false! shall be used.
The fall-back value is \lstinline!false!.

\subsection{String Type}\label{string-type}

Expand All @@ -1499,7 +1505,7 @@ \subsection{String Type}\label{string-type}

A \lstinline!StringType! value (such as $\langle\mathit{value}\rangle$ or other textual attributes of built-in types) may contain any Unicode data (and nothing else).

As a fall-back if there is neither value nor start-value then \lstinline!""! shall be used.
The fall-back value is \lstinline!""!.

\subsection{Enumeration Types}\label{enumeration-types}

Expand Down Expand Up @@ -1623,7 +1629,7 @@ \subsubsection{Attributes of Enumeration Types}\label{attributes-of-enumeration-
end E;
\end{lstlisting}

As a fall-back if there is neither value nor start-value then the smallest value consistent with the bounds shall be used (as default \lstinline!e1!) shall be used.
The fall-back value is the smallest value consistent with the bounds.

\begin{nonnormative}
Since the attributes and enumeration literals are on the same
Expand Down

0 comments on commit 1d3fe94

Please sign in to comment.