Document operations on locations.

This commit is contained in:
Glen Whitney 2019-07-25 09:56:15 -04:00
parent d24b8c5ead
commit 2837cc2253

View File

@ -4859,6 +4859,9 @@ Operators
Unlike other spread sheets, the operators in teapot check the type of the Unlike other spread sheets, the operators in teapot check the type of the
values they are applied to, which means the try to add a string to a floating values they are applied to, which means the try to add a string to a floating
point number will result in an type error. point number will result in an type error.
Operators on locations in the spreadsheet, which are just triples of integers,
generally operate following typical rules for vectors, with particular
notes below.
The following operators are available, listed in ascending precendence: The following operators are available, listed in ascending precendence:
\end_layout \end_layout
@ -4895,7 +4898,19 @@ y
\emph default \emph default
are empty, they are considered to be 0 if the other is an integer number, are empty, they are considered to be 0 if the other is an integer number,
0.0 if it is a floating point number and the empty string if it is a string. 0.0 if it is a floating point number and the empty string if it is a string.
On locations,
\emph on
x<y
\emph default
if every component of
\emph on
x
\emph default
is less than or equal to the corresponding component of
\emph on
y
\emph default
and at least one is strictly less.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -4920,6 +4935,7 @@ x
y y
\emph default \emph default
. .
For locations, this must hold for every component.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -4944,6 +4960,7 @@ x
y y
\emph default \emph default
. .
For locations, this must hold for every component.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -4968,6 +4985,8 @@ x
y y
\emph default \emph default
. .
As with <, for locations, every component must be greater than or equal,
and at least one must be strictly greater.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -5017,7 +5036,7 @@ y
\emph default \emph default
. .
Almost equal means, the numbers are at most neighbours. Almost equal means, the numbers are at most neighbours.
It is an error to use this with any type but float.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -5142,7 +5161,8 @@ and
* *
\family default \family default
for that. for that.
You can multiply a location by an integer, or take the dot product of the
coordinates of two locations (although the use case for that is unclear).
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -5167,6 +5187,7 @@ x
y y
\emph default \emph default
are numbers. are numbers.
You can divide a location by an integer.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -5191,6 +5212,8 @@ x
y y
\emph default \emph default
are numbers. are numbers.
You can mod a location by an integer, or operate on two locations, in which
case the mod operation applies componentwise.
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -5232,7 +5255,7 @@ x
\emph on \emph on
x x
\emph default \emph default
is a number. is a number or location.
If If
\emph on \emph on
x x