Skip to contentSkip to conversation

gnu-c99-math.h include file

Qemu-devel Juergen Keil 2 participants 2 messages Apr 8, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines

Downloaded a tarball of the latest cvs bits to see about getting the latest changes melded with the working solaris host bits.

In fpu/softfloat-native.h, there is an include
#include "gnu-c99-math.h" that is not part of
any of the gnu software I have loaded.

I've invented this file, to work around the problem that some of the new C99 "math.h" features/macros like isnormal(), isgreater(), isunordered(), etc... cannot be compiled with GNUC 3.4.x on Solaris 10 (the new macros can only be used with Sun's C-Compiler)

% cat gnu-c99-math.h
#if defined(__SVR4) && defined(__GNUC__)

/*
* C99 7.12.3 classification macros
* and
* C99 7.12.14 comparison macros
*
* ... do not work on Solaris 10 using GNU CC 3.4.x.
* Try to workaround the missing / broken C99 math macros. */
#include <ieeefp.h>

#define isnormal(x) (fpclass(x) >= FP_NZERO)

#define isgreater(x, y)         ((x) > (y))
#define isgreaterequal(x, y)    ((x) >= (y))
#define isless(x, y)            ((x) < (y))
#define islessequal(x, y)       ((x) <= (y))

#define isunordered(x,y) unordered(x, y)

#endif

#1 lore raw
Quoted 8 lines

#include <ieeefp.h>

#define isnormal(x) (fpclass(x) >= FP_NZERO)

#define isgreater(x, y)         ((x) > (y))
#define isgreaterequal(x, y)    ((x) >= (y))
#define isless(x, y)            ((x) < (y))
#define islessequal(x, y)       ((x) <= (y))

These are not correct. eg. You should be using

#define isgreater(x, y) ((!unordered(x, y)) && ((x) > (y))

Paul