Skip to content

Commit

Permalink
[poincare/unit] Handle kelvin with prefix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GabrielNumworks authored and EmilieNumworks committed Dec 22, 2020
1 parent fa523c2 commit 9b3f7ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion poincare/src/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9b3f7ed

Please sign in to comment.