mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
[poincare] Power: when reducing, apply multinome development only when the target is the User
This commit is contained in:
committed by
LeaNumworks
parent
7607c4cba4
commit
f953443eb8
@@ -743,8 +743,12 @@ Expression Power::shallowReduce(ExpressionNode::ReductionContext reductionContex
|
||||
}
|
||||
|
||||
/* Step 13: (a0+a1+...am)^n with n integer
|
||||
* -> a^n+?a^(n-1)*b+?a^(n-2)*b^2+...+b^n (Multinome) */
|
||||
* -> a^n+?a^(n-1)*b+?a^(n-2)*b^2+...+b^n (Multinome)
|
||||
* We apply this rule only when the target is the User. Indeed, developing
|
||||
* the multinome is likely to increase the numbers of operations and to
|
||||
* lead to precision loss. */
|
||||
if (!letPowerAtRoot
|
||||
&& reductionContext.target() == ExpressionNode::ReductionTarget::User
|
||||
&& indexType == ExpressionNode::Type::Rational
|
||||
&& !static_cast<Rational &>(index).signedIntegerNumerator().isZero()
|
||||
&& static_cast<Rational &>(index).isInteger()
|
||||
|
||||
Reference in New Issue
Block a user