Skip to content

Commit

Permalink
switch to if
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Oct 28, 2021
1 parent 2c21a41 commit 6cfc857
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/common/function/FunctionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,11 @@ FunctionManager::FunctionManager() {
case Value::Type::INT:
case Value::Type::FLOAT: {
if (args.size() == 2) {
switch (args[1].get().type()) {
case Value::Type::INT: {
auto decimal = args[1].get().getInt();
return std::round(args[0].get().getFloat() * pow(10, decimal)) / pow(10, decimal);
}
default: {
return Value::kNullBadType;
}
if (args[1].get().type() == Value::Type::INT) {
auto decimal = args[1].get().getInt();
return std::round(args[0].get().getFloat() * pow(10, decimal)) / pow(10, decimal);
} else {
return Value::kNullBadType;
}
}
return std::round(args[0].get().getFloat());
Expand Down

0 comments on commit 6cfc857

Please sign in to comment.