diff --git a/src/Issue230Helpers.h b/src/Issue230Helpers.h new file mode 100644 index 000000000..c183dc527 --- /dev/null +++ b/src/Issue230Helpers.h @@ -0,0 +1,15 @@ +#pragma once + +template +bool isIssue230(MType& m_type, MValue& m_value){ + if(m_value.number_float != 23.42) + return false; + if(m_type.bits.exp_cap == 0 and + m_type.bits.exp_plus == 0 and + m_type.bits.has_exp == 1 and + m_type.bits.parsed == 1 and + m_type.bits.precision == 0 and + m_type.bits.type == 7) + return true; + return false; +} \ No newline at end of file diff --git a/src/json.hpp b/src/json.hpp index 60387e9c9..49e88fa65 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -52,6 +52,7 @@ SOFTWARE. #include #include #include +#include "Issue230Helpers.h" // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) @@ -6297,8 +6298,16 @@ class basic_json std::stringstream applesauce; applesauce << o.rdbuf(); std::string s2 = applesauce.str(); - if(s2.compare("2e01") == 0) + if(isIssue230(m_type,m_value)) { + printf("m_type.bits.exp_cap = %i \n",m_type.bits.exp_cap); + printf("m_type.bits.exp_plus = %i \n",m_type.bits.exp_plus); + printf("m_type.bits.has_exp = %i \n",m_type.bits.has_exp); + printf("m_type.bits.parsed = %i \n",m_type.bits.parsed); + printf("m_type.bits.precision = %i \n",m_type.bits.precision); + printf("m_type.bits.type = %i \n",m_type.bits.type); + printf("m_value = %f\n",m_value.number_float); throw std::logic_error("found it"); + } } else {