diff --git a/src/util/hwf.cpp b/src/util/hwf.cpp index 8c10e3170..914d113b2 100644 --- a/src/util/hwf.cpp +++ b/src/util/hwf.cpp @@ -383,10 +383,10 @@ void hwf_manager::round_to_integral(mpf_rounding_mode rm, hwf const & x, hwf & o } void hwf_manager::rem(hwf const & x, hwf const & y, hwf & o) { -#if defined(_WINDOWS) && _MSC_VER < 1800 +#if defined(_WINDOWS) && _MSC_VER <= 1700 o.value = fmod(x.value, y.value); - if (o.value >= (y.value/2)) - o.value /= 2.0; + if (o.value >= (y.value/2.0)) + o.value -= y.value; #else o.value = remainder(x.value, y.value); #endif diff --git a/src/util/mpf.cpp b/src/util/mpf.cpp index 07ccd3c7b..1bf968cdd 100644 --- a/src/util/mpf.cpp +++ b/src/util/mpf.cpp @@ -1411,8 +1411,13 @@ std::string mpf_manager::to_string_hexfloat(mpf const & x) { std::stringstream ss(""); std::ios::fmtflags ff = ss.setf(std::ios_base::hex | std::ios_base::uppercase | std::ios_base::showpoint | std::ios_base::showpos); + ss.setf(ff); ss.precision(13); +#if defined(_WIN32) && _MSC_VER >= 1800 ss << std::hexfloat << to_double(x); +#else + ss << std::hex << (*reinterpret_cast(&(x))); +#endif return ss.str(); }