Max Persson | 19 May 2006 13:06
Picon

Strange things in math.h under Intel OSX

Hi there,

It seems like Apple may have done some mistakes in their port
of the standard c library (which I seriously doubt). I bumped in to
this problem when I compiled
some tests for OpenEXR (under Intel OS X on a MacBook Pro). It says
that a function from math.h is invalid. As you may know, there are two
versions of some of the stuff in the std-c library, one for ppc and
the other for i386. math.h is one of them. There is a macro/function
called isnan() that determines if a float is a number or not, and it
was here I bumped into the strange things. I opened up both versions
of math.h and compared the implementation of the isnan() macro...

Here is the one in the i386 math.h:

#define isnan(x)        \
       (       sizeof (x) == sizeof(float )    ?       __isnanf(x)     \
       :       sizeof (x) == sizeof(double)    ?       __isnand(x)     \

        :       __isnan (x))

And here is the one from the ppc math.h:

#define      isnan( x )         ( ( sizeof ( (x) ) == sizeof(double) )
?           \
                             __isnand ( (double)(x) ) :
                 \
                               ( sizeof ( (x) ) == sizeof( float) ) ?
          \
                             __isnanf ( (float)(x) ) :
(Continue reading)

Shantonu Sen | 19 May 2006 15:30

Re: Strange things in math.h under Intel OSX

Sounds like a bug. You should report it as such at <http://bugreporter.apple.com 
 >

Shantonu

On May 19, 2006, at 4:06 AM, Max Persson wrote:

> Hi there,
>
> It seems like Apple may have done some mistakes in their port
> of the standard c library (which I seriously doubt). I bumped in to
> this problem when I compiled
> some tests for OpenEXR (under Intel OS X on a MacBook Pro). It says
> that a function from math.h is invalid. As you may know, there are two
> versions of some of the stuff in the std-c library, one for ppc and
> the other for i386. math.h is one of them. There is a macro/function
> called isnan() that determines if a float is a number or not, and it
> was here I bumped into the strange things. I opened up both versions
> of math.h and compared the implementation of the isnan() macro...
>
>
> Here is the one in the i386 math.h:
>
> #define isnan(x)        \
>       (       sizeof (x) == sizeof(float )    ?       __isnanf 
> (x)     \
>       :       sizeof (x) == sizeof(double)    ?       __isnand 
> (x)     \
>
>        :       __isnan (x))
(Continue reading)


Gmane