This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/19869] floor and fmod not consistent with each other


https://sourceware.org/bugzilla/show_bug.cgi?id=19869

--- Comment #10 from Robert Dodier <robert.dodier at gmail dot com> ---
(In reply to Andreas Schwab from comment #7)
> remainder(8, 1.6) returns -4.4e-16, thus, per definitionem, fmod(8, 1.6)
> returns remainder(8, 1.6) + 1.6 = 1.5999999999999996447.

Andreas, I'm not sure why you're bringing 'remainder' into the picture, as
description of fmod in the glibc documentation [1] is that "the return value is
numerator - n * denominator, where n is the quotient of numerator divided by
denominator, rounded towards zero to an integer."

Incidentally the description of floor [2] is that it is supposed to "round x
downwards to the nearest integer". That seems to suggest that
floor(numerator/denominator) is the same as n in the description of fmod.

[1] http://www.gnu.org/software/libc/manual/html_node/Remainder-Functions.html
[2] http://www.gnu.org/software/libc/manual/html_node/Rounding-Functions.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]