Skip to content

Commit 88fc254

Browse files
committed
Fix use else after return issue
Signed-off-by: haonanya <[email protected]>
1 parent d6cd3fc commit 88fc254

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

sycl/test/devicelib/math_utils.hpp

+5-11
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ bool approx_equal_fp(T x, T y) {
1818
return (x == y);
1919

2020
// two finite
21-
else {
22-
T threshold = std::numeric_limits<T>::epsilon() * 100;
23-
if (x != 0 && y != 0) {
24-
T max_v = std::fmax(std::abs(x), std::abs(y));
25-
return std::abs(x - y) < threshold * max_v;
26-
} else {
27-
if (x != 0)
28-
return std::abs(x) < threshold;
29-
else
30-
return std::abs(y) < threshold;
31-
}
21+
T threshold = std::numeric_limits<T>::epsilon() * 100;
22+
if (x != 0 && y != 0) {
23+
T max_v = std::fmax(std::abs(x), std::abs(y));
24+
return std::abs(x - y) < threshold * max_v;
3225
}
26+
return x != 0 ? std::abs(x) < threshold : std::abs(y) < threshold;
3327
}
3428

3529
#endif

0 commit comments

Comments
 (0)