[llvm-bugs] [Bug 46909] New: cbrt(2.0) computed differently by llvm and gcc

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 30 06:05:32 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46909

            Bug ID: 46909
           Summary: cbrt(2.0) computed differently by llvm and gcc
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: balarishi.bhogadi at amd.com
                CC: llvm-bugs at lists.llvm.org

$ cat foo.c
#include <math.h>
#include <float.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
        double d;
        d = 2.0;
        printf("pow((2.0), 1.0/3.0) = % .16e\n", pow((2.0), 1.0/3.0));
        printf("cbrt(2.0) = % .16e\n", cbrt(2.0));
}

$ gcc foo.c -o foo -lm
$ ./foo
pow((2.0), 1.0/3.0) =  1.2599210498948732e+00
cbrt(2.0) =  1.2599210498948732e+00

$ clang foo.c -o foo -lm
$ ./foo
pow((2.0), 1.0/3.0) =  1.2599210498948732e+00
cbrt(2.0) =  1.2599210498948734e+00            // <====

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200730/982e59d1/attachment.html>


More information about the llvm-bugs mailing list