summaryrefslogtreecommitdiff
path: root/docs/data_spec.org
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2024-03-23 16:02:51 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2024-03-23 16:03:45 -0500
commitcc45a65c78c578eb404d8773b22e5b046917621f (patch)
tree6f53d7c974d930731ad41e80b53407c3458f35d9 /docs/data_spec.org
parente1a96524ad9000689e081a6bf52792a886c07222 (diff)
Add fractions using | to expressions
| is like /, but with higher precedence. This feature is a part of GNU Units, and was included in 7Units for compatibility.
Diffstat (limited to 'docs/data_spec.org')
-rw-r--r--docs/data_spec.org2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/data_spec.org b/docs/data_spec.org
index 6cf8712..54780e3 100644
--- a/docs/data_spec.org
+++ b/docs/data_spec.org
@@ -23,7 +23,7 @@ This allows unit and prefix files to be easily organized and divided.
** Unit Expressions
The definition part of a unit's line is a unit expression - the same sort of expression you would use in the complex unit converter.
-Expressions should be a standard mathematical expression, which can operate on either numbers or units. The following operators are supported: addition (+), subtraction (-), multiplication (~*~ or no operator), division (~/~), exponentation (~^~; exponent must be a number). Brackets (~(~ and ~)~) may be used to change order of operations, but otherwise standard BEDMAS order is followed (exponentation first, then multiplication and division, then addition and subtraction), with one exception: if a number is multiplied by a unit using spaces, the multiplication will have precedence over division. For example, "2 m / 1 m" is equal to the dimensionless value 2, not 2 m^2. An example of a line defining a unit is:
+Expressions should be a standard mathematical expression, which can operate on either numbers or units. The following operators are supported: addition (+), subtraction (-), multiplication (~*~ or no operator), division (~/~ or ~|~), exponentation (~^~; exponent must be a number). Brackets (~(~ and ~)~) may be used to change order of operations, but otherwise standard BEDMAS order is followed (exponentation first, then multiplication and division, then addition and subtraction), with two exceptions: if a number is multiplied by a unit using spaces, the multiplication will have precedence over division, and division with ~|~ has higher precedence than any other operator. For example, "2 m / 1 m" is equal to the dimensionless value 2, not 2 m^2. An example of a line defining a unit is:
#+BEGIN_SRC
yard 9 dm + 1.4 cm + 4 mm^2 / 10 mm
#+END_SRC