From 9b3f7edfcdca1979bf093683419e46d3880d4803 Mon Sep 17 00:00:00 2001 From: Gabriel Ozouf Date: Tue, 22 Dec 2020 14:25:28 +0100 Subject: [PATCH] [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. --- poincare/src/unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poincare/src/unit.cpp b/poincare/src/unit.cpp index 8b5df0904..48bbcd186 100644 --- a/poincare/src/unit.cpp +++ b/poincare/src/unit.cpp @@ -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)