[R] broken inline exp in glibc/x86??!

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Jul 10 01:13:41 CEST 2002


Thomas Lumley <tlumley at u.washington.edu> writes:

> On Tue, 9 Jul 2002, RenE J.V. Bertin wrote:
> 
> > I read the following in acinclude.m4:
> >
> > ## R_PROG_CC_FLAG_D__NO_MATH_INLINES
> > ## ---------------------------
> > ## In current glibc, inline version [x86] of exp is broken.
> > ## We fix this by adding '-D__NO_MATH_INLINES' to R_XTRA_CFLAGS rather
> > ## than AC_DEFINE(__NO_MATH_INLINES) as the former also takes care of
> > ## compiling C code for add-on packages.
> >
> > Is this documented anywhere (where?), e.g. what is broken, which glibc
> > versions are implicated, etc? If not, could anyone please tell me what
> > is the matter -- I to use exp(), and I reckon that gcc will by default
> > use the inline version!
> >
> 
> I think that the problem was exp(-Inf) giving NaN rather than 0, but
> trying to reproduce it with gcc 2.95.4 I can only make it happen with
> -ffast-math, not with the -O flags. So it may be version-specific, or I
> may have misremembered

It's getting old, but it's a libc issue not a compiler one. (In
fact an include file issue: /usr/include/bits/mathinline.h).

It was fixed in recent versions. According to my reading, exp() is
never inlined unless FAST_MATH is used in glibc-2.2.5. Only a fairly
small fix was necessary to fix the inline code, but apparently the
glibc crew chose not to use it.

I forget why we chose to -D__NO_MATH_INLINES rather than test for the
presence of the actual problem.

The actual exchange of opinions (including a couple of cases of
spectacularly ignorant arrogance)  is recorded on

http://mail.gnu.org/pipermail/bug-glibc/2000-May/000667.html

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list