[poincare/unit] Handle kelvin with prefix

Units derived from kelvin (mK, cK, ...) were handled like Celsius and
Fahrenheit, causing a bug where multiplications such as 2*pi*_cK to
simplify as undef.
This commit is contained in:
Gabriel Ozouf
2020-12-22 14:25:28 +01:00
committed by EmilieNumworks
parent fa523c25c9
commit 9b3f7edfcd

View File

@@ -869,7 +869,7 @@ Expression Unit::shallowReduce(ExpressionNode::ReductionContext reductionContext
* (6) -123_°C->_K
* (7) Right member of a unit convert - this is handled above, as
* UnitConversion is set to None in this case. */
if (node()->representative()->dimensionVector() == TemperatureRepresentative::Default().dimensionVector()) {
if (node()->representative()->dimensionVector() == TemperatureRepresentative::Default().dimensionVector() && node()->representative() != k_temperatureRepresentatives + k_kelvinRepresentativeIndex) {
Expression p = parent();
if (p.isUninitialized() || p.type() == ExpressionNode::Type::UnitConvert) {
// Form (1) and (2)