Skip to content

Commit

Permalink
Explain why abs does not generate events.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Jun 14, 2022
1 parent 165f17f commit 22c7224
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chapters/operatorsandexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,13 @@ \subsection{Numeric Functions and Conversion Functions}\label{numeric-functions-
Expands into \lstinline!noEvent(if $v$ >= 0 then $v$ else -$v$)!.
Argument $v$ needs to be an \lstinline!Integer! or \lstinline!Real! expression.
\end{semantics}
\begin{nonnormative}
The reason this does not generate events is that in many cases that introduced more problems than it solves.
A typical case is a flow equation of the form \lstinline!abs(x)*x=y!.
If we have to solve for \lstinline!x! and had events for \lstinline!abs(x)! we would not find a solution if \lstinline!y! passes through zero.

In inverted form this equation is \lstinline!x=sign(y)*sqrt(abs(y))!, with similar issues.
\end{nonnormative}
\end{functiondefinition}

\begin{functiondefinition}[sign]
Expand Down

0 comments on commit 22c7224

Please sign in to comment.