[Openmp-commits] [PATCH] D119485: [OpenMP][Offloading] Change the way to compare floating point values in bug49334.cpp

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 10 15:20:52 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG702a976c125c: [OpenMP][Offloading] Change the way to compare floating point values in… (authored by tianshilei1992).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119485/new/

https://reviews.llvm.org/D119485

Files:
  openmp/libomptarget/test/offloading/bug49334.cpp


Index: openmp/libomptarget/test/offloading/bug49334.cpp
===================================================================
--- openmp/libomptarget/test/offloading/bug49334.cpp
+++ openmp/libomptarget/test/offloading/bug49334.cpp
@@ -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 @@
             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++;
             }
           }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119485.407702.patch
Type: text/x-patch
Size: 792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220210/4c6ba03f/attachment-0001.bin>


More information about the Openmp-commits mailing list