[shared] StorageExpressionModel: memoize the fact that the expression is

circular to avoid lagging when approximating the model multiple times.
This commit is contained in:
Émilie Feral
2018-11-15 14:45:48 +01:00
parent 5b6aa67dca
commit 17abf68de1
3 changed files with 16 additions and 1 deletions

View File

@@ -69,6 +69,9 @@ int StorageFunction::nameWithArgument(char * buffer, size_t bufferSize, char arg
template<typename T>
T StorageFunction::templatedApproximateAtAbscissa(T x, Poincare::Context * context) const {
if (isCircularlyDefined(context)) {
return NAN;
}
const char unknownX[2] = {Poincare::Symbol::UnknownX, 0};
return expression(context).approximateWithValueForSymbol(unknownX, x, *context, Preferences::sharedPreferences()->angleUnit());
}