MCPcopy Create free account
hub / github.com/Profactor/cv-plot / WithinRelMatcher

Class WithinRelMatcher

CvPlot/ext/catch2/inc/catch.hpp:3406–3413  ·  view source on GitHub ↗

Given IEEE-754 format for floats and doubles, we can assume that float -> double promotion is lossless. Given this, we can assume that if we do the standard relative comparison of |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get the same result if we do this for floats, as if we do this for doubles that were promoted from floats.

Source from the content-addressed store, hash-verified

3404 // the same result if we do this for floats, as if we do this for
3405 // doubles that were promoted from floats.
3406 struct WithinRelMatcher : MatcherBase<double> {
3407 WithinRelMatcher(double target, double epsilon);
3408 bool match(double const& matchee) const override;
3409 std::string describe() const override;
3410 private:
3411 double m_target;
3412 double m_epsilon;
3413 };
3414
3415 } // namespace Floating
3416

Callers 1

WithinRelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected