[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is malloc being defined as rpl_malloc ??

From: Paul Eggert
Subject: Re: Why is malloc being defined as rpl_malloc ??
Date: 05 May 2003 12:00:39 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

"Dr. David Kirkby" <address@hidden> writes:

> > I long ago lost interest in porting to any machines that don't conform
> > to the IEEE-754 floating point standard (ISO/IEC 559:1989).  
> That does rather exclude some common machines, like the Alphas. 

But the Alpha uses IEEE-754 arithmetic.  It's only the older designs
(IBM and Unisys mainframes, VAX, Crays) that lack IEEE.

> Is there an autoconf macro that checks for IEEE-754 conformance? 

No.  C99 says that implementations predefine the symbol __STDC_IEC_559__
if they conform to IEC 559 (i.e. IEEE-754).  However, few implementations
do that yet, since few conform to C99 yet, so I would suggest code like
the following instead:

   #ifdef STDC_HEADERS
   # include <float.h>

   #if (__STDC_IEC_559__
        || (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
            && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128))

This works on all implementations that I know of, and code like this
has been in GNU Emacs for many years (I contributed it in 1996).


Some of that web page is quite inaccurate, at least by today's
standards.  For example, it says that IEEE-754 floating point
performance is slower than non-IEEE, but if you look at Spec CFP2000,
say, the fastest single-CPU score is the Bull NovaScale 4040, which
scores 1391 (it is a 1 GHz Itanium 2 running 64-bit GNU/Linux, by the
way).  This tops even the Alpha (HP AlphaSever GS1280, scoring 1124),
and is miles ahead of any non-IEEE-754 box that I know of.

Also, I'm generally not concerned with every last little detail of
IEEE-754.  After all, even the x86, which does conform to the
standard, conforms to it in a tricky way that makes accurate
floating-point programming difficult in common high-level languages
like C and Fortran.  What I am concerned with is whether the platform
conforms to the spirit of IEEE-754.  All modern platforms do so,
including the Alpha -- though some are more grudging than others.

> My attitude is that if I can produce code that produces
> 'sensible/useful' results on hardware not conforming to that standard,
> without sacrificing performance on IEEE-754 machines, I will do so. 

Hmm, even if the code is noticeably harder to maintain?  You'd do that
just for IBM mainframes and Crays?  I'm not sure I'd bother, myself.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]