diff --git a/src/storage/expressions/UnaryNumericalFunctionExpression.cpp b/src/storage/expressions/UnaryNumericalFunctionExpression.cpp index adec2af05..6e2a13ae0 100644 --- a/src/storage/expressions/UnaryNumericalFunctionExpression.cpp +++ b/src/storage/expressions/UnaryNumericalFunctionExpression.cpp @@ -61,15 +61,21 @@ namespace storm { } boost::variant result; - switch (this->getOperatorType()) { - case OperatorType::Minus: result = -(operandSimplified->hasIntegerType() ? boost::get(operandEvaluation) : boost::get(operandEvaluation)); break; - case OperatorType::Floor: result = std::floor(operandSimplified->hasIntegerType() ? boost::get(operandEvaluation) : boost::get(operandEvaluation)); break; - case OperatorType::Ceil: result = std::ceil(operandSimplified->hasIntegerType() ? boost::get(operandEvaluation) : boost::get(operandEvaluation)); break; - } - - if (result.type() == typeid(int_fast64_t)) { - return std::shared_ptr(new IntegerLiteralExpression(this->getManager(), boost::get(result))); + if (operandSimplified->hasIntegerType()) { + int_fast64_t value = 0; + switch (this->getOperatorType()) { + case OperatorType::Minus: value = -boost::get(operandEvaluation); break; + case OperatorType::Floor: value = std::floor(boost::get(operandEvaluation)); break; + case OperatorType::Ceil: value = std::ceil(boost::get(operandEvaluation)); break; + } + return std::shared_ptr(new IntegerLiteralExpression(this->getManager(), value)); } else { + double value = 0; + switch (this->getOperatorType()) { + case OperatorType::Minus: value = -boost::get(operandEvaluation); break; + case OperatorType::Floor: value = std::floor(boost::get(operandEvaluation)); break; + case OperatorType::Ceil: value = std::ceil(boost::get(operandEvaluation)); break; + } return std::shared_ptr(new DoubleLiteralExpression(this->getManager(), boost::get(result))); } }