Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug #25538: Monte Carlo damage prediction relies on UB
IEEE 754 specifies that dividing a positive number with zero yields positive infinity, but the C++ language doesn't guarantee IEEE 754 semantics. As a result, UBSan complains about floating-point division by zero. Wesnoth requires IEEE 754 anyway, but it's still good to get rid of the UBSan warning. The code now avoids the division if the divisor is zero.
- Loading branch information
Showing
1 changed file
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters