http://bugs.winehq.org/show_bug.cgi?id=59856 qi'ao chen <gouziwu@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gouziwu@gmail.com --- Comment #1 from qi'ao chen <gouziwu@gmail.com> --- For rint in gcc https://godbolt.org/z/4Prxxr469 for rint(-3.3)'s different behaviour With sse4.1, gcc emits roundsd If not, gcc falls back to ix86_expand_rint, whose behaviour is controlled by -frounding_math xa = fabs (operand1); if (!isless (xa, 2**52)) return operand1; two52 = 2**52; if (flag_rounding_math) { two52 = copysign (two52, operand1); xa = operand1; } xa = xa + two52 - two52; return copysign (xa, operand1); so for example, consider FE_DOWNWARD rint(-3.3) without rounding_math: xa = 3.3 + 2**52 - 2**52 = 3 + 2**52 - 2**52 = 3 return -3 with rounding_math: xa = -3.3 - 2**52 + 2**52 = -4 - 2**52 + 2**52 = -4 return -4 now in our code union {double f; uint64_t i;} u = {x}; int e = u.i>>52 & 0x7ff; int s = u.i>>63; double_t y; if (e >= 0x3ff+52) return x; if (s) y = x - toint + toint; else y = x + toint - toint; if (y == 0) return s ? -0.0 : 0; return y; s = u.i>>63 -> take sign into account, so basically its equivalent to -frounding_math so possible fix is only use __builtin_rint when we have SSE4.1 btw, seems there is no tests for musl, am i missing anything? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.