http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49010
--- Comment #5 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-05-17 05:51:56 UTC --- The fmod behaviour is correct for x < 0 according to N1548: double fmod(double x, double y); float fmodf(float x, float y); The fmod functions return the value x−ny, for some integer n such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y. If y is zero, whether a domain error occurs or the fmod functions return zero is implementation-defined.