12template<
typename IntegerType>
17 if (alphaDivBetaPair.first == gammaDivDeltaPair.first && !
storm::utility::isZero(alphaDivBetaPair.second)) {
18 std::pair<IntegerType, IntegerType> subresult =
findRational(delta, gammaDivDeltaPair.second, beta, alphaDivBetaPair.second);
19 std::pair<IntegerType, IntegerType> result(alphaDivBetaPair.first * subresult.first + subresult.second, subresult.first);
23 std::pair<IntegerType, IntegerType> result(
30template<
typename RationalType,
typename ImpreciseType>
37 return std::make_pair(truncated, powerOfTen);
40template<
typename RationalType>
43 STORM_LOG_THROW(precision <= std::numeric_limits<double>::max_digits10, storm::exceptions::PrecisionExceededException,
44 "Exceeded precision of double, consider switching to rational numbers.");
46 double powerOfTen = std::pow(10, precision);
52template<
typename RationalType,
typename ImpreciseType>
53RationalType
findRational(uint64_t precision, ImpreciseType
const& value) {
64template<
typename RationalType,
typename ImpreciseType>
65RationalType
sharpen(uint64_t precision, ImpreciseType
const& value) {
67 ImpreciseType fraction = value - integer;
72template<
typename RationalType,
typename ImpreciseType>
73void sharpen(uint64_t precision, std::vector<ImpreciseType>
const& input, std::vector<RationalType>& output) {
74 for (uint64_t index = 0; index < input.size(); ++index) {
79template storm::RationalNumber
sharpen(uint64_t precision,
double const& input);
80template storm::RationalNumber
sharpen(uint64_t precision, storm::RationalNumber
const& input);
82template void sharpen(uint64_t precision, std::vector<double>
const& input, std::vector<storm::RationalNumber>& output);
83template void sharpen(uint64_t precision, std::vector<storm::RationalNumber>
const& input, std::vector<storm::RationalNumber>& output);
#define STORM_LOG_THROW(cond, exception, message)
std::pair< typename NumberTraits< RationalType >::IntegerType, typename NumberTraits< RationalType >::IntegerType > truncateToRational(ImpreciseType const &value, uint64_t precision)
std::pair< IntegerType, IntegerType > findRational(IntegerType const &alpha, IntegerType const &beta, IntegerType const &gamma, IntegerType const &delta)
RationalType sharpen(uint64_t precision, ImpreciseType const &value)
ValueType floor(ValueType const &number)
bool isZero(ValueType const &a)
NumberTraits< ValueType >::IntegerType trunc(ValueType const &number)
std::pair< IntegerType, IntegerType > divide(IntegerType const ÷nd, IntegerType const &divisor)
(Integer-)Divides the dividend by the divisor and returns the result plus the remainder.
ValueType pow(ValueType const &value, int_fast64_t exponent)
TargetType convertNumber(SourceType const &number)