Skip to content

Commit 6719224

Browse files
authored
fixed precision issue in unit-test on OSX M3 (#1875)
Signed-off-by: kmuseth <[email protected]>
1 parent d74e2c4 commit 6719224

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

openvdb/openvdb/unittest/TestLinearInterp.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ template<typename GridType>
999999
void
10001000
TestLinearInterp::testStencilsMatch()
10011001
{
1002-
typedef typename GridType::ValueType ValueType;
1002+
using ValueType = typename GridType::ValueType;
10031003

10041004
GridType grid;
10051005
typename GridType::TreeType& tree = grid.tree();
@@ -1022,14 +1022,13 @@ TestLinearInterp::testStencilsMatch()
10221022
openvdb::tools::GridSampler<GridType, openvdb::tools::BoxSampler>
10231023
interpolator(grid);
10241024

1025-
openvdb::math::BoxStencil<const GridType>
1026-
stencil(grid);
1027-
1028-
typename GridType::ValueType val1 = interpolator.sampleVoxel(pos.x(), pos.y(), pos.z());
1025+
openvdb::math::BoxStencil<const GridType> stencil(grid);
10291026

1027+
const ValueType val1 = interpolator.sampleVoxel(pos.x(), pos.y(), pos.z());
10301028
stencil.moveTo(pos);
1031-
typename GridType::ValueType val2 = stencil.interpolation(pos);
1032-
EXPECT_EQ(val1, val2);
1029+
const ValueType val2 = stencil.interpolation(pos);
1030+
static const ValueType epsilon = openvdb::math::Delta<ValueType>::value();
1031+
EXPECT_NEAR(val1, val2, epsilon);
10331032
}
10341033
}
10351034
TEST_F(TestLinearInterp, testStencilsMatchFloat) { testStencilsMatch<openvdb::FloatGrid>(); }

0 commit comments

Comments
 (0)