Skip to content

Commit

Permalink
fix: better conversion for inHg
Browse files Browse the repository at this point in the history
  • Loading branch information
Nic Holthaus committed Dec 17, 2024
1 parent d547f37 commit e27eed9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/units.h
Original file line number Diff line number Diff line change
Expand Up @@ -3732,7 +3732,8 @@ namespace units
UNIT_ADD(pressure, atmosphere, atmospheres, atm, unit<std::ratio<101325>, pascals>)
UNIT_ADD(pressure, pounds_per_square_inch, pounds_per_square_inch, psi, compound_unit<force::pounds, inverse<squared<length::inch>>>)
UNIT_ADD(pressure, torr, torrs, torr, unit<std::ratio<1, 760>, atmospheres>)
UNIT_ADD(pressure, inch_of_mercury, inches_of_mercury, inHg, unit<std::ratio<338639, 100>, pascals>)
UNIT_ADD(pressure, millimeter_of_mercury, millimeters_of_mercury, mmHg, unit<std::ratio<26664477483LL, 200000000LL>, pascals>)
UNIT_ADD(pressure, inch_of_mercury, inches_of_mercury, inHg, unit<std::ratio<254, 10>, millimeters_of_mercury>)

UNIT_ADD_CATEGORY_TRAIT(pressure)
#endif
Expand Down
4 changes: 4 additions & 0 deletions unitTests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,10 @@ TEST_F(UnitConversion, pressure)
EXPECT_NEAR(9000.74, test, 5.0e-3);
test = convert<atmospheres, psi>(1.0);
EXPECT_NEAR(14.6959, test, 5.0e-5);
test = convert<inch_of_mercury, millimeter_of_mercury>(1.0);
EXPECT_NEAR(25.4, test, 5.0e-5);
test = convert<inches_of_mercury, pascals>(1.0);
EXPECT_NEAR(3386.38864, test, 5.0e-5);
}

TEST_F(UnitConversion, charge)
Expand Down

0 comments on commit e27eed9

Please sign in to comment.