forked from OSchip/llvm-project
[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:
parent
f927021410
commit
702a976c12
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue