Skip to content

Compare collections of floating point values with tolerance #173

@Flamefire

Description

@Flamefire

Currently you can use either:

  • BOOST_TEST_REQUIRE( output == outputDesired, boost::test_tools::per_element() );
  • BOOST_TEST_REQUIRE( output == outputDesired, boost::test_tools::tolerance( 1e-12f ) );

But you cannot use both.

What is the preferred way to compare collections (e.g. vectors) of floating point values?

This is a common use case for testing numeric algorithms: Check results of optimized version vs. naive implementation.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions