summaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2019-01-26 14:14:03 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2019-01-26 14:14:03 -0500
commitff30d9ab06bfc93012b90d24af57505b3d9c70d4 (patch)
tree4fda119775191f94e8068cccd7b7403b5ccacfd4 /README.org
parentda01eec8c59477da649767f3ed72c98fe1bbb301 (diff)
Edited README to add more newlines.
Diffstat (limited to 'README.org')
-rw-r--r--README.org19
1 files changed, 15 insertions, 4 deletions
diff --git a/README.org b/README.org
index 9fa913d..175db07 100644
--- a/README.org
+++ b/README.org
@@ -8,19 +8,24 @@
- All of SI included in default text file
- Choose your precision
* How to Convert
-To convert units, simply enter the first unit in the From box and the second unit in the To box. Press Convert and a result will appear in the output box. Both boxes accept unit expressions, so you can input things like ‘1.7 m’, ‘85 km/h’ and ‘35 A * 14 s’ into either box.
+To convert units, simply enter the first unit in the From box and the second unit in the To box. Press Convert and a result will appear in the output box. Both boxes accept unit expressions, so you can input things like ‘1.7 m’, ‘85 km/h’ and ‘35 A * 14 s’ into either box.
+
*Warning*: The space between the number and the unit name is required, or else the whole expression will be interpreted as a unit name. Spaces are not required for operators.
+
Use the slider at the bottom to choose the maximum precision of the result, in significant digits, not decimal places.
* Units Files and Expressions
-As mentioned previously, all units are loaded from a units file. The format for lines consists of a name for the unit, some tabs (not spaces), and an expression. The following operations are supported in expressions
+As mentioned previously, all units are loaded from a units file. The format for lines consists of a name for the unit, some tabs (not spaces), and an expression. The following operations are supported in expressions:
- Multiplication using spaces ( ) or asterisks (*)
- Division using the forward slash (/)
- Exponentiation using the caret (^)
Every argument can be either a linear unit, a base unit or a number, except exponents which must be integers. There is no way to use brackets to manipulate order of operations.
Example (Explanation provided after # sign, this will *not* work in a real units file):
-inch 25.4 mm # Define ‘inch’ as equal to the product of 25.4 and ‘mm’
+
+inch 25.4 mm # Define ‘inch’ as equal to the product of 25.4 and ‘mm’
+
mph mile / hour # Define ‘mph’ as equal to the quotient of ‘mile’ and ‘hour’
+
litre 0.001 m^3 # Define ‘litre’ as equal to the product of 0.001 and the unit ‘m’ raised to the exponent 3
Lines that start with the number sign (#) and blank lines will be ignored.
@@ -31,21 +36,27 @@ Unit prefixes are defined differently. When a unit name ends with the dash (-)
- the name of another prefix without the dash (kilo)
* Unit Prefixes
In SI, you can have a unit prefix, which you attach to the start of a unit and it multiplies the unit by a certain value. For example, milli-metre = 0.001 * metre. This unit converter supports unit prefixes, and you can put any number of prefixes before a linear or base unit to transform it (this includes non-SI units).
-You can use more than one prefix at once (yottayottametre = really really long distance), but you may not convert prefixes alone. If you want to do that, use ‘unit’ or ‘u’ (ku = 1000000 mu). You can also use u for converting from numbers (tau = 6.28319 u).
+You can use more than one prefix at once (yottayottametre = really really long distance), but you may not convert prefixes alone. If you want to do that, use ‘unit’ or ‘u’ (ku = 1000000 mu). You can also use u for converting from numbers (pi = 3.141593 u).
+
*Warning*: While the standard symbol for ‘deca’ is ‘da’, this program uses ‘D’ instead since ‘da’ can be confused with ‘deciatto’. Also, you may use capital letters for the symbols of ‘hecto’ and ‘kilo’.
+
*Warning*: The standard prefixes will never use 1024 instead of 1000, even when operating on bits and bytes. Use ‘Ki’, ‘Mi’, ‘Gi’, ‘Ti’ and so on instead.
* Nonlinear Units
Sometimes, units cannot be converted from and to by simply multiplying and dividing. A common example of this is the Celsius and Fahrenheit temperature scales, which require multiplication and addition to convert to each other (and to their base, Kelvin).
+
To use nonlinear units, use the following syntax:
FROM: unit1(value)
TO: unit2
+
Nonlinear units cannot:
- multiply, divide or exponentiate
- use prefixes
- be defined by unit files
+
To define a nonlinear unit, make an anonymous inner type (or any other subclass) of AbstractUnit, and define the conversion methods.
* Unit and Prefix Viewers
The unit and prefix viewers can be used to see the available units (without prefixes) and prefixes. Upon opening them, you will see a list of units or prefixes on your left. Using the text box above, the list can be filtered. When a unit is clicked on, details about will be displayed on the right.
* Copyright and Licences
The Unit Converter program is Copyright (C) 2018, 2019 Adrien Hopkins. It is released under the terms of the AGPL v3 licence.
+
This document is Copyright (C) 2019 Adrien Hopkins. It is released under the terms of the CC BY-SA (Creative Commons Attribution-ShareAlike) licence.