Skip to content

Commit e27eed9

Browse files
author
Nic Holthaus
committed
fix: better conversion for inHg
1 parent d547f37 commit e27eed9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

include/units.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -3732,7 +3732,8 @@ namespace units
37323732
UNIT_ADD(pressure, atmosphere, atmospheres, atm, unit<std::ratio<101325>, pascals>)
37333733
UNIT_ADD(pressure, pounds_per_square_inch, pounds_per_square_inch, psi, compound_unit<force::pounds, inverse<squared<length::inch>>>)
37343734
UNIT_ADD(pressure, torr, torrs, torr, unit<std::ratio<1, 760>, atmospheres>)
3735-
UNIT_ADD(pressure, inch_of_mercury, inches_of_mercury, inHg, unit<std::ratio<338639, 100>, pascals>)
3735+
UNIT_ADD(pressure, millimeter_of_mercury, millimeters_of_mercury, mmHg, unit<std::ratio<26664477483LL, 200000000LL>, pascals>)
3736+
UNIT_ADD(pressure, inch_of_mercury, inches_of_mercury, inHg, unit<std::ratio<254, 10>, millimeters_of_mercury>)
37363737

37373738
UNIT_ADD_CATEGORY_TRAIT(pressure)
37383739
#endif

unitTests/main.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,10 @@ TEST_F(UnitConversion, pressure)
19901990
EXPECT_NEAR(9000.74, test, 5.0e-3);
19911991
test = convert<atmospheres, psi>(1.0);
19921992
EXPECT_NEAR(14.6959, test, 5.0e-5);
1993+
test = convert<inch_of_mercury, millimeter_of_mercury>(1.0);
1994+
EXPECT_NEAR(25.4, test, 5.0e-5);
1995+
test = convert<inches_of_mercury, pascals>(1.0);
1996+
EXPECT_NEAR(3386.38864, test, 5.0e-5);
19931997
}
19941998

19951999
TEST_F(UnitConversion, charge)

0 commit comments

Comments
 (0)