Browse Source

implemented creation of round expression.

tempestpy_adaptions
Tim Quatmann 6 years ago
parent
commit
66a7bd5954
  1. 5
      src/storm/storage/expressions/Expression.cpp
  2. 2
      src/storm/storage/expressions/Expression.h

5
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<BaseExpression>(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");

2
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<storm::expressions::Expression> const& expressions);

Loading…
Cancel
Save