[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] Floating point exception in influence.c
From: |
Arend Bayer |
Subject: |
Re: [gnugo-devel] Floating point exception in influence.c |
Date: |
Tue, 29 Jan 2002 16:11:14 +0100 (CET) |
Thanks for your quick report, that was my fault of course. Rrgs, I still
hope I will get less careless sometimes. The patch below should fix the
problem.
> When compiling gnugo-3.1.23 with experimental influence turned on I get
> a floating point exception at
> line 1161 of influence.c if I launch gnugo with gnugo --color white.
I did not know the influence function gets called with the empty
board in this case. Is this different from gmp mode?
Arend
arend_1_24.1: experimental influence: floating point exception cure
Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.31
diff -u -r1.31 influence.c
--- engine/influence.c 28 Jan 2002 18:29:31 -0000 1.31
+++ engine/influence.c 29 Jan 2002 14:50:33 -0000
@@ -1158,8 +1189,10 @@
if (q->p[i][j] == EMPTY
|| (q->black_strength[i][j] == 0 && q->white_strength[i][j] == 0)) {
- float diff = ( q->white_influence[i][j] - q->black_influence[i][j] )
- /( q->white_influence[i][j] + q->black_influence[i][j] );
+ float diff = 0.0;
+ if (q->white_influence[i][j] + q->black_influence[i][j] > 0)
+ diff = (q->white_influence[i][j] - q->black_influence[i][j])
+ /(q->white_influence[i][j] + q->black_influence[i][j]);
first_guess[i][j] = diff * diff * diff;
first_guess[i][j] *= interpolate(&territory_correction,
gg_max(q->black_influence[i][j],