• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -Wfloat-equal -verify %s
2 
f1(float x,float y)3 int f1(float x, float y) {
4   return x == y; // expected-warning {{comparing floating point with ==}}
5 }
6 
f2(float x,float y)7 int f2(float x, float y) {
8   return x != y; // expected-warning {{comparing floating point with ==}}
9 }
10 
f3(float x)11 int f3(float x) {
12   return x == x; // no-warning
13 }
14 
f4(float x)15 int f4(float x) {
16   return x == 0.0; // no-warning {{comparing}}
17 }
18 
f5(float x)19 int f5(float x) {
20   return x == __builtin_inf(); // no-warning
21 }
22 
f7(float x)23 int f7(float x) {
24   return x == 3.14159; // expected-warning {{comparing}}
25 }
26