summaryrefslogtreecommitdiff
path: root/docs/manual.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/manual.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/manual.org')
-rw-r--r--docs/manual.org1
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/manual.org b/docs/manual.org
index 7e343aa..5b36ba7 100644
--- a/docs/manual.org
+++ b/docs/manual.org
@@ -94,6 +94,7 @@ You can also use the special setting names ~custom_unit_file~, ~custom_dimension
A unit expression is simply a math expression where the values being operated on are units or numbers. The operations that can be used are (in order of precedence):
- Exponentiation (^); the exponent must be an integer. Both units and numbers can be raised to an exponent
- Multiplication (*) and division (/). Multiplication can also be done with a space (so "15 meter" is the same thing as "15 * meter").
+ You can also divide with ~|~ to create fractions. Using ~|~ instead of ~/~ gives the division a higher precedence than any other operator. For example, "2|5^2" evaluates to 4/25, not 2/25.
- Addition (+) and subtraction (-). They can only be done between units of the same dimension (measuring the same thing). So you can add metres, inches and feet together, and you can add joules and calories together, but you can't add metres to seconds, or feet to calories, or watts to pounds.
Brackets can be used to manipulate the order of operations, and nonlinear units like Celsius and Fahrenheit cannot be used in expressions. You can use a value in a nonlinear unit by putting brackets after it - for example, degC(12) represents the value 12 \deg C