Browse Source

Ensured that utility function for rounding always rounds towards infinity.

tempestpy_adaptions
Tim Quatmann 6 years ago
parent
commit
b70f28b10e
  1. 15
      src/storm/utility/constants.cpp

15
src/storm/utility/constants.cpp

@ -258,7 +258,8 @@ namespace storm {
template<typename ValueType>
ValueType round(ValueType const& number) {
return std::round(number);
// Rounding towards infinity
return floor<ValueType >(number + storm::utility::convertNumber<ValueType>(0.5));
}
template<typename ValueType>
@ -422,11 +423,6 @@ namespace storm {
return carl::ceil(number);
}
template<>
ClnRationalNumber round(storm::ClnRationalNumber const& number) {
return carl::round(number);
}
template<>
ClnRationalNumber log(ClnRationalNumber const& number) {
return carl::log(number);
@ -620,11 +616,6 @@ namespace storm {
return carl::ceil(number);
}
template<>
GmpRationalNumber round(storm::GmpRationalNumber const& number) {
return carl::round(number);
}
template<>
GmpRationalNumber log(GmpRationalNumber const& number) {
return carl::log(number);
@ -991,6 +982,7 @@ namespace storm {
template storm::ClnRationalNumber maximum(std::vector<storm::ClnRationalNumber> const&);
template storm::ClnRationalNumber max(storm::ClnRationalNumber const& first, storm::ClnRationalNumber const& second);
template storm::ClnRationalNumber min(storm::ClnRationalNumber const& first, storm::ClnRationalNumber const& second);
template storm::ClnRationalNumber round(storm::ClnRationalNumber const& number);
template std::string to_string(storm::ClnRationalNumber const& value);
#endif
@ -1015,6 +1007,7 @@ namespace storm {
template storm::GmpRationalNumber maximum(std::vector<storm::GmpRationalNumber> const&);
template storm::GmpRationalNumber max(storm::GmpRationalNumber const& first, storm::GmpRationalNumber const& second);
template storm::GmpRationalNumber min(storm::GmpRationalNumber const& first, storm::GmpRationalNumber const& second);
template storm::GmpRationalNumber round(storm::GmpRationalNumber const& number);
template std::string to_string(storm::GmpRationalNumber const& value);
#endif
Loading…
Cancel
Save