Skip to content

Commit 5609fed

Browse files
committed
Add support for Imperial units, ticket:4031
1 parent 038e71c commit 5609fed

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Compiler/runtime/unitparser.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,23 @@ void UnitParser::initSIUnits() {
11501150
addDerived("time", "hour", "h", "s", Rational(0), Rational(60 * 60), Rational(0), true);
11511151
addDerived("time", "day", "d", "s", Rational(0), Rational(60 * 60 * 24), Rational(0), true);
11521152

1153+
// Imperial units
1154+
addDerived("length", "inch", "in", "m", Rational(0),
1155+
Rational(254, 10000), Rational(0), true);
1156+
addDerived("length", "foot", "ft", "m", Rational(0),
1157+
Rational(3048, 10000), Rational(0), true);
1158+
1159+
addDerived("velocity", "miles per hour", "mph", "m/s", Rational(0),
1160+
Rational(44704, 100000), Rational(0), true);
1161+
1162+
addDerived("mass", "pound", "lb", "kg", Rational(0),
1163+
Rational(45359237, 100000000), Rational(0), true);
1164+
1165+
addDerived("pressure", "pound per square inch", "psi", "Pa", Rational(0),
1166+
Rational(689475729, 100000), Rational(0), true);
1167+
addDerived("pressure", "inch water gauge", "inWG", "Pa", Rational(0),
1168+
Rational(249088908333, 1000000000), Rational(0), true);
1169+
11531170
commit();
11541171
}
11551172

0 commit comments

Comments
 (0)