@@ -9,12 +9,17 @@ namespace bar {
9
9
template <typename T>
10
10
auto sqrt (T val) { return sqrt (static_cast <double >(val)); }
11
11
12
+ float sqrtf (float Arg);
13
+ long double sqrtl (long double Arg);
14
+
12
15
static constexpr double e = 2.718281828459045235360287471352662497757247093 ;
13
16
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:33: warning: prefer 'std::numbers::e' to this literal, differs by '0.00e+00' [modernize-use-std-numbers]
14
17
// CHECK-FIXES-ALL: static constexpr double e = std::numbers::e;
15
18
}
16
19
20
+ float expf (float Arg);
17
21
double exp (double Arg);
22
+ long double expl (long double Arg);
18
23
double log (double Arg);
19
24
20
25
double log2 (double Arg);
@@ -110,6 +115,14 @@ void foo(){
110
115
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::sqrt2_v<float>' to this formula [modernize-use-std-numbers]
111
116
// CHECK-FIXES-ALL: std::numbers::sqrt2_v<float>;
112
117
118
+ bar::sqrtf (2 .0F );
119
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::sqrt2_v<float>' to this formula [modernize-use-std-numbers]
120
+ // CHECK-FIXES-ALL: std::numbers::sqrt2_v<float>;
121
+
122
+ bar::sqrtl (2.0 );
123
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::sqrt2_v<long double>' to this formula [modernize-use-std-numbers]
124
+ // CHECK-FIXES-ALL: std::numbers::sqrt2_v<long double>;
125
+
113
126
sink (MY_PI);
114
127
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:10: warning: prefer 'std::numbers::pi' to this macro, differs by '5.36e-08' [modernize-use-std-numbers]
115
128
// CHECK-FIXES-ALL: sink(std::numbers::pi);
@@ -155,6 +168,14 @@ void foo(){
155
168
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::e' to this formula [modernize-use-std-numbers]
156
169
// CHECK-FIXES-ALL: std::numbers::e;
157
170
171
+ expf (1 );
172
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::e_v<float>' to this formula [modernize-use-std-numbers]
173
+ // CHECK-FIXES-ALL: std::numbers::e_v<float>;
174
+
175
+ expl (1 );
176
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::e_v<long double>' to this formula [modernize-use-std-numbers]
177
+ // CHECK-FIXES-ALL: std::numbers::e_v<long double>;
178
+
158
179
log2 (exp (1 ));
159
180
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: prefer 'std::numbers::log2e' to this formula [modernize-use-std-numbers]
160
181
// CHECK-MESSAGES-ALL: :[[@LINE-2]]:10: warning: prefer 'std::numbers::e' to this formula [modernize-use-std-numbers]
0 commit comments