Browse Source

fix, BinaryNumericalFunctionExpression: simplify for pow(a,b) in double context should not cast result to integer [with Linda Leuschner]

Small test case:

dtmc
const double x = 1E-2;
const double y = pow(1-x, 10);
module M1
  s: [0..2] init 0;
  [] s = 0 -> y:(s'=1) + (1-y):(s'=2);
endmodule

should satisfy Pmax>0 [F (s = 1)].
tempestpy_adaptions
JK 8 years ago
parent
commit
eee1a84562
  1. 2
      src/storm/storage/expressions/BinaryNumericalFunctionExpression.cpp

2
src/storm/storage/expressions/BinaryNumericalFunctionExpression.cpp

@ -99,7 +99,7 @@ namespace storm {
case OperatorType::Times: newValue = firstOperandEvaluation * secondOperandEvaluation; break;
case OperatorType::Min: newValue = std::min(firstOperandEvaluation, secondOperandEvaluation); break;
case OperatorType::Max: newValue = std::max(firstOperandEvaluation, secondOperandEvaluation); break;
case OperatorType::Power: newValue = static_cast<int_fast64_t>(std::pow(firstOperandEvaluation, secondOperandEvaluation)); break;
case OperatorType::Power: newValue = std::pow(firstOperandEvaluation, secondOperandEvaluation); break;
case OperatorType::Divide: STORM_LOG_THROW(false, storm::exceptions::InvalidStateException, "Unable to simplify division."); break;
}
return std::shared_ptr<BaseExpression>(new RationalLiteralExpression(this->getManager(), newValue));

Loading…
Cancel
Save