mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare/test] Add failing test on multiplication simplification
This commit is contained in:
committed by
RubenNumworks
parent
13b2deb714
commit
97d94d9e56
@@ -938,6 +938,9 @@ QUIZ_CASE(poincare_approximation_mix) {
|
||||
assert_expression_approximates_to<double>("sin(3)2(4+2)", "1.6934400967184", Radian);
|
||||
assert_expression_approximates_to<float>("4/2×(2+3)", "10");
|
||||
assert_expression_approximates_to<double>("4/2×(2+3)", "10");
|
||||
|
||||
assert_expression_simplifies_and_approximates_to("1.0092^(20)", "1.2010050593402");
|
||||
assert_expression_simplifies_and_approximates_to("1.0092^(50)×ln(3/2)", "6.4093734888993ᴇ-1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -108,6 +108,16 @@ void assert_expression_approximates_to(const char * expression, const char * app
|
||||
}, numberOfDigits);
|
||||
}
|
||||
|
||||
void assert_expression_simplifies_and_approximates_to(const char * expression, const char * approximation, Preferences::AngleUnit angleUnit, Preferences::ComplexFormat complexFormat, int numberOfSignificantDigits) {
|
||||
int numberOfDigits = numberOfSignificantDigits > 0 ? numberOfSignificantDigits : PrintFloat::k_numberOfStoredSignificantDigits;
|
||||
assert_parsed_expression_process_to(expression, approximation, SystemForApproximation, complexFormat, angleUnit, ReplaceAllSymbolsWithDefinitionsOrUndefined, [](Expression e, ExpressionNode::ReductionContext reductionContext) {
|
||||
Expression reduced;
|
||||
Expression approximated;
|
||||
e.simplifyAndApproximate(&reduced, &approximated, reductionContext.context(), reductionContext.complexFormat(), reductionContext.angleUnit(), reductionContext.symbolicComputation());
|
||||
return approximated;
|
||||
}, numberOfDigits);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void assert_expression_simplifies_approximates_to(const char * expression, const char * approximation, Preferences::AngleUnit angleUnit, Preferences::ComplexFormat complexFormat, int numberOfSignificantDigits) {
|
||||
int numberOfDigits = sizeof(T) == sizeof(double) ? PrintFloat::k_numberOfStoredSignificantDigits : PrintFloat::k_numberOfPrintedSignificantDigits;
|
||||
|
||||
@@ -43,6 +43,7 @@ void assert_parsed_expression_simplify_to(const char * expression, const char *
|
||||
|
||||
template<typename T>
|
||||
void assert_expression_approximates_to(const char * expression, const char * approximation, Poincare::Preferences::AngleUnit angleUnit = Degree, Poincare::Preferences::ComplexFormat complexFormat = Cartesian, int numberOfSignificantDigits = -1);
|
||||
void assert_expression_simplifies_and_approximates_to(const char * expression, const char * approximation, Poincare::Preferences::AngleUnit angleUnit = Degree, Poincare::Preferences::ComplexFormat complexFormat = Cartesian, int numberOfSignificantDigits = -1);
|
||||
template<typename T>
|
||||
void assert_expression_simplifies_approximates_to(const char * expression, const char * approximation, Poincare::Preferences::AngleUnit angleUnit = Degree, Poincare::Preferences::ComplexFormat complexFormat = Cartesian, int numberOfSignificantDigits = -1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user