| Summary: | LSB 4.1: error from "abs" of math function | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Xiaofeng Yan <Xiaofeng.yan> | ||||
| Component: | core | Assignee: | Kai Kang <kai.kang> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Medium | CC: | brett.ciphery, jessica.zhang, kai.kang, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, sgw, yi.zhao | ||||
| Version: | 1.0-alpha | ||||||
| Target Milestone: | 1.4 M4 | ||||||
| Hardware: | mpc8315e-rdb | ||||||
| OS: | ppc | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | --- | |||||
| Attachments: |
|
||||||
|
Description
Xiaofeng Yan
2011-05-27 05:09:10 UTC
I record this bug and will fix it on 1.1 Created attachment 169 [details]
test program about data type long double
Hi Mark,
This bug is caused by data type "long double".
Please check attachment to get test program.
Look at my test steps
$./powerpc-poky-linux-g++ abs.cc -o abs -g
mpc8315e#./abs
c
When I run this program on x86 (OS ubuntu), I got information "a" instead of "c". The correct result should be "a".
if the type of variable "ld1" and "ld2" is "long" or "double", output information is "a" on mpc8315e.
I think it is float-precision problem. I don't know this bug comes from hardware or complication tool or glibc? Can you give me suggestion about my question?
I have checked that mpc8315e supports hard-float.
TARGET_CC_ARCH = "-mcpu=603e -mhard-float"
The following information come from gdb
test01_do<long double> (a=-3.2000000000000002, b=1.3999999999999999)
at abs.cc:11
11 bool test __attribute__((unused)) = true;
(gdb) n
14 T eps = numeric_limits<T>::epsilon() * 100;
(gdb) n
16 cplx ref = pow(cplx(a, T()), cplx(b, T()));
(gdb) n
17 cplx res1 = pow(a, cplx(b, T()));
(gdb) n
18 cplx res2 = pow(cplx(a, T()), b);
(gdb) n
20 assert (abs(ref - res1) < eps);
(gdb) p ref
$1 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res1
$2 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res2
$3 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p eps
$4 = 4.9406564584124654e-322
(gdb) n
21 assert( abs(ref - res2) < eps );
(gdb) p eps
$5 = 4.9406564584124654e-322
(gdb) p ref
$6 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p eps
$7 = 4.9406564584124654e-322
(gdb) p ref
$8 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res1
$9 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res2
$10 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p ref
$11 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) n
abs: abs.cc:21: void test01_do(T, T) [with T = long double]: Assertion `abs(ref - res2) < eps' failed.
Program received signal SIGABRT, Aborted.
0x0fe55e9c in raise () from /lib/libc.so.6
Hi Mark, I also check the user manual of e300 core. It says single-precision(32bits) and double-precision(64 bits) can be supported but I don't know whether quad-precision(128 bits) is supported or not? I can't find this words. I also run this test binary on wind river ppc(e440) platform and get same result. I guess it could be real hardware problem. At present wind river makes lsb test by LSB 4.0. We use LSB 4.1 to make lsb test for yocto. This looks like an acknowledged upstream bug: http://bugs.linuxbase.org/show_bug.cgi?id=2447 So it's not necessary to fix anything, the problem will be waived. Libstdc++ test aborted on ppc, so can't verify this on ppc. Pass on x86 and x86_64 Test passed with "lsb-test-libstdcpp v. 4.1.0-18.lsb4 " Verified with 1.4 M5 RC3. Git rev: master/fe336b149552b1f4f24d979c40302653298b98cc |