From owner-freebsd-ports Thu Sep 21 09:39:56 1995 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id JAA17823 for ports-outgoing; Thu, 21 Sep 1995 09:39:56 -0700 Received: from time.cdrom.com (time.cdrom.com [192.216.222.226]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id JAA17800 for ; Thu, 21 Sep 1995 09:39:52 -0700 Received: from localhost (localhost [127.0.0.1]) by time.cdrom.com (8.6.12/8.6.9) with SMTP id JAA19400 for ; Thu, 21 Sep 1995 09:39:48 -0700 Prev-Resent: Thu, 21 Sep 1995 09:39:48 -0700 Prev-Resent: "ports@freefall " Received: from freefall.freebsd.org (freefall.cdrom.com [192.216.222.4]) by time.cdrom.com (8.6.12/8.6.9) with ESMTP id GAA18670 for ; Thu, 21 Sep 1995 06:59:10 -0700 Received: from wc.cdrom.com (wc.cdrom.com [192.216.223.37]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id GAA06534 for ; Thu, 21 Sep 1995 06:59:08 -0700 Received: from who.cdrom.com (who.cdrom.com [192.216.223.34]) by wc.cdrom.com (8.6.12/8.6.12) with ESMTP id GAA09784 for ; Thu, 21 Sep 1995 06:58:40 -0700 Received: from greatdane.cisco.com (greatdane.cisco.com [171.69.1.141]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id GAA28341 for ; Thu, 21 Sep 1995 06:58:59 -0700 Received: (chein@localhost) by greatdane.cisco.com (8.6.8+c/8.6.5) id GAA09549; Thu, 21 Sep 1995 06:58:05 -0700 From: Chuck Hein Message-Id: <199509211358.GAA09549@greatdane.cisco.com> Subject: Floating point exception running top To: freebsd@freebsd.org Date: Thu, 21 Sep 95 6:58:05 PDT Cc: jkh@cdrom.com (Jordan Hubbard), overholt@cisco.com (Jim Overholt) X-Mailer: ELM [version 2.3 PL11] Resent-To: ports@freefall.FreeBSD.org Resent-Date: Thu, 21 Sep 1995 09:39:48 -0700 Resent-Message-ID: <19398.811701588@time.cdrom.com> Resent-From: "Jordan K. Hubbard" Sender: owner-ports@freebsd.org Precedence: bulk /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); ! } }