inline assertion_result compare_fpv( Lhs const& lhs, Rhs const& rhs, op::EQ<Lhs,Rhs>* ) { if( lhs == 0 ) { return compare_fpv_near_zero( rhs, (op::EQ<Lhs,Rhs>*)0 ); } else if( rhs == 0) { return compare_fpv_near_zero( lhs, (op::EQ<Lhs,Rhs>*)0 ); } else { fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_STRONG ); assertion_result ar( P( lhs, rhs ) ); if( !ar ) ar.message() << "Relative difference exceeds tolerance [" << P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']'; return ar; } }
inline assertion_result compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE<Lhs,Rhs>* ) { if( lhs == 0 ) { return compare_fpv_near_zero( rhs, (op::NE<Lhs,Rhs>*)0 ); } else if( rhs == 0 ) { return compare_fpv_near_zero( lhs, (op::NE<Lhs,Rhs>*)0 ); } else { fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_WEAK ); assertion_result ar( !P( lhs, rhs ) ); if( !ar ) ar.message() << "Relative difference is within tolerance [" << P.tested_rel_diff() << " < " << fpc_tolerance<FPT>() << ']'; return ar; } }
inline assertion_result compare_fpv_near_zero( FPT const& fpv, op::GT<Lhs,Rhs>* ) { return fpv <= 0 ? assertion_result( false ) : compare_fpv_near_zero( fpv, (op::NE<Lhs,Rhs>*)0 ); }