Hi, Attaching a patch that introduces a macro called "isfinite", which is used if the actual C99 macro with the same name is not available. Originally defined in the GNU coreutils: http://cvs.savannah.gnu.org/viewvc/coreutils/coreutils/src/seq.c?revision=1.95&view=markup /* Roll our own isfinite rather than using <math.h>, so that we don't have to worry about linking -lm just for isfinite. */ #ifndef isfinite # define isfinite(x) ((x) * 0 == 0) #endif This works because in the world of floating point numbers, anything multiplied by zero is not always zero. If x is a NaN then the result is a NaN and if it is infinite then the result is infinite. So the multiplication cannot be optimised away by the compiler. This definition is supposed to work on all platforms (unless there is a bug in the compiler). The reason we might want to use the system definition of isfinite is probably only for performance, which is not a very big priority here. Hence removed #include <math.h> and #include <float.h> since the only purpose of these files was to introduce suitable macros for checking finiteness. Also removed the check for OS/2. This change compiles correctly on GCC ... needs checking on other platforms. Sameer. -- http://www.it.iitb.ac.in/~sameerds/
Attachment:
isfinite.patch
Description: Text Data