[llvm-bugs] [Bug 34851] New: Gross error in floating-point calculation

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 5 12:32:15 PDT 2017


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

            Bug ID: 34851
           Summary: Gross error in floating-point calculation
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tydeman at tybor.com
                CC: llvm-bugs at lists.llvm.org

This code

#include <stdio.h>
#define DEN 3.645199531882474602528e-4951L
int main(void){
  static float f = DEN*DEN;
  static double d = DEN*DEN;
  static long double ld = DEN*DEN;
  printf("DEN=%Lg, f=%g, d=%g, ld=%Lg\n", DEN, f, d, ld);
  return 0;
}

prints 'inf' instead of the expected '0.0' for f, d, and ld.

-- 
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/20171005/8273d10b/attachment.html>


More information about the llvm-bugs mailing list