[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] GNU Go 3.1.32 - VC inconsistencies
From: |
Gunnar Farneback |
Subject: |
Re: [gnugo-devel] GNU Go 3.1.32 - VC inconsistencies |
Date: |
Thu, 18 Apr 2002 21:44:08 +0200 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode) |
I wrote:
> On Cray I have so far an unexpected pass for nngs1:45. I'll try to
> track that one down.
This seems to be another variation of the floating point ordering
problem. In mkpat.c we have some code to optimize the anchor point:
mi = ((float)maxi - 1.0) / 2.0;
mj = ((float)maxj - 1.0) / 2.0 - 0.01;
for (k = 0; k != el; k++)
if (elements[k].att < 3 && (elements[k].att & anchor) != 0) {
d = gg_abs((float)elements[k].x - mi)
+ gg_abs((float)elements[k].y - mj);
if (d < min_d) {
min_k = k;
min_d = d;
}
}
Due to the 0.01 offset the numbers become inexactly represented and we
get the platform dependency potential. The patch below fixes this with
a gg_normalize_float() call, but the real question is why we have this
offset at all.
/Gunnar
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.66
diff -u -r1.66 mkpat.c
--- patterns/mkpat.c 31 Mar 2002 20:46:47 -0000 1.66
+++ patterns/mkpat.c 18 Apr 2002 19:08:45 -0000
@@ -855,14 +855,20 @@
float d, min_d = 361.0;
int k, min_k = -1;
- /* we seek the element of suitable value minimizing
- * the distance to the middle */
+ /* We seek the element of suitable value minimizing
+ * the distance to the middle.
+ *
+ * FIXME: What's the purpose of this 0.01 offset? It introduces
+ * potential for platform dependency in the floating point
+ * calculations.
+ */
mi = ((float)maxi - 1.0) / 2.0;
mj = ((float)maxj - 1.0) / 2.0 - 0.01;
for (k = 0; k != el; k++)
if (elements[k].att < 3 && (elements[k].att & anchor) != 0) {
d = gg_abs((float)elements[k].x - mi)
+ gg_abs((float)elements[k].y - mj);
+ d = gg_normalize_float(d, 0.01);
if (d < min_d) {
min_k = k;
min_d = d;
- [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, (continued)
- [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, Arend Bayer, 2002/04/16
- Re: [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, Trevor Morris, 2002/04/16
- Re: [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, Gunnar Farneback, 2002/04/16
- Re: [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, Arend Bayer, 2002/04/16
- [gnugo-devel] Handtalk series update, Jessie Annala, 2002/04/17
- Re: [gnugo-devel] Handtalk series update, Daniel Bump, 2002/04/17
- Re: [gnugo-devel] Handtalk series update, David Fotland, 2002/04/17
- Re: [gnugo-devel] Handtalk series update, bump, 2002/04/17
- Re: [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, Trevor Morris, 2002/04/17
- Re: [gnugo-devel] arend_1_33.5: Try to address VC inconsistencies, Arend Bayer, 2002/04/22
- Re: [gnugo-devel] GNU Go 3.1.32 - VC inconsistencies,
Gunnar Farneback <=
- Re: [gnugo-devel] GNU Go 3.1.32 - VC inconsistencies, Arend Bayer, 2002/04/18
Re: [gnugo-devel] GNU Go 3.1.32, Marco Scheurer, 2002/04/15
Re: [gnugo-devel] GNU Go 3.1.32, Gunnar Farneback, 2002/04/19