* exp underflow in glibc and compaq math library/kernel bug ?
@ 2001-02-26 12:49 Helge Kreutzmann
2001-02-27 13:25 ` Reinier Bikker
0 siblings, 1 reply; 4+ messages in thread
From: Helge Kreutzmann @ 2001-02-26 12:49 UTC (permalink / raw)
To: AXP-Liste; +Cc: Lukas Dobrek
Hello !
A collegue of mine ran into a possible bug in glibc on alpha and asked
me to post the description here:
----- Forwarded message from Lukas Dobrek <dobrek@itp.uni-hannover.de> -----
> Hello,
> I have following problem. I dont really know where the bug is, it
> is either in the implementation of the exp function in glibc and
> compaq math library or in the kernel. Let me cut to the case. Look
> at this small code:
>
> #include<math.h>
> int main(void)
> {
> double x;
> x=exp(-744.769);
> x/=2.0;
> printf("%g\n",x);
> return(0);
> }
>
> Compilation with gcc and linking with libm from glibc-2.2.1 gives a
> floating point exception immediately. With compaq math library or
> compaq C compiler it is not so easy but it is also possible to get a
> FPE, one has to play with numbers. Why is it so? The problem is
> that exp(-744) is out of the double precision range. But
> implementation of exp in glibc does not set it to 0 but keep the
> underflow. This is a part of
> glibc-2.2.1/sysdeps/ieee754/dbl-64/e_exp.c
>
> /* Exceptional cases: */
> else if (isless (x, himark))
> {
> if (__isinf (x))
> /* e^-inf == 0, with no error. */
> return 0;
> else
> /* Underflow */
> return TWOM1000 * TWOM1000;
> }
> else
> return TWO1023*x;
>
> I dont know why this underflow is kept here. But it is not a simple
> mistake. So probably the problem is somehow related to math-emu in
> kernel. I testied it only with 2.2.x kernels. I dont feel like
> switching to 2.4.x series now. But IMO something is very wrong.
> Now the question to whome I should report the problems. Is this a
> good place?
>
> Best Regards
> Lukasz
>
> --
> Lukasz Dobrek
> Institut für Theoretische Physik
> Appelstraße 2, 30167 Hannover, Germany
> e-mail:dobrek@itp.uni-hannover.de
----- End forwarded message -----
Thanks
Helge
--
Helge Kreutzmann, Dipl.-Phys. kreutzm@itp.uni-hannover.de
For gpg-key: finger kreutzm@rigel.itp.uni-hannover.de
64bit GNU powered http://www.itp.uni-hannover.de/~kreutzm
Help keep free software "libre": http://www.freepatents.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: exp underflow in glibc and compaq math library/kernel bug ?
2001-02-26 12:49 exp underflow in glibc and compaq math library/kernel bug ? Helge Kreutzmann
@ 2001-02-27 13:25 ` Reinier Bikker
2001-02-27 19:40 ` Greg Lindahl
0 siblings, 1 reply; 4+ messages in thread
From: Reinier Bikker @ 2001-02-27 13:25 UTC (permalink / raw)
To: AXP-Liste
On Mon, 26 Feb 2001, Helge Kreutzmann wrote:
: > #include<math.h>
: > int main(void)
: > {
: > double x;
: > x=exp(-744.769);
: > x/=2.0;
: > printf("%g\n",x);
: > return(0);
: > }
: >
: > Compilation with gcc and linking with libm from glibc-2.2.1 gives a
: > floating point exception immediately. With compaq math library or
: > compaq C compiler it is not so easy but it is also possible to get a
: > FPE, one has to play with numbers. Why is it so?
: >
How was this compiled? With gcc you have to specify -mieee explicitly both
when compiling and linking. With ccc you use -ieee, but -mieee is mapped
to -ieee.
Reinier.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: exp underflow in glibc and compaq math library/kernel bug ?
2001-02-27 13:25 ` Reinier Bikker
@ 2001-02-27 19:40 ` Greg Lindahl
0 siblings, 0 replies; 4+ messages in thread
From: Greg Lindahl @ 2001-02-27 19:40 UTC (permalink / raw)
To: Reinier Bikker; +Cc: axp-list
On Tue, Feb 27, 2001 at 02:25:18PM +0100, Reinier Bikker wrote:
> How was this compiled? With gcc you have to specify -mieee explicitly both
> when compiling and linking. With ccc you use -ieee, but -mieee is mapped
> to -ieee.
This is all true. However, the math library will return denormalized
numbers when you don't specify -mieee, which most people consider to
be a bug. Do the new compaq compilers (I know that at least Fortran
has a new version in beta-test) fix this? It's a bit silly to have to
explicitly wrap math lib functions to avoid denorms which will cause
faults...
-- g
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: exp underflow in glibc and compaq math library/kernel bug ?
@ 2001-02-27 19:53 Woods, Will
0 siblings, 0 replies; 4+ messages in thread
From: Woods, Will @ 2001-02-27 19:53 UTC (permalink / raw)
To: 'axp-list@redhat.com'
On a related note, there was a problem with floating point denorm
instructions in Alpha Linux up until 2.2.18. Upgrading to 2.2.18 may help
fix this.
Will Woods <will.woods@compaq.com>
> -----Original Message-----
> From: Greg Lindahl [mailto:lindahl@conservativecomputer.com]
>
> This is all true. However, the math library will return denormalized
> numbers when you don't specify -mieee, which most people consider to
> be a bug. Do the new compaq compilers (I know that at least Fortran
> has a new version in beta-test) fix this? It's a bit silly to have to
> explicitly wrap math lib functions to avoid denorms which will cause
> faults...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-02-27 19:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-26 12:49 exp underflow in glibc and compaq math library/kernel bug ? Helge Kreutzmann
2001-02-27 13:25 ` Reinier Bikker
2001-02-27 19:40 ` Greg Lindahl
-- strict thread matches above, loose matches on Subject: below --
2001-02-27 19:53 Woods, Will
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox