Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-integer exponents to handle the result of square root #3439

Merged
merged 5 commits into from
Dec 7, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions chapters/unitexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ \section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}
unit-operand [ unit-exponent ]

unit-exponent :
[ "+" | "-" ] UNSIGNED-INTEGER
[ "+" | "-" ] ( UNSIGNED-INTEGER | "(" UNSIGNED-INTEGER "/" UNSIGNED-INTEGER ")" )
\end{lstlisting}

The SI standard uses super-script for the exponentation, and does thus not define any operator symbol for exponentiation.
A \lstinline[language=grammar]!unit-factor! consists of a \lstinline[language=grammar]!unit-operand! possibly suffixed by a possibly signed integer number, which is interpreted as an exponent.
A \lstinline[language=grammar]!unit-factor! normally consists of a \lstinline[language=grammar]!unit-operand! possibly suffixed by a possibly signed integer number, which is interpreted as an exponent.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
Rational exponents are needed to fully support the unit for square roots (and can be used for roots in general).
They are intended to be only be used when needed, i.e., not to represent integer exponents.
There must be no spacing between the \lstinline[language=grammar]!unit-operand! and a possible \lstinline[language=grammar]!unit-exponent!.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved

\begin{lstlisting}[language=grammar]
Expand Down