mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] Add recursion protection around Exp:getPolyReducedCoefs
This commit is contained in:
@@ -295,10 +295,18 @@ int Expression::defaultGetPolynomialCoefficients(Context & context, const char *
|
||||
}
|
||||
|
||||
int Expression::getPolynomialReducedCoefficients(const char * symbolName, Expression coefficients[], Context & context, Preferences::AngleUnit angleUnit) const {
|
||||
// Reset recursion count if needed
|
||||
bool willHaveToUnlock = ResetRecursionCountAndLockReset();
|
||||
|
||||
int degree = getPolynomialCoefficients(context, symbolName, coefficients);
|
||||
for (int i = 0; i <= degree; i++) {
|
||||
coefficients[i] = coefficients[i].deepReduce(context, angleUnit);
|
||||
}
|
||||
|
||||
// Unlock recursion count reinitialization if needed
|
||||
if (willHaveToUnlock) {
|
||||
UnlockRecursionCountReset();
|
||||
}
|
||||
return degree;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user