11template<
typename ValueType>
13 STORM_LOG_ASSERT(j.is_number_float(),
"Expected a json object of type float.");
14 auto jDump = j.dump();
18 if (jDump ==
"null") {
22 auto parsed = storm::utility::convertNumber<storm::RationalNumber, std::string>(jDump);
24 if constexpr (std::is_same_v<ValueType, storm::RationalNumber>) {
25 return parsed == j.template get_ref<ValueType const&>();
27 return parsed == storm::utility::convertNumber<storm::RationalNumber>(j.template get_ref<ValueType const&>());
31template<
typename ValueType,
typename CallBack>
33 if (j.is_structured()) {
34 for (
auto const& ji : j) {
37 }
else if (j.is_number_float()) {
42template<
typename ValueType>
44 std::stringstream message;
45 uint64_t num_bad(0), num_all(0);
51 auto const& actualValue = v_json.template get_ref<ValueType const&>();
52 message <<
"Inaccurate JSON export: The number " << actualValue <<
" will be exported as " << v_json.dump() <<
". ";
56 STORM_LOG_WARN_COND(num_bad == 0, message.str() <<
"In total, " << num_bad <<
" of " << num_all <<
" numbers are inaccurate.");
59template<
typename ValueType>
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
void warnIfJsonExportNotAccurate(storm::json< ValueType > const &j)
bool isJsonNumberExportAccurate(storm::json< ValueType > const &j)
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
std::string dumpJson(storm::json< ValueType > const &j, bool compact)
Dumps the given json object, producing a String.
void json_for_each_number_float(storm::json< ValueType > const &j, CallBack const &f)