This is the mail archive of the libc-alpha@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]

Re: soft-fp truncation bug fix


On Mon, Apr 30, 2007 at 10:24:36PM +0000, Joseph S. Myers wrote:
> This patch fixes a bug in soft-fp's truncation that showed up with the GCC 
> test gcc.c-torture/execute/ieee/20000320-1.c:
> 
> * An off-by-one error meant values between half the smallest denormal and 
> the smallest denormal got truncated to 0.
> 
> * Even for smaller exponents, the truncation needs to set the sticky bit 
> for the sake of rounding modes where the result should be the smallest 
> denormal not 0.
> 
> 2007-04-30  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* soft-fp/op-common.h (FP_TRUNC): Correct off-by-one error in
> 	condition for truncating to 0.  Set sticky bit for such
> 	truncation.

Thanks, committed together with a testcase, which on sparc fails with:
0x1.2p-1075 incorrectly rounded to 0x0p+0
0x1.4p-1075 incorrectly rounded to 0x0p+0
0x1.6p-1075 incorrectly rounded to 0x0p+0
0x1.8p-1075 incorrectly rounded to 0x0p+0
0x1.ap-1075 incorrectly rounded to 0x0p+0
0x1.cp-1075 incorrectly rounded to 0x0p+0
0x1.ep-1075 incorrectly rounded to 0x0p+0
without your soft-fp/op-common.h fix and succeeds with it.

	Jakub


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