mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 08:10:50 +01:00
[poincare] Create a a flag on Expression that is set when the
approximation encouters a complex value All approximation methods take the complex format into account.
This commit is contained in:
@@ -159,10 +159,10 @@ void assert_parsed_expression_evaluates_to(const char * expression, const char *
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void assert_parsed_expression_approximates_with_value_for_symbol(Expression expression, const char * symbol, T value, T approximation, Poincare::Preferences::AngleUnit angleUnit) {
|
||||
void assert_parsed_expression_approximates_with_value_for_symbol(Expression expression, const char * symbol, T value, T approximation, Poincare::Preferences::ComplexFormat complexFormat, Poincare::Preferences::AngleUnit angleUnit) {
|
||||
Shared::GlobalContext globalContext;
|
||||
T result = expression.approximateWithValueForSymbol(symbol, value, globalContext, angleUnit);
|
||||
quiz_assert(std::fabs(result - approximation) < 10.0*Expression::epsilon<T>());
|
||||
T result = expression.approximateWithValueForSymbol(symbol, value, globalContext, complexFormat, angleUnit);
|
||||
quiz_assert((std::isnan(result) && std::isnan(approximation)) || std::fabs(result - approximation) < 10.0*Expression::epsilon<T>());
|
||||
}
|
||||
|
||||
void assert_parsed_expression_simplify_to(const char * expression, const char * simplifiedExpression, Preferences::AngleUnit angleUnit, Preferences::ComplexFormat complexFormat) {
|
||||
@@ -219,5 +219,5 @@ void assert_expression_layout_serialize_to(Poincare::Layout layout, const char *
|
||||
|
||||
template void assert_parsed_expression_evaluates_to<float>(char const*, char const *, Poincare::Preferences::AngleUnit, Poincare::Preferences::ComplexFormat, int);
|
||||
template void assert_parsed_expression_evaluates_to<double>(char const*, char const *, Poincare::Preferences::AngleUnit, Poincare::Preferences::ComplexFormat, int);
|
||||
template void assert_parsed_expression_approximates_with_value_for_symbol(Poincare::Expression, const char *, float, float, Poincare::Preferences::AngleUnit);
|
||||
template void assert_parsed_expression_approximates_with_value_for_symbol(Poincare::Expression, const char *, double, double, Poincare::Preferences::AngleUnit);
|
||||
template void assert_parsed_expression_approximates_with_value_for_symbol(Poincare::Expression, const char *, float, float, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit);
|
||||
template void assert_parsed_expression_approximates_with_value_for_symbol(Poincare::Expression, const char *, double, double, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit);
|
||||
|
||||
Reference in New Issue
Block a user