* 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* 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[parent not found: <199612152221.RAA06013@churchy.gnu.ai.mit.edu>]
* Re: Floating point exception
[not found] <199612152221.RAA06013@churchy.gnu.ai.mit.edu>
@ 1996-12-16 18:44 ` Jerry Feldman
0 siblings, 0 replies; 7+ messages in thread
From: Jerry Feldman @ 1996-12-16 18:44 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)
I do not agree. DBL_MIN is defined as the minimum normalized number.
The value should be:2.2250738585072014e-308.
The only library that comes into play here is libc, not libm. The numbers, 4.5 and DBL_MIN should be converted at compile time to the appropriate binary
constants to be loaded. If the optimizer is smart enough, the code will just return 1, because it sees a as an effective constant. If not, it should generate assembly code similar to:
ldit $f10, 4.5
ldit $f11, 2.2250738585072014e-308
cmptlt $f11, $f10, $f12
fbeq $f12, ret0
ldil $0, 1 # Return 1
br done
ret0:
bis $31, $31, $0 # return 0
done:
... unwind stack, restore any saved stuff
ret
--
+--------------------------------------------------------------------+
Jerry Feldman Digital Unix Development Environment
Digital Equipment Corp. (work)gaf@zk3.dec.com (home)gaf@highway1.com
110 Spitbrook Rd. Mailstop: ZKO3-2/W17
Nashua, NH 03062-9987 (603)881-2970, DTN:381-2970
+--------------------------------------------------------------------+
--
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>]
* Re: Floating point exception
[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
2 siblings, 0 replies; 7+ messages in thread
From: Paul B. Brown @ 1996-12-15 21:31 UTC (permalink / raw)
Dan,
I didn't find float.h on my alpha (RH 3.0.3). I wonder if DBL_MIN is a
double? Look and see. I wonder if you are getting any kind of boundry
exeption?? Hummm . . . .
Paul
---------------------------------------------------------------------------
/\_/\ Paul B. Brown
((( ( -.- ) pbrown@btc.btechnet.com
|| > " < Cape Dory 25D, Paul's Option
(( (] | [) "Sailing is a state of mind . . . ."
((( | )
(_ | _) "Thirty minutes of begging is NOT considered foreplay."
---------------------------------------------------------------------------
On Sun, 15 Dec 1996, Dan McGuirk wrote:
> 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
>
--
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
[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
2 siblings, 0 replies; 7+ messages in thread
From: David R. McGown @ 1996-12-15 22:33 UTC (permalink / raw)
I ran into the same problem trying to compile the beta of XFMail-0.5. I was
getting a FPE in a section of code using a similar test to DBL_MIN.
The XFMail developer suggested using "DBL_MIN * 2", which worked in my case.
David
On 15-Dec-96 Dan McGuirk wrote:
>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;
>}
>
>--
dmcgown@access.digex.net David R. McGown
dmcgown@va.gibbscox.com -o-O-o- LINUX INSIDE!
Home: (703)683-1599 206 Adams Ave ALPHA GENERATION!
Work: (703)416-1240 Alexandria, VA 22301
--
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
[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
2 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 1996-12-16 16:15 UTC (permalink / raw)
> Anyone know why this program causes a floating point exception on the
> Alpha?
[...]
> if(a > DBL_MIN) {
Yes. The constant that gcc is giving the assembler is not DBL_MIN
but in fact a denormal just smaller than that. And the default
FP exception flags signal underflows.
There is a patch: ftp.redhat.com:/pub/alphabits/rth-gcc-2.7.2-9611*.
It should be applied to the RPM from RH40.
r~
--
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
* 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
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 22:21 Floating point exception Craig Burley
-- strict thread matches above, loose matches on Subject: below --
1996-12-16 19:21 Przemek Klosowski
[not found] <199612152221.RAA06013@churchy.gnu.ai.mit.edu>
1996-12-16 18:44 ` Jerry Feldman
[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
1996-12-15 12:54 Dan McGuirk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox