19 May 2006 13:06
Strange things in math.h under Intel OSX
Max Persson <koexistens <at> gmail.com>
2006-05-19 11:06:31 GMT
2006-05-19 11:06:31 GMT
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)
RSS Feed