From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 4600 invoked from network); 30 Nov 1998 13:30:38 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 30 Nov 1998 13:30:38 -0000 Received: from mail13.digital.com (mail13.digital.com [192.208.46.30]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA28681 for ; Mon, 30 Nov 1998 08:28:32 -0500 From: krebs@kar.dec.com Received: from nestvx.kar.dec.com (nestvx.kar.dec.com [16.185.112.1]) by mail13.digital.com (8.9.1a/8.9.1/WV2.0b) with SMTP id IAA14615 for ; Mon, 30 Nov 1998 08:28:05 -0500 (EST) Received: from whopper.kar.dec.com by nestvx.kar.dec.com; (5.65/1.1.8.2/10Jul96-9.1MPM) id AA27229; Mon, 30 Nov 1998 14:27:44 +0100 Received: from localhost by whopper.kar.dec.com (5.65v3.2/1.1.10.5/21Apr97-0951PM) id AA32090; Mon, 30 Nov 1998 14:27:38 +0100 Message-Id: <9811301327.AA32090@whopper.kar.dec.com> X-Mailer: exmh version 2.0.2 2/24/98 To: axp-list@redhat.com Subject: Re: Floating point problems In-Reply-To: Your message of "Mon, 30 Nov 98 09:22:09 EST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 30 Nov 98 14:27:37 +0100 X-Mts: smtp > > try the following > main() { > double x = 1.0; > double y = 1e-155; > > x *=(1e-155*y); > printf("%e %e %e\n",(1e-155*y),x,1e-310); > } compiling under digital unix (cc no options) generates: cc: Warning: fp2.c, line 6: In this statement, underflow occurs in evaluating the expression "1.e-310". printf("%e %e %e\n",(1e-155*y),x,1e-310); ----------------------------------------^ the output is: 0.000000e+00 0.000000e+00 0.000000e+00 compiled with cc -fptm u generates the output: Floating point exception (core dumped) here is what man cc, has to say about -fptm: -fptm n Generates instructions that do not trigger floating-point underflow or inexact trapping modes. Any floating point overflow, divide-by-zero, or invalid operation will unconditionally generate a trap. -fptm n is the default. -fptm u Generates traps on floating-point underflow as well as overflow, divide-by-zero, and invalid operation. so you don't need -ieee to fix this under digital unix. -- _____________________________________________________________________________ Andreas S. Krebs Email mailto:krebs@kar.dec.com _____________________________________________________________________________