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/3325] Implementation of fpmod should use fprem1, not fprem


------- Additional Comments From jakub at redhat dot com  2007-02-21 19:52 -------
Except that fmod{,f,l} as defined in ISO C99 and POSIX
requires the semantics that fprem provides.
E.g. ISO C99 in 7.12.10.1 says:
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.
http://www.posix.nl/linuxassembly/nasmdochtml/nasmdoca.html
says fprem behaves exactly that way, while fprem1 rounds the division to nearest
and thus can return different sign of result from x, but result absolute value
won't be bigger than half of abs(y).
So, by changing fprem in fmod/fmodf/fmodl implementation to fprem1 you are
breaking e.g.
fmod (6.5, 2.25) which is supposed to return 2.0 (and was until now), while with
fprem1 it returns -0.25.

The patch has been reverted in CVS.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://sourceware.org/bugzilla/show_bug.cgi?id=3325

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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