Subject: Re: libm and libc
To: None <tech-userlevel@netbsd.org>
From: Wolfgang Rupprecht <wolfgang@wsrcc.com>
List: tech-userlevel
Date: 05/30/2001 10:24:56
> Given that libm actually depends on some of the more critical
> internals of libc (i.e. __errno; __sF could be worked around) which
> differ in their glibc implementations, it's not quite clear to me what
> you would gain by including only __infinity and isinf()/isnan().

Speaking of infinity, do the standards mandate that HUGE_VAL has to
have the following round-about definition?

        extern __const char __infinity[];
        #define HUGE_VAL	(*(__const double *)(__const void *)__infinity)

Its really a pain if one wants to initialize an array with a value of
infinity as such:

        double mytable[] = {0.0, 1.0, 2.0, ... , HUGE_VAL};

I always find myself defining INFINITY as a literal infinity and
ignoring the built-in __infinity entirely.  eg. 

    /*
     * The posix definition above isn't a usable constant in array initializers!
     * use this instead.  Anything over 1e309 is INFINITE in IEEE doubles.
     */
    #define INFINITY 1e999

Clearly I'd prefer to use a builtin literal, but I can't find one.

-wolfgang
-- 
       Wolfgang Rupprecht <wolfgang+gnus@dailyplanet.wsrcc.com>
		    http://www.wsrcc.com/wolfgang/
Coming soon: GPS mapping tools for Open Systems. http://www.gnomad-mapping.com/