Gromacs  2024.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gmx::test::anonymous_namespace{testasserts.cpp} Namespace Reference


Helper functions for computing floating-point differences

These routines are used to initialize FloatingPointDifference. They peek into some internal types from Google Test (gtest-internal.h), and duplicate some other functionality from there, but that is likely a better alternative than just copying all that code here.

template<typename FloatType >
FloatingPoint< FloatType >::Bits floatingPointToBiasedInteger (const FloatingPoint< FloatType > &value)
 Computes biased integer representation for a floating-point value. More...
template<typename FloatType >
uint64_t calculateUlpDifference (const FloatingPoint< FloatType > &value1, const FloatingPoint< FloatType > &value2)
 Computes the magnitude of the difference in ULPs between two numbers, treating also values of different sign.
template<typename FloatType >
void initDifference (FloatType raw1, FloatType raw2, double *absoluteDifference, uint64_t *ulpDifference, bool *bSignDifference)
 Helper to implement the constructors for FloatingPointDifference.
template<typename FloatType >
uint64_t relativeToleranceToUlp (FloatType tolerance)
 Converts a relative tolerance into an ULP difference.


bool g_showExpectedExceptions = false
 Whether to print the message from expected exceptions.