Date: Thu, 21 Sep 95 6:58:05 PDT From: Chuck Hein <chein@cisco.com> To: freebsd@freebsd.org Cc: jkh@cdrom.com (Jordan Hubbard), overholt@cisco.com (Jim Overholt) Subject: Floating point exception running top Message-ID: <199509211358.GAA09549@greatdane.cisco.com> Resent-Message-ID: <19398.811701588@time.cdrom.com>
next in thread | raw e-mail | index | archive | help
/usr/local/bin/top has been causing a Floating point exception error when I run it on a fast machine with a delay of 0 seconds. Below is a patchfile that I have tested with FreeBSD 2.1-STABLE. /usr/ports/sysutils/top/patches/patch-ad: ------------------------------- CUT HERE ------------------------------- *** ./utils.c Thu Sep 21 06:15:49 1995 --- ../work/utils.c Thu Sep 21 06:37:14 1995 *************** *** 278,284 **** /* calculate percentages based on overall change, rounding up */ half_total = total_change / 2l; ! for (i = 0; i < cnt; i++) ! { ! *out++ = (int)((*diffs++ * 1000 + half_total) / total_change); } --- 278,288 ---- /* calculate percentages based on overall change, rounding up */ half_total = total_change / 2l; ! ! /* Do not divide by 0. Causes Floating point exception */ ! if(total_change) { ! for (i = 0; i < cnt; i++) ! { ! *out++ = (int)((*diffs++ * 1000 + half_total) / total_change); ! } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509211358.GAA09549>