Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
To: AXP-Liste <axp-list@redhat.com>
Cc: Lukas Dobrek <dobrek@itp.uni-hannover.de>
Subject: exp underflow in glibc and compaq math library/kernel bug ?
Date: Mon, 26 Feb 2001 13:49:33 +0100	[thread overview]
Message-ID: <20010226134933.A20708@itp.uni-hannover.de> (raw)

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/




             reply	other threads:[~2001-02-26 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-26 12:49 Helge Kreutzmann [this message]
2001-02-27 13:25 ` exp underflow in glibc and compaq math library/kernel bug ? 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
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