From cc45a65c78c578eb404d8773b22e5b046917621f Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sat, 23 Mar 2024 16:02:51 -0500 Subject: 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. --- docs/data_spec.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/data_spec.org') 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 -- cgit v1.2.3