Template Function Catch::ulpDistance
Defined in File catch_amalgamated.hpp
Function Documentation
-
template<typename FP>
uint64_t Catch::ulpDistance(FP lhs, FP rhs) Calculates the ULP distance between two floating point numbers
The ULP distance of two floating point numbers is the count of valid floating point numbers representable between them.
There are some exceptions between how this function counts the distance, and the interpretation of the standard as implemented. by e.g.
nextafter
. For this function it always holds that:(x == y) => ulpDistance(x, y) == 0
(soulpDistance(-0, 0) == 0
)ulpDistance(maxFinite, INF) == 1
ulpDistance(x, -x) == 2 * ulpDistance(x, 0)
- Pre:
!isnan( lhs )
- Pre:
!isnan( rhs )
- Pre:
floating point numbers are represented in IEEE-754 format