[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] The killer heuristic
From: |
Evan Berggren Daniel |
Subject: |
Re: [gnugo-devel] The killer heuristic |
Date: |
Sat, 25 Jan 2003 21:29:49 -0500 (EST) |
OK, I get the same results. I'll look into it a bit more, I think...
very weird. However, one thing I've had repeated to me a number of times:
never, but never, do equality tests on floating point numbers. This is a
weirder example than most, though. GNU Go doesn't do equality tests in
the connection code, though, does it?
The usual example of fp weirdness I've seen is the following:
float i = 0.0;
while (i != 1.0) {
i += 0.1;
}
which will repeat forever. However, the cause of that is easily explained
by repeating binary numbers being added.
Evan
On Sun, 26 Jan 2003, Arend Bayer wrote:
> Evan wrote:
>
> > Floating point rounding problems is an interesting thought... is there a
> > way to compile things to do IEEE floating point instead of platform
> > dependent, to test this out?
>
> Well gcc has an option -mieee-fp but I doubt this works.
>
> Try the example program below. I consistently get "not equal" as result
> (also with -mieee-fp). When compiling this with -O2, the executable
> doesn't even contain the string "the same" anymore, as this branch gets
> optimized away.
>
> I don't know IEEE, so either this is IEEE-correct (which means that IEEE
> doesn't do what one (at least me) would naively expect it to do), or
> this should be considered a compiler bug.
>
> Arend
>
>
> #include <stdio.h>
> #include <unistd.h>
>
> int
> main()
> {
> float x = 1.0;
> float y = 1.0/3.0;
>
> if (x / 3.0 == y)
> fprintf(stdout, "the same\n");
> else
> fprintf(stdout, "not equal\n");
> return 0;
> }
>
>
>
>
>
> _______________________________________________
> gnugo-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gnugo-devel
>
>
- Re: [gnugo-devel] The killer heuristic, (continued)
- Re: [gnugo-devel] The killer heuristic, Arend Bayer, 2003/01/24
- Re: [gnugo-devel] The killer heuristic, bump, 2003/01/24
- Re: [gnugo-devel] The killer heuristic, Arend Bayer, 2003/01/25
- Re: [gnugo-devel] The killer heuristic, Evan Berggren Daniel, 2003/01/25
- Re: [gnugo-devel] The killer heuristic, Arend Bayer, 2003/01/25
- Re: [gnugo-devel] The killer heuristic, Evan Berggren Daniel, 2003/01/25
- Re: [gnugo-devel] The killer heuristic, Arend Bayer, 2003/01/25
- Re: [gnugo-devel] The killer heuristic,
Evan Berggren Daniel <=
- Re: [gnugo-devel] The killer heuristic, Evan Berggren Daniel, 2003/01/25
- Re: [gnugo-devel] The killer heuristic, Dave Denholm, 2003/01/26