Complete.Org: Mailing Lists: Archives: freeciv-dev: November 1999:
[Freeciv-Dev] Floating point exception in aiplayer mode (PR#182)
Home

[Freeciv-Dev] Floating point exception in aiplayer mode (PR#182)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Floating point exception in aiplayer mode (PR#182)
From: fiedler0@xxxxxxxxxxxxxxxxxx
Date: Fri, 26 Nov 1999 06:51:08 -0800 (PST)

Full_Name: Fiedler Roman
Version: 1.7.2
Distribution: Built from source
Client: Xaw
OS: Linux 2.2.35 Suse
Submission from: (NULL) (193.171.243.66)


Floating point exception caused by division / 0.

gdb error:

version: freeciv-1.7.2, but no changes to version Nov 22 1999 in file,
the code has just moved to line 467


gdb output
error in ai/advmilitary.c line 447
Program received signal SIGFPE, Arithmetic exception.
0x80943de in process_defender_want (pplayer=0x822e52c, pcity=0x8a6daf8, 
    danger=3643, choice=0x8a6ddec) at advmilitary.c:447

447           n = desire[i] * unit_types[bestid].build_cost / best;

(gdb) backtrace
#0  0x80943de in process_defender_want (pplayer=0x822e52c, pcity=0x8a6daf8, 
    danger=3643, choice=0x8a6ddec) at advmilitary.c:447
#1  0x80993c9 in military_advisor_choose_build (pplayer=0x822e52c, 
    pcity=0x8a6daf8, choice=0x8a6ddec) at advmilitary.c:888
#2  0x809b3d7 in ai_manage_cities (pplayer=0x822e52c) at aicity.c:445
#3  0x809ce98 in ai_do_last_activities (pplayer=0x822e52c) at aihand.c:117
#4  0x8064ed8 in update_player_activities (pplayer=0x822e52c) at plrhand.c:593
#5  0x8052ca0 in end_turn () at civserver.c:673
#6  0x8052054 in main (argc=4, argv=0xbffff844) at civserver.c:412

  if (!walls && unit_types[bestid].move_type == LAND_MOVING) {
    best *= pcity->ai.wallvalue;
    best /= 10;
  } /* was getting four-figure desire for battleships otherwise. -- Syela */
/* Phalanx would be 16 * danger / 20.  Pikemen would be 36 * danger / (20 + l)
*/
/* multiply by unit_types[bestid].build_cost / best */
  for (i = U_WARRIORS; i <= U_BATTLESHIP; i++) {
    if (desire[i]) {
      j = unit_types[i].tech_requirement;
------------------------------------------------------------------------
                                Seems to be 0         vvvv
------------------------------------------------------------------------
      n = desire[i] * unit_types[bestid].build_cost / best;
      pplayer->ai.tech_want[j] += n; /* not the totally idiotic
      pplayer->ai.tech_want[j] += n * pplayer->ai.tech_turns[j];  I amaze
myself. -- Syela */
/*      printf("%s wants %s for defense with desire %d <%d>\n",
pcity->name, advances[j].name, n, desire[i]); */
    }
  }



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Floating point exception in aiplayer mode (PR#182), fiedler0 <=