Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fintarin committed Oct 27, 2023
1 parent a33b5d4 commit f18058b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/fintamath/core/MultiMethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MultiMethod<Res(ArgsBase...)> {
}

bool contains(const auto &...args) const {
return callbacks.find(CallbackId(args.getType()...)) != callbacks.end();
return callbacks.contains(CallbackId(args.getType()...));
}

private:
Expand Down
9 changes: 5 additions & 4 deletions src/fintamath/expressions/IExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,11 @@ ArgumentPtr IExpression::approximateSimplify() const {

bool containsVar = containsVariable(simplExpr);

if (containsVar) {
if (numberChildrenCount < 2 || IFunction::Type(approxChildren.size()) == getFunction()->getFunctionType()) {
return approxExpr;
}
if (containsVar &&
(numberChildrenCount < 2 ||
IFunction::Type(approxChildren.size()) == getFunction()->getFunctionType())) {

return approxExpr;
}

ArgumentPtr approxSimpl = approxExpr->simplify();
Expand Down
4 changes: 2 additions & 2 deletions src/fintamath/functions/powers/Root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ std::unique_ptr<IMathObject> Root::rootSimplify(const Rational &lhs, const Integ

if (ArgumentPtr numeratorRes = perfectRoot(lhs.numerator(), rhs)) {
if (ArgumentPtr denominatorRes = perfectRoot(lhs.denominator(), rhs)) {
auto numer = cast<Integer>(*numeratorRes);
auto denom = cast<Integer>(*denominatorRes);
const auto &numer = cast<Integer>(*numeratorRes);
const auto &denom = cast<Integer>(*denominatorRes);
return Rational(numer, denom).toMinimalObject();
}

Expand Down

0 comments on commit f18058b

Please sign in to comment.