From owner-freebsd-bugs Thu Jun 8 17:01:28 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id RAA03319 for bugs-outgoing; Thu, 8 Jun 1995 17:01:28 -0700 Received: from aristotle.algonet.se (root@aristotle.algonet.se [193.12.207.1]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id RAA03312 for ; Thu, 8 Jun 1995 17:01:25 -0700 Received: from sophocles. (mal@sophocles.algonet.se [193.12.207.10]) by aristotle.algonet.se (8.6.9/hdw.1.0) with SMTP id BAA18970 for ; Fri, 9 Jun 1995 01:59:09 +0200 Received: by sophocles. (5.x/SMI-SVR4) id AA06087; Fri, 9 Jun 1995 02:00:43 +0200 Date: Fri, 9 Jun 1995 02:00:43 +0200 From: mal@algonet.se (Mats Lofkvist) Message-Id: <9506090000.AA06087@sophocles.> To: bugs@FreeBSD.org Subject: Bogus (?) SIGFPE's from divide by zero Sender: bugs-owner@FreeBSD.org Precedence: bulk I don't know what the standards say, but other systems (at least SunOS) do not issue floating point exceptions on divide by zero. Bug in FreeBSD? Test program and outputs from FreeBSD and SunOS 4.1.4 below. Mats Lofkvist ---testfpe.c--- #include #include void handler(int foo) { printf("handler\n"); } double zero, one; set() { zero = 0.0; one = 1.0; } main() { double foo; set(); signal(SIGFPE, handler); printf("1.0/0.0\n"); foo = 1.0/0.0; printf("%f\n", foo); printf("0.0/0.0\n"); foo = 0.0/0.0; printf("%f\n", foo); printf("vars 1.0/0.0\n"); foo = one/zero; printf("%f\n", foo); printf("vars 0.0/0.0\n"); foo = zero/zero; printf("%f\n", foo); printf("done\n"); } --- ---FreBSD 2.0.5A:--- garm>a.out 1.0/0.0 Inf 0.0/0.0 NaN vars 1.0/0.0 handler 1.000000 vars 0.0/0.0 handler 0.000000 done --- ---SunOS 4.1.4:--- mumrik>a.out 1.0/0.0 Inf 0.0/0.0 NaN vars 1.0/0.0 Inf vars 0.0/0.0 NaN done --- (The constant divisions are replaced by constants by gcc, I suppose)