diff --git a/src/storm/storage/expressions/Expression.cpp b/src/storm/storage/expressions/Expression.cpp index f6459ba85..77d318606 100644 --- a/src/storm/storage/expressions/Expression.cpp +++ b/src/storm/storage/expressions/Expression.cpp @@ -414,6 +414,11 @@ namespace storm { STORM_LOG_THROW(first.hasNumericalType(), storm::exceptions::InvalidTypeException, "Operator 'ceil' requires numerical operand."); return Expression(std::shared_ptr(new UnaryNumericalFunctionExpression(first.getBaseExpression().getManager(), first.getType().floorCeil(), first.getBaseExpressionPointer(), UnaryNumericalFunctionExpression::OperatorType::Ceil))); } + + Expression round(Expression const& first) { + STORM_LOG_THROW(first.hasNumericalType(), storm::exceptions::InvalidTypeException, "Operator 'round' requires numerical operand."); + return floor(first + first.getManager().rational(0.5)); + } Expression abs(Expression const& first) { STORM_LOG_THROW(first.hasNumericalType(), storm::exceptions::InvalidTypeException, "Abs is only defined for numerical operands"); diff --git a/src/storm/storage/expressions/Expression.h b/src/storm/storage/expressions/Expression.h index 262e09208..e07e1cf1a 100644 --- a/src/storm/storage/expressions/Expression.h +++ b/src/storm/storage/expressions/Expression.h @@ -56,6 +56,7 @@ namespace storm { friend Expression sign(Expression const& first); friend Expression floor(Expression const& first); friend Expression ceil(Expression const& first); + friend Expression round(Expression const& first); friend Expression minimum(Expression const& first, Expression const& second); friend Expression maximum(Expression const& first, Expression const& second); @@ -434,6 +435,7 @@ namespace storm { Expression sign(Expression const& first); Expression floor(Expression const& first); Expression ceil(Expression const& first); + Expression round(Expression const& first); Expression minimum(Expression const& first, Expression const& second); Expression maximum(Expression const& first, Expression const& second); Expression disjunction(std::vector const& expressions);