refs #197 fixing (hopefully) comparison between null quantities

and related rationalization of PQ comparison.
This commit is contained in:
Mathew Sutcliffe
2014-04-08 16:55:11 +01:00
committed by Klaus Basan
parent 8ba2badb61
commit a4e3ac6f40
5 changed files with 33 additions and 11 deletions

View File

@@ -39,7 +39,7 @@ namespace BlackMisc
*/
double CMeasurementUnit::convertFrom(double value, const CMeasurementUnit &unit) const
{
if (this->isNull() || unit.isNull()) return -1; // models the previous behaviour of using -1 as a sentinel value
if (this->isNull() || unit.isNull()) return 0;
if (this->m_converter == unit.m_converter) return value;
return this->m_converter->fromDefault(unit.m_converter->toDefault(value));
}