https://bugs.winehq.org/show_bug.cgi?id=52393
--- Comment #24 from Piotr Caban piotr.caban@gmail.com --- (In reply to labre from comment #22)
Created attachment 71712 [details] Fixing patch against regression commit
There are few problems with attached patch: fpcontrol = _control87(0, 0); _control87(MSVCRT__EM_DENORMAL|MSVCRT__EM_INVALID|MSVCRT__EM_ZERODIVIDE |MSVCRT__EM_OVERFLOW|MSVCRT__EM_UNDERFLOW|MSVCRT__EM_INEXACT, 0xffffffff); if (!m) return sign * 0.0; You're not restoring fp control word in m==0 case.
if (exp < -(1<<EXP_BITS)) { if (err) *err = MSVCRT_ERANGE; result = sign * 0.0; _control87(fpcontrol, 0xffffffff); } You have removed return sign * 0.0 in this if statement.
The patch is removing the _control87 calls because it's no longer needed. The conversion is done using integers. All floating operations were removed except of sign*0.0 and sign*INFINITY (and none of this calls depends on fp control word value). Maybe it will be cleaner to change it to something like (sign == 1 ? 0.0 : -0.0) and (sign == 1 ? INFINITY : -INFINITY) but it shouldn't matter.