Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Floating point exception
@ 1996-12-15 12:54 Dan McGuirk
  0 siblings, 0 replies; 7+ messages in thread
From: Dan McGuirk @ 1996-12-15 12:54 UTC (permalink / raw)


Anyone know why this program causes a floating point exception on the
Alpha?

#include <float.h>

int main()
{
	double a = 4.5;

	if(a > DBL_MIN) {
		return 1;
	}

	return 0;
}

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Floating point exception
@ 1996-12-15 22:21 Craig Burley
  0 siblings, 0 replies; 7+ messages in thread
From: Craig Burley @ 1996-12-15 22:21 UTC (permalink / raw)


>Anyone know why this program causes a floating point exception on the
>Alpha?
>
>#include <float.h>
>
>int main()
>{
>	double a = 4.5;
>
>	if(a > DBL_MIN) {
>		return 1;
>	}
>
>	return 0;
>}

My guess is that it's due to DBL_MIN being a denormal (aka subnormal?) and
your system doesn't have the right software (library or OS??) installed to
handle the hardware traps that happen when denormals are encountered.

Happens on my system too, but I have an ancient one.  New Craftworks CDs are
sitting on a shelf awaiting a major overhaul of my Alpha and Intel -- I
presume this will make this particular problem, among many others, go
away.  ;-)

So, upgrading the Linux OS and libraries (libm.a and libc.a?) on your system
might make this problem disappear after recompiling and relinking.

        tq vm, (burley)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <Pine.LNX.3.95.961215124644.26796Q-100000@sexpistols.dontknow.com>]
[parent not found: <199612152221.RAA06013@churchy.gnu.ai.mit.edu>]
* Re: Floating point exception
@ 1996-12-16 19:21 Przemek Klosowski
  0 siblings, 0 replies; 7+ messages in thread
From: Przemek Klosowski @ 1996-12-16 19:21 UTC (permalink / raw)


Anyone know why this program causes a floating point exception on the
   Alpha?

   #include <float.h>
   int main()
   {
	   double a = 4.5;

	   if(a > DBL_MIN) {
		   return 1;
	   }

	   return 0;
   }

Yes, I know why this program crashes with SIGFPE. First, gcc 2.7.2 included
with RedHat 4.0 has a bug where it miscompiles floating point constants. DBL_MIN
is supposed to be the least double that is still normalized; due to the above
bug it is compiled as a slightly smaller denormalized number. 

The load of this denormal triggers a denormal exception; the default behavior
of the signal handler is to stop the program. 

Richard Henderson has gcc patches that solve the first problem

  ftp://ftp.redhat.com/pub/alphabits/rth-gcc-2.7.2-*.diff.gz

As to the second, I don't understand how, but I stopped getting traps for 
denormals after compiling gcc with Richard's patches; it looks as if they
changed the code generation to truncate to zero instead of going into
denormal mode, even though I don't see why it should happen after quick
perusal of the patches.

You may also want to try undocumented machine-specific option -mfp-trap-mode=n.  

	p

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1996-12-16 19:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-12-15 12:54 Floating point exception Dan McGuirk
  -- strict thread matches above, loose matches on Subject: below --
1996-12-15 22:21 Craig Burley
     [not found] <Pine.LNX.3.95.961215124644.26796Q-100000@sexpistols.dontknow.com>
1996-12-15 21:31 ` Paul B. Brown
1996-12-15 22:33 ` David R. McGown
1996-12-16 16:15 ` Richard Henderson
     [not found] <199612152221.RAA06013@churchy.gnu.ai.mit.edu>
1996-12-16 18:44 ` Jerry Feldman
1996-12-16 19:21 Przemek Klosowski

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