https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48140
Albert Chan <albertmcchan at yahoo dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |albertmcchan at yahoo dot com --- Comment #4 from Albert Chan <albertmcchan at yahoo dot com> --- I think fmod is accurate Gcc cannot do exact fmod(1e9, 2*pi) it can only do fmod(1e9, 0x1.921f54442d18p+2) = 0.57739546248310347 which is exactly what gcc returns in fact, it is VERY accurate If we do remainder calculation in steps: quotient = floor(1e9 / (2 pi)) = 159154943 remainder = 1e9 - quotient * 0x1.921f54442d18p+2 = 0.57739543914794922 doing in steps under-counted 210,184,384 ULP