soft-fp truncation bug fix
Jakub Jelinek
jakub@redhat.com
Thu May 3 12:17:00 GMT 2007
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
More information about the Libc-alpha
mailing list