[Pachi] problem: denormalization of evaluation results

Stanisław Halik sthalik at misaki.pl
Wed Nov 13 10:13:03 CET 2013


Hey,

There's a problem wrt accumulation of floats in patternprob.c

Recommend to change floating_t in pattern_rate_moves to long double and 
multiply each floating_t prob by #ifdef double 53 #else 23.

As such:

-->--
#ifdef DOUBLE
#   define MY_HIGH 1e53
#   define MY_LOW 1e-53
#else
#   define MY_HIGH 1e23
#   define MY_LOW 1e-23
#endif
--<--

-->--
[...]
long double total = 0;
floating_t prob = pattern_prob(pat->pd, &pats[f]);
if (prob != MY_NAN) {
	probs[f] = prob;
	total += prob * MY_HIGH;
}
--<--

Note MY_NAN, the branch contains changes NAN to #define MY_NAN -42, which 
allows for -ffinite-math-only, a subset of -ffast-math.

Another recommendation if usage of more precise -fmpmath=sse

For more information see @sthalik/pachi on github

cheers,
-sh


More information about the Pachi mailing list