Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Stefan Schroepfer <scr@iis.fhg.de>
To: axp-list@redhat.com
Subject: Re: strange (incorrect) arithmetic behaviour
Date: Tue, 31 Oct 2000 15:37:20 +0100	[thread overview]
Message-ID: <39FED920.35CF7C53@iis.fhg.de> (raw)
In-Reply-To: 39FECC4D.C6FE215B@msdw.com

Hi,

the f format specifier is for double arguments,
so try

  printf( "%f\n%f\n%f\n", (double)a, (double)b, (double)c);

instead.

Regards,
Stefan Schroepfer

Richard Polton wrote:
> 
> Indeed. I get that on my Intel, so I am wondering where
> the problem lies. Kernel, libc, gcc? Any ideas?
> 
> Uncle George wrote:
> >
> > I get ( on rh6.2 ) on an xp1000
> >
> > -339999995214436424907732413799364296704.000000
> > 1.000000
> > -339999995214436424907732413799364296704.000000
> >
> > Richard Polton wrote:
> >
> > > Hi,
> > >
> > > I have stock RH6.1 on my LX164 machine. When executing the following
> > > code I see SIGFPE.
> > >
> > > #include <stdio.h>
> > > #include <math.h>
> > >
> > > main()
> > > {
> > >   float a = -3.4e38;
> > >   float b = 1.0;
> > >   float c = a*b;
> > >   printf( "%f\n%f\n%f\n", a, b, c);
> > > }




  reply	other threads:[~2000-10-31 14:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-31 10:17 strange (incorrect) arithmetic behaviour Richard Polton
2000-10-31 12:45 ` Uncle George
2000-10-31 13:42   ` Richard Polton
2000-10-31 14:37     ` Stefan Schroepfer [this message]
2000-10-31 15:38 ` Michal Jaegermann
  -- strict thread matches above, loose matches on Subject: below --
2000-10-31 22:36 Phil Carmody
2000-11-02 13:35 ` Stefan Schroepfer
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