Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decomposed the rounded expressions in the unit definitions into operations with exact coefficients #1393

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions Common/UnitDefinitions/Acceleration.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
"L": "NauticalMile",
"T": "Second"
},
"FromUnitToBaseFunc": "{x} * 0.5144444444444",
"FromBaseToUnitFunc": "{x} / 0.5144444444444",
"FromUnitToBaseFunc": "{x} * (1852.0 / 3600.0)",
"FromBaseToUnitFunc": "{x} / (1852.0 / 3600.0)",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kn/s" ]
},
{
{
"Culture": "ru-RU",
"Abbreviations": [ "узел/с" ]
}
Expand All @@ -95,14 +95,16 @@
"L": "NauticalMile",
"T": "Minute"
},
"FromUnitToBaseFunc": "{x} * 0.5144444444444 / 60",
"FromBaseToUnitFunc": "{x} / 0.5144444444444 * 60",
"XmlDocSummary": "The knot (/nɒt/) is a unit of speed equal to one nautical mile per hour, exactly 1.852 km/h (approximately 1.151 mph or 0.514 m/s).",
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Knot_(unit)",
"FromUnitToBaseFunc": "{x} * (1852.0 / 3600.0) / 60",
"FromBaseToUnitFunc": "{x} * 60 / (1852.0 / 3600.0)",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kn/min" ]
},
{
{
"Culture": "ru-RU",
"Abbreviations": [ "узел/мин" ]
}
Expand All @@ -115,14 +117,16 @@
"L": "NauticalMile",
"T": "Hour"
},
"FromUnitToBaseFunc": "{x} * 0.5144444444444 / 3600",
"FromBaseToUnitFunc": "{x} / 0.5144444444444 * 3600",
"XmlDocSummary": "The knot (/nɒt/) is a unit of speed equal to one nautical mile per hour, exactly 1.852 km/h (approximately 1.151 mph or 0.514 m/s).",
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Knot_(unit)",
"FromUnitToBaseFunc": "{x} * (1852.0 / 3600.0) / 3600",
"FromBaseToUnitFunc": "{x} * 3600 / (1852.0 / 3600.0)",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kn/h" ]
},
{
{
"Culture": "ru-RU",
"Abbreviations": [ "узел/час" ]
}
Expand Down
8 changes: 4 additions & 4 deletions Common/UnitDefinitions/AreaMomentOfInertia.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"BaseUnits": {
"L": "Foot"
},
"FromUnitToBaseFunc": "{x} * Math.Pow(0.3048, 4)",
"FromBaseToUnitFunc": "{x} / Math.Pow(0.3048, 4)",
"FromUnitToBaseFunc": "{x} * 0.0086309748412416",
"FromBaseToUnitFunc": "{x} / 0.0086309748412416",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -87,8 +87,8 @@
"BaseUnits": {
"L": "Inch"
},
"FromUnitToBaseFunc": "{x} * Math.Pow(2.54e-2, 4)",
"FromBaseToUnitFunc": "{x} / Math.Pow(2.54e-2, 4)",
"FromUnitToBaseFunc": "{x} * 0.0000004162314256",
"FromBaseToUnitFunc": "{x} / 0.0000004162314256",
"Localization": [
{
"Culture": "en-US",
Expand Down
4 changes: 2 additions & 2 deletions Common/UnitDefinitions/BrakeSpecificFuelConsumption.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
{
"SingularName": "PoundPerMechanicalHorsepowerHour",
"PluralName": "PoundsPerMechanicalHorsepowerHour",
"FromUnitToBaseFunc": "{x} * 1.689659410672e-7",
"FromBaseToUnitFunc": "{x} / 1.689659410672e-7",
"FromUnitToBaseFunc": "{x} * (0.45359237 / (76.0402249 * 9.80665))/3600",
"FromBaseToUnitFunc": "{x} * 3600 / (0.45359237 / (76.0402249 * 9.80665))",
"XmlDocSummary": "The pound per horse power hour uses mechanical horse power and the imperial pound",
"Localization": [
{
Expand Down
70 changes: 35 additions & 35 deletions Common/UnitDefinitions/Density.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"L": "Inch",
"M": "Pound"
},
"FromUnitToBaseFunc": "{x} / 3.6127298147753e-5",
"FromBaseToUnitFunc": "{x} * 3.6127298147753e-5",
"FromUnitToBaseFunc": "{x} * 0.45359237 / 1.6387064e-5",
"FromBaseToUnitFunc": "{x} * 1.6387064e-5 / 0.45359237",
"Prefixes": [ "Kilo" ],
"Localization": [
{
Expand All @@ -88,8 +88,8 @@
"L": "Foot",
"M": "Pound"
},
"FromUnitToBaseFunc": "{x} / 0.062427961",
"FromBaseToUnitFunc": "{x} * 0.062427961",
"FromUnitToBaseFunc": "{x} * 0.45359237 / 0.028316846592",
"FromBaseToUnitFunc": "{x} * 0.028316846592 / 0.45359237",
"Prefixes": [ "Kilo" ],
"Localization": [
{
Expand All @@ -102,13 +102,13 @@
{
"SingularName": "PoundPerCubicYard",
"PluralName": "PoundsPerCubicYard",
"XmlDocSummary": "Calculated from the definition of <a href=\"https://en.wikipedia.org/wiki/Pound_(mass)\">pound</a> and <a href=\"https://en.wikipedia.org/wiki/Yard\">yard</a> compared to metric kilogram and meter.",
"XmlDocSummary": "Calculated from the definition of <a href=\"https://en.wikipedia.org/wiki/Pound_(mass)\">pound</a> and <a href=\"https://en.wikipedia.org/wiki/Cubic_yard\">Cubic yard</a> compared to metric kilogram and meter.",
"BaseUnits": {
"L": "Yard",
"M": "Pound"
},
"FromUnitToBaseFunc": "{x} * (0.45359237 / 0.9144 / 0.9144 / 0.9144)",
"FromBaseToUnitFunc": "{x} / (0.45359237 / 0.9144 / 0.9144 / 0.9144)",
"FromUnitToBaseFunc": "{x} * 0.45359237 / 0.764554857984",
"FromBaseToUnitFunc": "{x} * 0.764554857984 / 0.45359237",
"Prefixes": [ "Kilo" ],
"Localization": [
{
Expand Down Expand Up @@ -173,8 +173,8 @@
"L": "Foot",
"M": "Slug"
},
"FromUnitToBaseFunc": "{x} * 515.378818",
"FromBaseToUnitFunc": "{x} * 0.00194032033",
"FromUnitToBaseFunc": "{x} * 14.59390 / 0.028316846592",
"FromBaseToUnitFunc": "{x} * 0.028316846592 / 14.59390",
"Localization": [
{
"Culture": "en-US",
Expand Down Expand Up @@ -224,8 +224,8 @@
{
"SingularName": "PoundPerUSGallon",
"PluralName": "PoundsPerUSGallon",
"FromUnitToBaseFunc": "{x} * 1.19826427e2",
"FromBaseToUnitFunc": "{x} / 1.19826427e2",
"FromUnitToBaseFunc": "{x} * 0.45359237 / 0.003785411784",
"FromBaseToUnitFunc": "{x} * 0.003785411784 / 0.45359237",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -236,8 +236,8 @@
{
"SingularName": "PoundPerImperialGallon",
"PluralName": "PoundsPerImperialGallon",
"FromUnitToBaseFunc": "{x} * 9.9776398e1",
"FromBaseToUnitFunc": "{x} / 9.9776398e1",
"FromUnitToBaseFunc": "{x} * 0.45359237 / 0.00454609",
"FromBaseToUnitFunc": "{x} * 0.00454609 / 0.45359237",
"Localization": [
{
"Culture": "en-US",
Expand Down Expand Up @@ -268,8 +268,8 @@
"L": "Foot",
"M": "Tonne"
},
"FromUnitToBaseFunc": "{x} * 3.53146667214886e4",
"FromBaseToUnitFunc": "{x} / 3.53146667214886e4",
"FromUnitToBaseFunc": "{x} * 1000 / 0.028316846592",
"FromBaseToUnitFunc": "{x} * 0.028316846592 / 1000",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -284,8 +284,8 @@
"L": "Inch",
"M": "Tonne"
},
"FromUnitToBaseFunc": "{x} * 6.10237440947323e7",
"FromBaseToUnitFunc": "{x} / 6.10237440947323e7",
"FromUnitToBaseFunc": "{x} * 1000 / 1.6387064e-5",
"FromBaseToUnitFunc": "{x} * 1.6387064e-5 / 1000",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -300,8 +300,8 @@
"L": "Foot",
"M": "Gram"
},
"FromUnitToBaseFunc": "{x} * 0.0353146667214886",
"FromBaseToUnitFunc": "{x} / 0.0353146667214886",
"FromUnitToBaseFunc": "{x} * 0.001 / 0.028316846592",
"FromBaseToUnitFunc": "{x} * 0.028316846592 / 0.001",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -316,8 +316,8 @@
"L": "Inch",
"M": "Gram"
},
"FromUnitToBaseFunc": "{x} * 61.0237440947323",
"FromBaseToUnitFunc": "{x} / 61.0237440947323",
"FromUnitToBaseFunc": "{x} * 0.001 / 1.6387064e-5",
"FromBaseToUnitFunc": "{x} * 1.6387064e-5 / 0.001",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -332,8 +332,8 @@
"L": "Meter",
"M": "Pound"
},
"FromUnitToBaseFunc": "{x} / 2.204622621848775",
"FromBaseToUnitFunc": "{x} * 2.204622621848775",
"FromUnitToBaseFunc": "{x} * 0.45359237",
"FromBaseToUnitFunc": "{x} / 0.45359237",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -348,8 +348,8 @@
"L": "Centimeter",
"M": "Pound"
},
"FromUnitToBaseFunc": "{x} / 2.204622621848775e-6",
"FromBaseToUnitFunc": "{x} * 2.204622621848775e-6",
"FromUnitToBaseFunc": "{x} * 0.45359237e6",
"FromBaseToUnitFunc": "{x} / 0.45359237e6",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -364,8 +364,8 @@
"L": "Millimeter",
"M": "Pound"
},
"FromUnitToBaseFunc": "{x} / 2.204622621848775e-9",
"FromBaseToUnitFunc": "{x} * 2.204622621848775e-9",
"FromUnitToBaseFunc": "{x} * 0.45359237e9",
"FromBaseToUnitFunc": "{x} / 0.45359237e9",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -380,8 +380,8 @@
"L": "Meter",
"M": "Slug"
},
"FromUnitToBaseFunc": "{x} * 14.5939",
"FromBaseToUnitFunc": "{x} / 14.5939",
"FromUnitToBaseFunc": "{x} * (32.17405 * 0.45359237)",
"FromBaseToUnitFunc": "{x} / (32.17405 * 0.45359237)",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -396,8 +396,8 @@
"L": "Centimeter",
"M": "Slug"
},
"FromUnitToBaseFunc": "{x} * 14593903",
"FromBaseToUnitFunc": "{x} / 14593903",
"FromUnitToBaseFunc": "{x} * (32.17405 * 0.45359237e6)",
"FromBaseToUnitFunc": "{x} / (32.17405 * 0.45359237e6)",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -412,8 +412,8 @@
"L": "Millimeter",
"M": "Slug"
},
"FromUnitToBaseFunc": "{x} * 14593903000",
"FromBaseToUnitFunc": "{x} / 14593903000",
"FromUnitToBaseFunc": "{x} * (32.17405 * 0.45359237e9)",
"FromBaseToUnitFunc": "{x} / (32.17405 * 0.45359237e9)",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -428,8 +428,8 @@
"L": "Inch",
"M": "Slug"
},
"FromUnitToBaseFunc": "{x} * 890574.60201535",
"FromBaseToUnitFunc": "{x} / 890574.60201535",
"FromUnitToBaseFunc": "{x} * (32.17405 * 0.45359237 / 1.6387064e-5)",
"FromBaseToUnitFunc": "{x} / (32.17405 * 0.45359237 / 1.6387064e-5)",
"Localization": [
{
"Culture": "en-US",
Expand Down
16 changes: 8 additions & 8 deletions Common/UnitDefinitions/DynamicViscosity.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
{
"SingularName": "Reyn",
"PluralName": "Reyns",
"FromUnitToBaseFunc": "{x} * 6.8947572931683613e3",
"FromBaseToUnitFunc": "{x} / 6.8947572931683613e3",
"FromUnitToBaseFunc": "{x} * 4.4482216152605 / 0.00064516",
"FromBaseToUnitFunc": "{x} * 0.00064516 / 4.4482216152605",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -62,8 +62,8 @@
{
"SingularName": "PoundForceSecondPerSquareInch",
"PluralName": "PoundsForceSecondPerSquareInch",
"FromUnitToBaseFunc": "{x} * 6.8947572931683613e3",
"FromBaseToUnitFunc": "{x} / 6.8947572931683613e3",
"FromUnitToBaseFunc": "{x} * 4.4482216152605 / 0.00064516",
"FromBaseToUnitFunc": "{x} * 0.00064516 / 4.4482216152605",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -74,8 +74,8 @@
{
"SingularName": "PoundForceSecondPerSquareFoot",
"PluralName": "PoundsForceSecondPerSquareFoot",
"FromUnitToBaseFunc": "{x} * 4.7880258980335843e1",
"FromBaseToUnitFunc": "{x} / 4.7880258980335843e1",
"FromUnitToBaseFunc": "{x} * 4.4482216152605 / 9.290304e-2",
"FromBaseToUnitFunc": "{x} * 9.290304e-2 / 4.4482216152605",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -86,8 +86,8 @@
{
"SingularName": "PoundPerFootSecond",
"PluralName": "PoundsPerFootSecond",
"FromUnitToBaseFunc": "{x} * 1.4881639",
"FromBaseToUnitFunc": "{x} / 1.4881639",
"FromUnitToBaseFunc": "{x} * 0.45359237 / 0.3048",
"FromBaseToUnitFunc": "{x} * 0.3048 / 0.45359237",
"Localization": [
{
"Culture": "en-US",
Expand Down
4 changes: 2 additions & 2 deletions Common/UnitDefinitions/ElectricCharge.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
{
"SingularName": "AmpereHour",
"PluralName": "AmpereHours",
"FromUnitToBaseFunc": "{x} / 2.77777777777e-4",
"FromBaseToUnitFunc": "{x} * 2.77777777777e-4",
"FromUnitToBaseFunc": "{x} * 3600",
"FromBaseToUnitFunc": "{x} / 3600",
"Prefixes": [ "Milli", "Kilo", "Mega" ],
"Localization": [
{
Expand Down
8 changes: 4 additions & 4 deletions Common/UnitDefinitions/ElectricConductivity.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
{
"SingularName": "SiemensPerInch",
"PluralName": "SiemensPerInch",
"FromUnitToBaseFunc": "{x} * 3.937007874015748e1",
"FromBaseToUnitFunc": "{x} / 3.937007874015748e1",
"FromUnitToBaseFunc": "{x} / 2.54e-2",
"FromBaseToUnitFunc": "{x} * 2.54e-2",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -43,8 +43,8 @@
{
"SingularName": "SiemensPerFoot",
"PluralName": "SiemensPerFoot",
"FromUnitToBaseFunc": "{x} * 3.2808398950131234",
"FromBaseToUnitFunc": "{x} / 3.2808398950131234",
"FromUnitToBaseFunc": "{x} / 0.3048",
"FromBaseToUnitFunc": "{x} * 0.3048",
"Localization": [
{
"Culture": "en-US",
Expand Down
8 changes: 4 additions & 4 deletions Common/UnitDefinitions/ElectricCurrentDensity.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"L": "Inch",
"I": "Ampere"
},
"FromUnitToBaseFunc": "{x} * 1.5500031000062000e3",
"FromBaseToUnitFunc": "{x} / 1.5500031000062000e3",
"FromUnitToBaseFunc": "{x} / 0.00064516",
"FromBaseToUnitFunc": "{x} * 0.00064516",
"Localization": [
{
"Culture": "en-US",
Expand All @@ -47,8 +47,8 @@
"L": "Foot",
"I": "Ampere"
},
"FromUnitToBaseFunc": "{x} * 1.0763910416709722e1",
"FromBaseToUnitFunc": "{x} / 1.0763910416709722e1",
"FromUnitToBaseFunc": "{x} / 9.290304e-2",
"FromBaseToUnitFunc": "{x} * 9.290304e-2",
"Localization": [
{
"Culture": "en-US",
Expand Down
4 changes: 2 additions & 2 deletions Common/UnitDefinitions/ElectricSurfaceChargeDensity.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"T": "Second",
"I": "Ampere"
},
"FromUnitToBaseFunc": "{x} * 1.5500031000062000e3",
"FromBaseToUnitFunc": "{x} / 1.5500031000062000e3",
"FromUnitToBaseFunc": "{x} / 0.00064516",
"FromBaseToUnitFunc": "{x} * 0.00064516",
"Localization": [
{
"Culture": "en-US",
Expand Down
Loading