gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] The killer heuristic


From: Arend Bayer
Subject: Re: [gnugo-devel] The killer heuristic
Date: Sun, 26 Jan 2003 03:04:23 +0100 (CET)

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;
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]