Fix DIVIDE BY ZERO exception in init_search()
authorMarco Costalba <mcostalba@gmail.com>
Sat, 3 Jul 2010 15:02:07 +0000 (16:02 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 3 Jul 2010 15:12:20 +0000 (16:12 +0100)
commit1d4e7bbdf5a8b2e87daaa54eea52cbe01d699fdb
treefc793f03f863402f33a5e1e0fec8afea23b96226
parent35782079749c8f16560a13b9740d1a76654c6fe2
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>
src/evaluate.cpp
src/material.cpp
src/pawns.cpp
src/search.cpp