glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] Nicowar and desync


From: Bradley Arsenault
Subject: Re: [glob2-devel] Nicowar and desync
Date: Tue, 18 Jul 2006 12:42:29 -0700

On 7/18/06, Stéphane Magnenat <address@hidden> wrote:
> There is no float usage in Nicowar, I assure you. And it does use more
> CPU, but I doubt thats the cause unless its litterally lagging your
> machine.

grep float AINicowar.h AINicowar.cpp :

AINicowar.h:                            GradientPoll(Gradient::Sources source,
Gradient::Obstacles obstacle, float weight) : is_null(false), source(source),
obstacle(obstacle), weight(weight), min_dist(-1), max_dist(-1) {}
AINicowar.h:                            float weight;
AINicowar.cpp:          average_unit_strength_level=static_cast<unsigned
int>(std::floor(static_cast<float>(average_unit_strength_level)/static_cast<float>(total)+0.5))-1;
AINicowar.cpp:          average_unit_strength_level=static_cast<unsigned
int>(std::floor(static_cast<float>(average_unit_strength_level)/static_cast<float>(total)+0.5))-1;
AINicowar.cpp:                  float score=0;
AINicowar.cpp:                                  const float weight =
CONSTRUCTION_FACTORS[building_type][factor].weight;
AINicowar.cpp:
score+=static_cast<float>(top_left)*weight;
AINicowar.cpp:
score+=static_cast<float>(top_right)*weight;
AINicowar.cpp:
score+=static_cast<float>(bottom_left)*weight;
AINicowar.cpp:
score+=static_cast<float>(bottom_right)*weight;
AINicowar.cpp:                  tp.percent=static_cast<unsigned
int>(static_cast<float>(counts[i])/static_cast<float>(num_buildings_wanted[i])*100);
AINicowar.cpp:  float devisor=1;
AINicowar.cpp:          devisor=static_cast<float>(max)/16.0;
AINicowar.cpp:  float
average_happiness=static_cast<float>(total_happiness)/static_cast<float>(total_units);
AINicowar.cpp:                          float
enemy_average_happiness=static_cast<float>(enemy_happiness)/static_cast<float>(enemy_units);

It seems it does. Don't forget floating point format does not constrain
handling of least significant bits, so different CPU (even both x86) can give
different results. We had this bug in glob2 earlier in the same type of
computation Nicowar is currently doing.

I agree for the CPU.

Steph


_______________________________________________
glob2-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/glob2-devel


Yeah, Kai already emailed me with a grep. I, unfortently, am not at my
house, and I can't work on glob2 for atleast three weeks while my
family moves. Worse yet, me might have to get modem-internet in our
next house. Anyway, all of these usages are independant casts, so in
my case, atleast the same CPU will give the same results every time.

I'll fix this as soon as I have time. Sorry everyone, my mistake.

--
Start and finish, Bradley Arsenault

ps: I guess the unstable tag stays on




reply via email to

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