CVSROOT: /cvs Module name: src Changes by: marty...@cvs.openbsd.org 2011/04/10 14:42:09
Modified files: lib/libm/src : s_lrint.c s_lrintf.c Log message: The {,l}lrint{,f} functions avoid to shift results by more than 31 bits, because "behavior is implementation defined in this case". However, this is wrong; behavior is undefined if the right operand is greater than or equal to the width of the promoted left operand. This broke {,l}lrint{,f} (64-bit architectures), and llrint{,f} (32-bit architectures) where results are actually 64-bit values. The high part was clipped for all exponents greater or equal to 52. Fix this to use RESTYPE_BITS instead; {,l}lrint{,f} are now able to pass our regression tests, and I think are right now.