[LLVMbugs] [Bug 9150] New: inaccurate results from divdc3 on x86_64 darwin10

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 5 13:44:36 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9150

           Summary: inaccurate results from divdc3 on x86_64 darwin10
           Product: compiler-rt
           Version: unspecified
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: howarth at nitro.med.uc.edu
                CC: llvmbugs at cs.uiuc.edu


The lazy implementation of divdc3 in compiler-rt results in accurate results
for the following test...

--- divdc3_test.c.sav    2011-02-05 15:56:15.000000000 -0500
+++ divdc3_test.c    2011-02-05 16:46:31.000000000 -0500
@@ -49,8 +49,8 @@
 int test__divdc3(double a, double b, double c, double d)
 {
     double _Complex r = __divdc3(a, b, c, d);
-//     printf("test__divdc3(%f, %f, %f, %f) = %f + I%f\n",
-//             a, b, c, d, creal(r), cimag(r));
+     printf("test__divdc3(%f, %f, %f, %f) = %f + I%f\n",
+             a, b, c, d, creal(r), cimag(r));
     double _Complex dividend;
     double _Complex divisor;

@@ -365,6 +365,7 @@
                 return 1;
         }
     }
+   test__divdc3(__DBL_MAX__ * 0.5, __DBL_MAX__ * 0.5,__DBL_MAX__ * 0.25,
__DBL_MAX__ * 0.25);

     return 0;
 }

which produces the inaccurate results...

gcc -I ../../lib divdc3_test.c ../../darwin_fat/Release/libcompiler_rt.a
./a.out
....
test__divdc3(89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184.000000,
89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184.000000,
44942328371557892703631855932926089199517641881461249149729369200789315195007134690147389658191719542885114738378595616058580331722366045692116886675884379246512477644137820519061372522597332236018967127113783485576145809225805737041452139833030837068699456551036180792184544295229824970312601006546031214592.000000,
44942328371557892703631855932926089199517641881461249149729369200789315195007134690147389658191719542885114738378595616058580331722366045692116886675884379246512477644137820519061372522597332236018967127113783485576145809225805737041452139833030837068699456551036180792184544295229824970312601006546031214592.000000)
= inf + I0.000000

compared to the accurate implementation of divdc3 in FSF gcc's libgcc...

gcc-4 -I ../../lib divdc3_test.c
/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin10.7.0/4.6.0/libgcc.a
./a.out
...
test__divdc3(89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184.000000,
89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184.000000,
44942328371557892703631855932926089199517641881461249149729369200789315195007134690147389658191719542885114738378595616058580331722366045692116886675884379246512477644137820519061372522597332236018967127113783485576145809225805737041452139833030837068699456551036180792184544295229824970312601006546031214592.000000,
44942328371557892703631855932926089199517641881461249149729369200789315195007134690147389658191719542885114738378595616058580331722366045692116886675884379246512477644137820519061372522597332236018967127113783485576145809225805737041452139833030837068699456551036180792184544295229824970312601006546031214592.000000)
= 2.000000 + I0.000000

Not fixing this bug degrades the utility of compiler-rt for scientific
applications.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list