Skip to content

Commit

Permalink
Also describe unit mappings of transcendental functions to match othe…
Browse files Browse the repository at this point in the history
…r proposal
  • Loading branch information
henrikt-ma committed Oct 31, 2022
1 parent 99ff3c9 commit 13529f7
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions chapters/unitexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ \subsection{Expressions with Empty Unit}\label{expressions-with-empty-unit}
\lstinline!Integer! expressions implicitly cast to \lstinline!Real!.
\end{itemize}

Expressions defined to \emph{not} propagate the empty unit, thereby forcing inference of unit \lstinline!"1"!:
Expressions defined to \emph{not} propagate the empty unit up the expression tree, thereby forcing inference of unit \lstinline!"1"!:
\begin{itemize}
\item
Addition, subtraction, multiplication and division operators when either operand has non-empty unit.
Expand All @@ -273,10 +273,22 @@ \subsection{Expressions with Empty Unit}\label{expressions-with-empty-unit}
(Unit checking involving user-defined functions with empty unit on inputs and outputs is currently not defined.)
\end{itemize}

Built-in non-array operators, functions, and special expressions that propagate any unit (including empty):
Built-in non-array operators, functions, and special expressions that propagate any unit (including empty) up the expression tree:
\begin{itemize}
\item
When all operands have the same unit: negation, addition, and subtraction (scalar or element-wise).
When all operands have the same unit: negation, addition, and subtraction (scalar or element-wise), see {array-element-wise-addition-subtraction-and-string-concatenation}.
\item
The \lstinline!abs! function, see \cref{modelica:abs}.
\end{itemize}

Transcendental functions that propagate both unit \lstinline!"1"! and the empty unit up the expression tree:
\begin{itemize}
\item
All of the elementary mathematical functions listed in \cref{built-in-mathematical-functions-and-external-built-in-functions}.
(Whether some of these also accept other dimensionless units such as \lstinline!"rad"! for the input argument is currently not defined.)
\item
The only binary of these functions, \lstinline!atan2!, requires both arguments to have the same unit, and accepts any unit.
The result of \lstinline!atan2! has empty unit only when both arguments have empty unit; otherwise the unit of the result is \lstinline!"1"!.
\end{itemize}

Special situations in which the empty unit is propagated up the expression tree:
Expand Down

0 comments on commit 13529f7

Please sign in to comment.