[Freeciv-Dev] Floating point exception
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
A sinchronous floating point exception is generated in the server (I have saved
a game that always produce the exception when I run a new turn)
Here is the gdb message:
-------------------------------------------------
Program received signal SIGFPE, Arithmetic exception.
0x80c32ad in kill_desire (benefit=30, attack=0, loss=10, vuln=0,
victim_count=2) at aiunit.c:944
944 desire = ((benefit * attack - loss * vuln) * victim_count *
SHIELD_WEIGHTING
-------------------------------------------------
The complete function where the exception produces is:
----------------------------------------------------------
int kill_desire(int benefit, int attack, int loss, int vuln, int victim_count)
{
int desire;
/* attractiveness danger */
desire = ((benefit * attack - loss * vuln) * victim_count * SHIELD_WEIGHTING
/ (attack + vuln * victim_count));
return desire;
}
----------------------------------------------------------
So there is a "divided by zero" exception because attack and vuln are 0 at the
same time.
- [Freeciv-Dev] Floating point exception,
Lobo Gris <=
|
|