Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: krebs@kar.dec.com
To: axp-list@redhat.com
Subject: Re: Floating point problems
Date: Mon, 30 Nov 98 14:27:37 +0100	[thread overview]
Message-ID: <9811301327.AA32090@whopper.kar.dec.com> (raw)
In-Reply-To: Your message of "Mon, 30 Nov 98 09:22:09 EST." <Pine.OSF.3.91.981130091904.2424G-100000@caesar.iplink.net>

> 
> 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
_____________________________________________________________________________


  reply	other threads:[~1998-11-30 13:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-30  8:16 Floating point problems y0000218
1998-11-30  9:08 ` Carles Perello
1998-11-30  9:53 ` Joachim Wesner
1998-11-30 14:22   ` Alvin Starr
1998-11-30 13:27     ` krebs [this message]
1998-11-30 17:06 ` Joachim Wesner
1998-12-03  0:48   ` Richard Henderson
1998-12-03 16:59     ` Greg Lindahl
1998-12-03 19:35       ` Joachim Wesner
1998-12-03 20:04       ` Richard Henderson
1998-12-03 20:16         ` Greg Lindahl
1998-12-03 23:44         ` Joachim Wesner
1998-12-01  8:42 ` Jochen Kuepper
  -- strict thread matches above, loose matches on Subject: below --
1998-11-30 10:24 y0000218
1998-11-30 13:30 ` Alvin Starr
1998-12-03  0:48   ` Richard Henderson
1998-11-28 13:15 Heinz Ulrich Stille
1998-11-28 14:24 ` Johannes G.D. Hausmann
1998-11-28 13:58   ` Heinz Ulrich Stille
1998-11-28 14:48     ` Stefan Schroepfer
1998-11-28 14:57       ` Heinz Ulrich Stille
1998-11-29 13:15         ` Johannes G.D. Hausmann
1998-11-29 13:02           ` Heinz Ulrich Stille
1998-11-29 18:01           ` B. James Phillippe
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox