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 942776f commit b3e0dc1
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion chapters/lexicalstructure.tex
Expand Up @@ -261,7 +261,6 @@ \subsection{Units of Literal Constants}\label{units-literal-constants}
\begin{nonnormative}
Rationale: by default, literal Real and Integer constants do not have a defined, non-empty \lstinline!unit! string attribute; hence they act as "unit wildcards", preventing to perform dimensional consistency checking of equations that contain them. The rules regarding multiplication and division prevent this effect, allowing, e.g., to determine that `v = sqrt(2*g*h)` is dimensionally consistent, while `v = sqrt(2*g)` is dimensionally inconsistent, and thus most likely wrong. The rules regarding addition and subtraction instead allow to perform some basic unit inference in expressions containing mixed literal constants and variables (when there are no ambiguities in doing so), again expanding the scope for dimensional consistency checking. For example, they allow to determine that `tau = L/(abs(v) + 1e-9)` is dimensionally consistent, while `tau = 1/(abs(v) + 1e-9)` is not.]_

On the other hand, literal constants showing up in expressions containing only literal constants should be left with the default \lstinline!unit = ""! attribute, otherwise declarations such as \lstinline!Real L(unit = "m") = 2.0!, equations such as \lstinline!L = 2.0! and function calls such as \lstinline!temperature_ph(1e5, 293.15)! or \lstinline!temperature_ph(1e5, 273.15 + 20)! would be erroneously flagged as dimensionally inconsistent.

The rules involving elementary mathematical functions extend the scope of this concept to also allow determining that equations such as \lstinline!i = i0*exp(v/i0)! or \lstinline!i = v0*exp(i/i0)! are dimensionally inconsistent.
\end{nonnormative}
Expand Down

0 comments on commit b3e0dc1

Please sign in to comment.