Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Francesco Callari <franco@cim.mcgill.ca>
Subject: Another Floating Point Weirdness
Date: Wed, 11 Feb 1998 21:17:13 -0500 (EST)	[thread overview]
Message-ID: <478210ed2d7b845af72457e5f9dc418e.axp-list@archive.invalid> (raw)

Apropos of FP weirdness.
Can someone tell me why the following program will get
a floating point exception (SIGFPE) ?

#include <stdio.h>
#include <math.h>
#include <assert.h>

int main(int argc, char* argv[])
{
    int i, j;
    double v,m; /* works fine with m=0.0 */

    assert(finite(m));  /* passes this test */ 
    
    for (j=-10; j<=0; j++) {
	v=exp(-(double)j);
	if (v > m ) { /* dies with SIGFPE here */
	    m=v;
	}
    }
}

System config is
	kernel 2.0.32
	libm-2.0.6.so
	libc-2.0.6.so
	cpu : Alpha
	cpu model : EV56
	PC164LX

Ciao
Franco

-------------------------------------------------------------------------
Franco Callari                          
Centre for Intelligent Machines       "Beati coloro che hanno fame e sete
McGill University, 3480 University     di giustizia, perche` saranno
Montreal, Quebec, Canada, H3A 2A7      giustiziati."      (P. Bellocchio)
                                    
franco@cim.mcgill.ca | phone: +(514) 398-3371 | fax: +(514) 398-7348
WWW: <a href="http://www.cim.mcgill.ca/~franco/Home.html> Franco </a>
-------------------------------------------------------------------------

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

             reply	other threads:[~1998-02-12  2:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-12  2:17 Francesco Callari [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-02-12  5:01 Another Floating Point Weirdness Jim Paradis
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