[llvm-dev] different output with fast-math flag

sangeeta chowdhary via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 21 08:17:32 PDT 2018


Why the output is different for this below program when compiled using
clang with fast-math optimization

#include<stdio.h>


int main() {

  double d = 1.0;

  double max = 1.79769e+308;


  d /= max;

  printf("d:%e:\n", d);

  d *= max;

  printf("d:%e:\n", d);

  return 0;

}


prints 0 with fast math but 1 without fast math.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180821/4f9a7ee4/attachment.html>


More information about the llvm-dev mailing list