Browse Source

Fixed static conversion bugs in the IR section

Former-commit-id: 6b63d4900e
main
PBerger 12 years ago
parent
commit
47f7bf875d
  1. 2
      src/ir/expressions/IntegerConstantExpression.cpp
  2. 2
      src/ir/expressions/IntegerLiteralExpression.cpp
  3. 2
      src/ir/expressions/VariableExpression.cpp

2
src/ir/expressions/IntegerConstantExpression.cpp

@ -27,7 +27,7 @@ namespace storm {
}
double IntegerConstantExpression::getValueAsDouble(std::pair<std::vector<bool>, std::vector<int_fast64_t>> const* variableValues) const {
return getValueAsInt(variableValues);
return static_cast<double>(getValueAsInt(variableValues));
}
int_fast64_t IntegerConstantExpression::getValueAsInt(std::pair<std::vector<bool>, std::vector<int_fast64_t>> const* variableValues) const {

2
src/ir/expressions/IntegerLiteralExpression.cpp

@ -27,7 +27,7 @@ namespace storm {
}
double IntegerLiteralExpression::getValueAsDouble(std::pair<std::vector<bool>, std::vector<int_fast64_t>> const* variableValues) const {
return value;
return static_cast<double>(value);
}
int_fast64_t IntegerLiteralExpression::getValueAsInt(std::pair<std::vector<bool>, std::vector<int_fast64_t>> const* variableValues) const {

2
src/ir/expressions/VariableExpression.cpp

@ -83,7 +83,7 @@ namespace storm {
// Because only int variables can deliver a double value, we only need to check them.
if (variableValues != nullptr) {
return variableValues->second[globalIndex];
return static_cast<double>(variableValues->second[globalIndex]);
} else {
throw storm::exceptions::ExpressionEvaluationException() << "Cannot evaluate expression with variable '" << variableName << "' of type double.";
}

Loading…
Cancel
Save