Issue 61658
Summary Approximate result of floating-point operation with -O2
Labels
Assignees
Reporter Fedr
    The following program
```
#include <iostream>
#include <limits>

int main() {
    double A = std::numeric_limits<double>::max();
    double C = -0.1;
    double V = A * C - A * C;
    std::cout << V << std::endl;
}
```
if compiled with `-O2` option, prints `-4.9896e+290` instead of `0`. Is it normal?

Online demo: https://godbolt.org/z/fqf7xaYhq
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to