Skip to content

Commit

Permalink
[Rules] Fix order of parsing "arc" functions
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Jan 9, 2021
1 parent 12bd666 commit 7752897
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/src/Helpers/Rules_calculate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,23 +548,24 @@ String RulesCalculate_t::preProces(const String& input)
preProcessReplace(preprocessed, UnaryOperator::Ln);
preProcessReplace(preprocessed, UnaryOperator::Sqrt);
#ifdef USE_TRIGONOMETRIC_FUNCTIONS_RULES
// Try the "arc" functions first, or else "sin" is already replaced when "asin" is tried.
if (preprocessed.indexOf(F("sin")) != -1) {
preProcessReplace(preprocessed, UnaryOperator::Sin);
preProcessReplace(preprocessed, UnaryOperator::ArcSin);
preProcessReplace(preprocessed, UnaryOperator::Sin_d);
preProcessReplace(preprocessed, UnaryOperator::ArcSin_d);
preProcessReplace(preprocessed, UnaryOperator::Sin);
preProcessReplace(preprocessed, UnaryOperator::Sin_d);
}
if (preprocessed.indexOf(F("cos")) != -1) {
preProcessReplace(preprocessed, UnaryOperator::Cos);
preProcessReplace(preprocessed, UnaryOperator::ArcCos);
preProcessReplace(preprocessed, UnaryOperator::Cos_d);
preProcessReplace(preprocessed, UnaryOperator::ArcCos_d);
preProcessReplace(preprocessed, UnaryOperator::Cos);
preProcessReplace(preprocessed, UnaryOperator::Cos_d);
}
if (preprocessed.indexOf(F("tan")) != -1) {
preProcessReplace(preprocessed, UnaryOperator::Tan);
preProcessReplace(preprocessed, UnaryOperator::ArcTan);
preProcessReplace(preprocessed, UnaryOperator::Tan_d);
preProcessReplace(preprocessed, UnaryOperator::ArcTan_d);
preProcessReplace(preprocessed, UnaryOperator::Tan);
preProcessReplace(preprocessed, UnaryOperator::Tan_d);
}
#endif
return preprocessed;
Expand Down

0 comments on commit 7752897

Please sign in to comment.