From: Phillip Ezolt <ezolt@perf.zko.dec.com>
To: axp-list@redhat.com
Cc: henning@perf.zko.dec.com
Subject: Re: SIGFPE error on exponential underflow in g77
Date: Fri, 5 Mar 1999 17:08:00 -0500 (EST) [thread overview]
Message-ID: <Pine.OSF.3.96.990305164859.27078B-100000@perf.zko.dec.com> (raw)
In-Reply-To: <199903051624.LAA23271@adder.cs.Virginia.EDU>
On Fri, 5 Mar 1999, Greg Lindahl wrote:
> Someone needs to look at the source of just the glue routine, and
> decide if it doing something useful and needs -mieee when compiled,
> or if it is doing excess work and needs to get cut down.
>
> -- g
>
There may be something more tricky than simply compiling the glue routine
with -mieee.
I have found that GNU libm actually returns denormalized numbers (VERY
VERY small numbers) when ffm and cpml actually round this to zero.
Consider the following program:
#include <math.h>
main()
{
double y;
double x=-744.07568359375;
y = exp(x);
printf("%g\n", y);
printf("%g\n", x);
}
[spec@csg150 cpml.0.1]$ gcc -o test_exp_libm test_exp.c -lm
[spec@csg150 cpml.0.1]$ ./test_exp_libm
4.94066e-324
-744.076
[spec@csg150 cpml.0.1]$ gcc -o test_exp_libm_mieee test_exp.c -mieee -lm
[spec@csg150 cpml.0.1]$ ./test_exp_libm_mieee
4.94066e-324
-744.076
[spec@csg150 cpml.0.1]$ gcc -o test_exp_ffm test_exp.c -lffm
[spec@csg150 cpml.0.1]$ ./test_exp_ffm
0
-744.076
[spec@csg150 cpml.0.1]$ gcc -o test_exp_cpml test_exp.c -lcpml
[spec@csg150 cpml.0.1]$ ./test_exp_cpml
0
-744.076
(libm is glibc-2.0.7-29 )
(cpml is cpml.0.1)
(libffm is libffm.0.28 )
(gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release) )
Libm returns a very small number instead of zero. It does not matter whether
or not -mieee is used. It returns a denormalized number which fits into a
double, and the program will work, for a while. However, you will immediately
get a Floating Point Exception and a core dump when you try to change this
into a single precision number.
What is deceiving about this whole process is that you can happly get
a denormalized number, and then a hundreds of cycles later you get an FPE.
If you are experiencing trouble with this, it would be in your best interest
to link in either the CPML or the FFM. First, they are MUCH faster than (on
some things) than libm, and they both seem to round to zero appropriately.
I am not sure how to trick g77 to use libffm or libcpml instead of libm, but
it is definately worth it to find out.
--Phil
Digital/Compaq: High Performance Servers/Benchmark Performance Engineering
Phillip.Ezolt@compaq.com ezolt@perf.zko.dec.com
next prev parent reply other threads:[~1999-03-05 22:12 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-04 22:02 SIGFPE error on exponential underflow in g77 Dave Arnett
1999-03-04 22:40 ` Andrei A. Dergatchev
1999-03-04 22:56 ` Greg Lindahl
1999-03-04 23:06 ` Joachim Wesner
1999-03-05 13:11 ` Greg Lindahl
1999-03-05 15:57 ` Dave Arnett
1999-03-05 16:24 ` Greg Lindahl
1999-03-05 22:08 ` Phillip Ezolt [this message]
1999-03-05 22:56 ` Alpa Processor no longer Number one :( Aaron
1999-03-05 22:27 ` Alpa Processor no longer Number one, nonsense phoenix2063
1999-03-05 23:35 ` Ron Farrer
1999-03-06 17:46 ` Kevin.Brown
1999-03-06 19:02 ` mgraffam
1999-03-06 21:21 ` Joachim Wesner
1999-03-06 21:47 ` mgraffam
1999-03-06 22:22 ` Kevin
1999-03-08 10:20 ` Jochen Kuepper
1999-04-09 12:35 ` Michael Wilhelm
1999-03-05 23:07 ` Alpa Processor no longer Number one :( Andrew Hobgood
1999-03-05 23:11 ` Greg Lindahl
1999-03-05 23:18 ` Ron Farrer
1999-03-06 14:28 ` Aaron
1999-03-06 0:02 ` Dan O'Reilly
1999-03-06 1:00 ` Guide to life, love, and Intel marketing techniques (Alpa Processor no longer...) Daniel J. Frasnelli
1999-03-08 11:24 ` Alpa Processor no longer Number one :( Phil Carmody
1999-03-07 22:00 ` SIGFPE error on exponential underflow in g77 Greg Lindahl
1999-03-08 6:51 ` Wes Bauske
1999-03-08 13:19 ` Greg Lindahl
1999-03-09 7:31 ` Neil Carlson
1999-03-08 20:23 ` Wes Bauske
1999-03-08 21:26 ` Joachim Wesner
1999-03-08 18:00 ` Dave Arnett
1999-03-08 18:31 ` Greg Lindahl
1999-03-08 19:30 ` Phillip Ezolt
1999-03-08 20:13 ` Greg Lindahl
1999-03-08 21:47 ` Phillip Ezolt
1999-03-08 21:58 ` Dave Arnett
1999-03-13 17:13 ` Richard Henderson
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