NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/49256: exp2f subtests 9 and 10 of lib/libm/t_exp/exp2_values test case failing
The following reply was made to PR lib/49256; it has been noted by GNATS.
From: Tetsuya Isaki <isaki%pastel-flower.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: lib-bug-people%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost, gson%gson.org@localhost
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@localhost / isaki%NetBSD.org@localhost>
Home |
Main Index |
Thread Index |
Old Index