NetBSD Problem Report #49256
From gson@gson.org Sat Oct 4 18:02:54 2014
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 58635A6552
for <gnats-bugs@gnats.NetBSD.org>; Sat, 4 Oct 2014 18:02:54 +0000 (UTC)
Message-Id: <20141004180241.E7E30744193@guava.gson.org>
Date: Sat, 4 Oct 2014 21:02:41 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@gnats.NetBSD.org
Subject: exp2f subtests 9 and 10 of lib/libm/t_exp/exp2_values test case failing
X-Send-Pr-Version: 3.95
>Number: 49256
>Category: lib
>Synopsis: exp2f subtests 9 and 10 of lib/libm/t_exp/exp2_values test case failing
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 04 18:05:00 +0000 2014
>Closed-Date: Tue Oct 07 16:57:00 +0000 2014
>Last-Modified: Sun Dec 07 14:35:01 +0000 2014
>Originator: Andreas Gustafsson
>Release: NetBSD-curent, source date >= 2014.03.16.22.51.19
>Organization:
>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:
Subtests 9 and 10 of the exp2_values test case have failed in every
run since they were added in src/tests/lib/libm/t_exp.c revision 1.6
on CVS date 2014.03.16.22.51.19.
Log messages from a recent failure:
*** Check failed: subtest 9: exp2f(7.7) is 207.937 (0xc.fefc4000000000p+4) not 207.937 (0xc.fefc5e67299f0p+4), error 2.89945e-05 (0xf.3394d0p-19) > 2.28882e-05
*** Check failed: subtest 10: exp2f(8.8) is 445.722 (0xd.edc69000000000p+5) not 445.722 (0xd.edc66d6df0920p+5), error 6.59381e-05 (0x8.a483dcp-17) > 4.57764e-05
The commit message for the test cases notes that "exp2f(7.7) and
exp2f(8.8) seem too far from their expected values (especially the
latter)".
The tests fail on all three archs being tested using qemu on the TNF
testbed (i386, amd64, and sparc), and also when running on the bare
metal (tested on amd64), so it's not a qemu issue; I'm assuming it's
an actual bug in libm.
>How-To-Repeat:
Run the ATF tests.
>Fix:
>Release-Note:
>Audit-Trail:
From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, gson@gson.org
Subject: Re: lib/49256: exp2f subtests 9 and 10 of lib/libm/t_exp/exp2_values test case failing
Date: Sun, 05 Oct 2014 12:17:42 +0900
According to Makoto Kamada's analisys,
it's a mistake to share the expected value of exp2f(7.7)
with the expected value of exp2(7.7) in tests/lib/libm/t_exp.c.
This test runs exp2f((float)7.7) = 207.93658...
but the expected value was calculated by exp2((double)7.7) = 207.93661...
This problem is only actualized with the case of 7.7 and 8.8,
but the other cases (1.1 - 6.6) has the same problem.
Here is a sample code to help to understand.
% cat a.c
#include <stdio.h>
#include <stdint.h>
#include <math.h>
int main(int ac, char *av[])
{
float a;
float b;
float f = 7.7;
double d = 7.7;
a = (float)exp2((double)f);
b = (float)exp2(d);
printf("exp2((float)7.7) = %8.8g (0x%08x)\n", a, *(uint32_t*)&a);
printf("exp2((double)7.7) = %8.8g (0x%08x)\n", b, *(uint32_t*)&b);
return 0;
}
% gcc a.c -lm && ./a.out
exp2((float)7.7) = 207.93658 (0x434fefc4)
exp2((double)7.7) = 207.93661 (0x434fefc6)
%
---
Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>
From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49256 CVS commit: src/tests/lib/libm
Date: Tue, 7 Oct 2014 16:53:44 +0000
Module Name: src
Committed By: gson
Date: Tue Oct 7 16:53:44 UTC 2014
Modified Files:
src/tests/lib/libm: t_exp.c
Log Message:
In the exp2_values test case, provide separate expected return values
for the float case, reflecting the actual exp2f() argument value after
rounding to float precision. Fixes PR lib/49256. Thanks to Makoto
Kamada and Tetsuya Isaki for the analysis.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libm/t_exp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Tue, 07 Oct 2014 16:57:00 +0000
State-Changed-Why:
Was a bug in the test, not libm, and is now fixed.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49256 CVS commit: [netbsd-7] src/tests/lib/libm
Date: Sun, 7 Dec 2014 14:32:04 +0000
Module Name: src
Committed By: martin
Date: Sun Dec 7 14:32:04 UTC 2014
Modified Files:
src/tests/lib/libm [netbsd-7]: t_exp.c
Log Message:
Pull up following revision(s) (requested by gson in ticket #296):
tests/lib/libm/t_exp.c: revision 1.8
In the exp2_values test case, provide separate expected return values
for the float case, reflecting the actual exp2f() argument value after
rounding to float precision. Fixes PR lib/49256. Thanks to Makoto
Kamada and Tetsuya Isaki for the analysis.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/tests/lib/libm/t_exp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.