Skip to content

Commit 00be740

Browse files
committed
Fix bug in splitting for values very close to powers of 2
1 parent 25a5834 commit 00be740

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

include/gemmi.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ struct MatrixSplit {
108108
// NOTE 2: I use exponents instead of powers of 2, as I need the former
109109
// to shift correctly.
110110
frexp(this->powersVector[i], this->scalingExponents.data() + i);
111-
const auto largest_log = log2(this->powersVector[i]);
112-
this->powersVector[i] = std::ldexp(1.0, floor(largest_log) + 1);
111+
this->powersVector[i] = std::ldexp(1.0, this->scalingExponents[i]);
113112
}
114113
}
115114

0 commit comments

Comments
 (0)