mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 17:50:04 +01:00
[poincare/power] Better Power::shallowReduce
Take care of an undefined index that arrived during the remove unit
This commit is contained in:
committed by
EmilieNumworks
parent
9e94304db0
commit
36bc70aaee
@@ -407,8 +407,8 @@ Expression Power::shallowReduce(ExpressionNode::ReductionContext reductionContex
|
||||
{
|
||||
Expression indexUnit;
|
||||
index = index.removeUnit(&indexUnit);
|
||||
if (!indexUnit.isUninitialized()) {
|
||||
// There must be no unit in the exponent
|
||||
if (!indexUnit.isUninitialized() || index.isUndefined()) {
|
||||
// There must be no unit nor undefined in the exponent
|
||||
return replaceWithUndefinedInPlace();
|
||||
}
|
||||
assert(index == childAtIndex(1));
|
||||
|
||||
@@ -1316,7 +1316,7 @@ QUIZ_CASE(poincare_simplification_user_function_with_convert) {
|
||||
"f", 1,
|
||||
Symbol::Builder('x')));
|
||||
assert_expression_reduce(e);
|
||||
assert_reduce("e^(f(0))", Radian, Polar);
|
||||
assert_parsed_expression_simplify_to("e^(f(0))", "undef");
|
||||
Ion::Storage::sharedStorage()->recordNamed("f.func").destroy();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user