Please include the following information in your issue:
-
Which version of units you are using
Branch v3.x, Commit da6dd91
-
Which compiler exhibited the problem (including compiler version)
GCC 11.4.0
The math function don't work for dimensionless units like percent
using units::concentration::percent;
percent<double> pct1 = 100_pct;
percent<double> pct2 = 70_pct;
percent<double> delta = fabs(pct1 - pct2); // Results into percent<double>(0.3)
percent<double> maxValue = fmax(pct1, pct2); // Results into percent<double>(1.0)
percent<double> minValue = fmin(pct1, pct2); // Results into percent<double>(0.7)
// Following tests are failing:
EXPECT_EQ(delta, 30_pct);
EXPECT_EQ(maxValue, pct1);
EXPECT_EQ(minValue, pct2);
The problem lies in core.h where the said functions use .value() instead of .raw()
Please include the following information in your issue:
Which version of
unitsyou are usingBranch v3.x, Commit da6dd91
Which compiler exhibited the problem (including compiler version)
GCC 11.4.0
The math function don't work for dimensionless units like
percentThe problem lies in
core.hwhere the said functions use.value()instead of.raw()