[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Strange bug
From: |
jalex |
Subject: |
Strange bug |
Date: |
Thu, 6 Jan 2000 21:44:15 -0800 (PST) |
I just found an extremely odd bug appearing in a model of mine, and I
was hoping the excellent programmers who frequent this list might help
me track it down.
I have the following chunk of code in a model:
if (max_score > score ) {
new_strategy = RANDOM_POP(better_strategies, count);
printf ("Max score: %g, my score: %g\n",
max_score, [self getScore]);
}
else
new_strategy = [self getStrategy];
>From time to time, I get lines like the following being printed on-screen:
Max score: 5.7, my score: 5.7
My question: if max_score == 5.7 and score == 5.7, why on earth is the
printf being called? Is this an insidious roundoff error?
If it is a roundoff error, could someone please explain (or send a
reference of where I should look for) why my computer thinks
(1.9 + 1.9 + 1.9) != (1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 - .1 - .1 - .1)
since this is what must happen.
Thanks,
Jason
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.