Rearrange interpolation formula

Put the division at the end to reduce
rounding errors. This alters the bench
due to different rounding errors, but
should not alter ELO in any way.

bench: 7615217
This commit is contained in:
Marco Costalba
2014-04-28 17:15:16 +02:00
parent 918c29f83a
commit db229504e2

View File

@@ -779,9 +779,9 @@ namespace {
sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL);
}
// Interpolate between a middlegame and an endgame score, scaling by 'sf'
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
Value v = mg_value(score) * int(ei.mi->game_phase())
+ eg_value(score) * int(sf) / SCALE_FACTOR_NORMAL * int(PHASE_MIDGAME - ei.mi->game_phase());
+ eg_value(score) * int(PHASE_MIDGAME - ei.mi->game_phase()) * sf / SCALE_FACTOR_NORMAL;
v /= PHASE_MIDGAME;