mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 13:55:39 +02:00
Fix uniform_floating_point_distribution for unit ranges
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Catch {
|
||||
"gamma returns the largest ULP magnitude within "
|
||||
"floating point range [a, b]. This only makes sense "
|
||||
"for floating point types" );
|
||||
assert( a < b );
|
||||
assert( a <= b );
|
||||
|
||||
const auto gamma_up = Catch::nextafter( a, std::numeric_limits<FloatType>::infinity() ) - a;
|
||||
const auto gamma_down = b - Catch::nextafter( b, -std::numeric_limits<FloatType>::infinity() );
|
||||
@@ -69,7 +69,7 @@ namespace Catch {
|
||||
template <typename FloatType>
|
||||
DistanceType<FloatType>
|
||||
count_equidistant_floats( FloatType a, FloatType b, FloatType distance ) {
|
||||
assert( a < b );
|
||||
assert( a <= b );
|
||||
// We get distance as gamma for our uniform float distribution,
|
||||
// so this will round perfectly.
|
||||
const auto ag = a / distance;
|
||||
|
@@ -97,7 +97,7 @@ public:
|
||||
m_max_steps_in_one_go( Detail::calculate_max_steps_in_one_go(m_ulp_magnitude)),
|
||||
m_a_has_leq_magnitude(std::fabs(m_a) <= std::fabs(m_b))
|
||||
{
|
||||
assert( a < b );
|
||||
assert( a <= b );
|
||||
}
|
||||
|
||||
template <typename Generator>
|
||||
|
Reference in New Issue
Block a user