mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Fix DIVIDE BY ZERO exception in init_search()
It happens that when d == 0 we calculate: log(double(0 * 0) / 2) Unfortunately, log(0) is "illegal" and can generate either a floating point exception or return a nonsense "huge" value depending on the platform. This fixs in the proper way the GCC/ICC rounding difference, bug was from our side, not in the intel compiler. Also fixed some few other warnings. Bug spotted by Richard Lloyd. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -894,7 +894,7 @@ namespace {
|
||||
Square s = pop_1st_bit(&b);
|
||||
Square queeningSquare = relative_square(c, make_square(square_file(s), RANK_8));
|
||||
int d = square_distance(s, queeningSquare)
|
||||
- (relative_rank(c, s) == RANK_2) // Double pawn push
|
||||
- int(relative_rank(c, s) == RANK_2) // Double pawn push
|
||||
- square_distance(pos.king_square(opposite_color(c)), queeningSquare)
|
||||
+ int(c != pos.side_to_move());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user