Browse Source

IsExact number trait

tempestpy_adaptions
TimQu 8 years ago
parent
commit
09552d43a3
  1. 4
      src/storm/models/sparse/Model.cpp
  2. 26
      src/storm/utility/NumberTraits.h

4
src/storm/models/sparse/Model.cpp

@ -6,6 +6,7 @@
#include "storm/utility/vector.h"
#include "storm/adapters/CarlAdapter.h"
#include "storm/utility/NumberTraits.h"
#include "storm/exceptions/IllegalArgumentException.h"
#include "storm/exceptions/IllegalFunctionCallException.h"
@ -334,8 +335,7 @@ namespace storm {
template<typename ValueType, typename RewardModelType>
bool Model<ValueType, RewardModelType>::isExact() const {
// TODO: change when dedicated data-structure for exact values is present
return this->supportsParameters();
return storm::NumberTraits<ValueType>::IsExact && storm::NumberTraits<typename RewardModelType::ValueType>::IsExact;
}
template<typename ValueType, typename RewardModelType>

26
src/storm/utility/NumberTraits.h

@ -1,13 +1,39 @@
#pragma once
#include "storm/adapters/CarlAdapter.h"
namespace storm {
template<typename ValueType>
struct NumberTraits {
static const bool SupportsExponential = false;
static const bool IsExact = false;
};
template<>
struct NumberTraits<double> {
static const bool SupportsExponential = true;
static const bool IsExact = false;
};
#if defined(STORM_HAVE_CLN)
template<>
struct NumberTraits<storm::ClnRationalNumber> {
static const bool SupportsExponential = false;
static const bool IsExact = true;
};
#endif
#if defined(STORM_HAVE_GMP)
template<>
struct NumberTraits<storm::GmpRationalNumber> {
static const bool SupportsExponential = false;
static const bool IsExact = true;
};
#endif
template<>
struct NumberTraits<storm::RationalFunction> {
static const bool SupportsExponential = false;
static const bool IsExact = true;
};
}
Loading…
Cancel
Save