Skip to content

Commit

Permalink
Update chapters/lexicalstructure.tex
Browse files Browse the repository at this point in the history
  • Loading branch information
casella committed Nov 9, 2022
1 parent 5d5f466 commit 398c013
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chapters/lexicalstructure.tex
Expand Up @@ -249,7 +249,11 @@ \subsection{Strings}\label{strings}

\subsection{Units of Literal Constants}\label{units-literal-constants}

Literal \lstinline!Real! and \lstinline!Integer! constants are implicitly assumed to have a dimensionless unit if they appear in expressions containing variables, parameters, or constants that have a non-empty \lstinline!unit! attribute string, or function calls that have a non-empty \lstinline!unit! attribute of the output variable. The same rule applies to function call inputs.
The following rules apply:
- The result of `x + L`, `L + x`, `x - L`, `L - x`, `x*L`, `L*x`, `x/L`, where `x` is a variable with non-empty \lstinline!unit! attribute string `<s>` and `L` is an expression containing only literal constants, shall have the same \lstinline!unit! attribute string of `x`.
- The result of `L/x` shall the the \lstinline!unit! attribute string `1/(<s>)`.
- The result of `x^L` shall have the \lstinline!unit! attribute string of `product(fill(x, L))` if L is a positive Integer, or the unit of `1/product(fill(x, L))` if L is a negative Integer
- If either side of a relational operator is a literal constant, then it is assumed to have the same \lstinline!unit! attribute string of the other side, if that is well-defined.

The inputs of the elementary mathematical functions defined in \cref{built-in-mathematical-functions-and-external-built-in-functions} such as \lstinline!sin()!, \lstinline!cos()!, \lstinline!exp()!, etc., should have a dimensionless unit (e.g., \lstinline!"1"! or \lstinline!"rad"!) if the unit string of the input is non-empty. Function \lstinline!atan2(y,x)! should be treated as \lstinline!atan(x/y)! for dimensional consistency checking purposes.
Their outputs are also implicitly assumed to have a dimensionless unit if they are called within expressions containing variables, parameters, or constants that have a non-empty \lstinline!unit! attribute string.
Expand Down

0 comments on commit 398c013

Please sign in to comment.