mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Reduce flakiness of test for Eigen::half.
This commit is contained in:
@@ -700,6 +700,12 @@ void packetmath() {
|
||||
for (int i = 0; i < PacketSize; ++i) {
|
||||
data1[i] = internal::random<Scalar>(Scalar(0) - limit, limit);
|
||||
}
|
||||
} else if (!NumTraits<Scalar>::IsInteger && !NumTraits<Scalar>::IsComplex) {
|
||||
// Prevent very small product results by adjusting range. Otherwise,
|
||||
// we may end up with multiplying e.g. 32 Eigen::halfs with values < 1.
|
||||
for (int i = 0; i < PacketSize; ++i) {
|
||||
data1[i] = internal::random<Scalar>(Scalar(0.5), Scalar(1)) * (internal::random<bool>() ? Scalar(-1) : Scalar(1));
|
||||
}
|
||||
}
|
||||
ref[0] = Scalar(1);
|
||||
for (int i = 0; i < PacketSize; ++i) ref[0] = REF_MUL(ref[0], data1[i]);
|
||||
|
||||
Reference in New Issue
Block a user