Tweak bound for pow to account for floating-point types.
diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp
index 5b1c08f..1d4f7b5 100644
--- a/test/array_cwise.cpp
+++ b/test/array_cwise.cpp
@@ -136,8 +136,11 @@
return NumTraits<Scalar>::highest();
else {
// base^e <= highest ==> base <= 2^(log2(highest)/e)
+ // For floating-point types, consider the bound for integer values that can be reproduced exactly = 2 ^ digits
+ double highest_bits = numext::mini(static_cast<double>(NumTraits<Scalar>::digits()),
+ log2(NumTraits<Scalar>::highest()));
return static_cast<Scalar>(
- numext::floor(exp2(log2(NumTraits<Scalar>::highest()) / static_cast<double>(exponent))));
+ numext::floor(exp2(highest_bits / static_cast<double>(exponent))));
}
}