This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: soft-fp truncation bug fix
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 3 May 2007 14:25:21 +0200
- Subject: Re: soft-fp truncation bug fix
- References: <Pine.LNX.4.64.0704302222490.32667@digraph.polyomino.org.uk>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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