[OpenMP][Offloading] Change the way to compare floating point values in bug49334.cpp

`bug49334.cpp` directly uses `!=` to compare two floating point values,
which is almost wrong.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D119485
This commit is contained in:
Shilei Tian 2022-02-10 18:20:29 -05:00
parent f927021410
commit 702a976c12
1 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,9 @@
// UNSUPPORTED: x86_64-pc-linux-gnu
#include <cassert>
#include <cmath>
#include <iostream>
#include <limits>
#include <memory>
#include <vector>
@ -57,7 +59,8 @@ public:
int currj = j * rowsPerBlock + jj;
float m_value = matrix[curri + currj * nCols];
float bm_value = CurrBlock[ii + jj * colsPerBlock];
if (bm_value != m_value) {
if (std::fabs(bm_value - m_value) >
std::numeric_limits<float>::epsilon()) {
fail++;
}
}