diff --git a/poincare/include/poincare/approximation_helper.h b/poincare/include/poincare/approximation_helper.h index 6634e7646..169143faf 100644 --- a/poincare/include/poincare/approximation_helper.h +++ b/poincare/include/poincare/approximation_helper.h @@ -9,7 +9,7 @@ namespace Poincare { namespace ApproximationHelper { - template int IntegerApproximationIfPossible(const ExpressionNode * expression, bool * isUndefined, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit); + template int PositiveIntegerApproximationIfPossible(const ExpressionNode * expression, bool * isUndefined, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit); template std::complex TruncateRealOrImaginaryPartAccordingToArgument(std::complex c); template using ComplexCompute = Complex(*)(const std::complex, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit); diff --git a/poincare/src/approximation_helper.cpp b/poincare/src/approximation_helper.cpp index 2cc0b81a5..32f1f88ad 100644 --- a/poincare/src/approximation_helper.cpp +++ b/poincare/src/approximation_helper.cpp @@ -17,7 +17,7 @@ template T absMod(T a, T b) { static inline int absInt(int x) { return x < 0 ? -x : x; } -template int ApproximationHelper::IntegerApproximationIfPossible(const ExpressionNode * expression, bool * isUndefined, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) { +template int ApproximationHelper::PositiveIntegerApproximationIfPossible(const ExpressionNode * expression, bool * isUndefined, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) { Evaluation evaluation = expression->approximate(T(), context, complexFormat, angleUnit); T scalar = evaluation.toScalar(); if (std::isnan(scalar) || scalar != (int)scalar) { @@ -104,8 +104,8 @@ template MatrixComplex ApproximationHelper::ElementWiseOnComplexM return matrix; } -template int Poincare::ApproximationHelper::IntegerApproximationIfPossible(Poincare::ExpressionNode const*, bool*, Poincare::Context*, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit); -template int Poincare::ApproximationHelper::IntegerApproximationIfPossible(Poincare::ExpressionNode const*, bool*, Poincare::Context*, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit); +template int Poincare::ApproximationHelper::PositiveIntegerApproximationIfPossible(Poincare::ExpressionNode const*, bool*, Poincare::Context*, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit); +template int Poincare::ApproximationHelper::PositiveIntegerApproximationIfPossible(Poincare::ExpressionNode const*, bool*, Poincare::Context*, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit); template std::complex Poincare::ApproximationHelper::TruncateRealOrImaginaryPartAccordingToArgument(std::complex); template std::complex Poincare::ApproximationHelper::TruncateRealOrImaginaryPartAccordingToArgument(std::complex); template Poincare::Evaluation Poincare::ApproximationHelper::Map(const Poincare::ExpressionNode * expression, Poincare::Context * context, Poincare::Preferences::ComplexFormat, Poincare::Preferences::AngleUnit angleUnit, Poincare::ApproximationHelper::ComplexCompute compute); diff --git a/poincare/src/great_common_divisor.cpp b/poincare/src/great_common_divisor.cpp index a66d3525e..d9e9faec0 100644 --- a/poincare/src/great_common_divisor.cpp +++ b/poincare/src/great_common_divisor.cpp @@ -29,8 +29,8 @@ Expression GreatCommonDivisorNode::shallowReduce(ReductionContext reductionConte template Evaluation GreatCommonDivisorNode::templatedApproximate(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) const { bool isUndefined = false; - int a = ApproximationHelper::IntegerApproximationIfPossible(childAtIndex(0), &isUndefined, context, complexFormat, angleUnit); - int b = ApproximationHelper::IntegerApproximationIfPossible(childAtIndex(1), &isUndefined, context, complexFormat, angleUnit); + int a = ApproximationHelper::PositiveIntegerApproximationIfPossible(childAtIndex(0), &isUndefined, context, complexFormat, angleUnit); + int b = ApproximationHelper::PositiveIntegerApproximationIfPossible(childAtIndex(1), &isUndefined, context, complexFormat, angleUnit); if (isUndefined) { return Complex::Undefined(); } diff --git a/poincare/src/least_common_multiple.cpp b/poincare/src/least_common_multiple.cpp index c6a104fed..cb356e338 100644 --- a/poincare/src/least_common_multiple.cpp +++ b/poincare/src/least_common_multiple.cpp @@ -29,8 +29,8 @@ Expression LeastCommonMultipleNode::shallowReduce(ReductionContext reductionCont template Evaluation LeastCommonMultipleNode::templatedApproximate(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) const { bool isUndefined = false; - int a = ApproximationHelper::IntegerApproximationIfPossible(childAtIndex(0), &isUndefined, context, complexFormat, angleUnit); - int b = ApproximationHelper::IntegerApproximationIfPossible(childAtIndex(1), &isUndefined, context, complexFormat, angleUnit); + int a = ApproximationHelper::PositiveIntegerApproximationIfPossible(childAtIndex(0), &isUndefined, context, complexFormat, angleUnit); + int b = ApproximationHelper::PositiveIntegerApproximationIfPossible(childAtIndex(1), &isUndefined, context, complexFormat, angleUnit); if (isUndefined) { return Complex::Undefined(); }