X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX18iFb17N0UiHYzkp1A1N+PXxoqZeCRYHjDbNvyhBZ oox3F4SxuGzkiR From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Implementation of is* family of macros for math.h Date: Thu, 12 Jun 2008 10:04:33 +0200 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200806121004.35757.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com I have implemented the missing macros: isgreater, isgreaterequal, isless, islessequal, islessgreater and isunordered. A test programm for all is* macros have been added, also a doc file. Suggestions, object, comments are welcome. Regards, Juan M. Guerrero 2008-06-10 Juan Manuel Guerrero * src/include/math.h: The macros isgreater, isgreaterequal, isless, islessequal, islessgreater and isunordered have been added. * src/libc/c99/math/ismacros.txh: Documentation about is* family of macros added. * tests/libc/c99/math/makefile: Entry for t-ismac.c added. * tests/libc/c99/math/t-ismac.c: Test file for the is* family of macros. * src/docs/kb/wc204.txi: Info about is* macros added. diff -aprNU3 djgpp.orig/include/math.h djgpp/include/math.h --- djgpp.orig/include/math.h 2008-04-06 21:14:54 +0000 +++ djgpp/include/math.h 2008-06-12 09:05:54 +0000 @@ -107,20 +107,47 @@ extern float __dj_nan; /* Extended with Unnormals (for long doubles). */ #define FP_UNNORMAL 0x00010000 -#define fpclassify(x) ((sizeof(x)==sizeof(float))? __fpclassifyf(x) : \ - (sizeof(x)==sizeof(double))? __fpclassifyd(x) : \ - __fpclassifyld(x)) - -#define signbit(x) (__extension__ ({__typeof__(x) __x = (x); \ - (sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \ - (sizeof(__x) == sizeof(double)) ? __signbitd(__x) : \ - __signbitld(__x); \ - })) - -#define isfinite(x) ((fpclassify(x) & (FP_NORMAL|FP_SUBNORMAL|FP_ZERO)) != 0) -#define isinf(x) (fpclassify(x)==FP_INFINITE) -#define isnan(x) (fpclassify(x)==FP_NAN) -#define isnormal(x) (fpclassify(x)==FP_NORMAL) +#define fpclassify(x) (__extension__ ({__typeof__(x) __x = (x); \ + (sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \ + (sizeof(__x) == sizeof(double)) ? __fpclassifyd(__x) : \ + __fpclassifyld(__x); \ + })) + +#define signbit(x) (__extension__ ({__typeof__(x) __x = (x); \ + (sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \ + (sizeof(__x) == sizeof(double)) ? __signbitd(__x) : \ + __signbitld(__x); \ + })) + +#define isfinite(x) ((fpclassify(x) & (FP_NORMAL | FP_SUBNORMAL | FP_ZERO)) != 0) +#define isinf(x) (fpclassify(x) == FP_INFINITE) +#define isnan(x) (fpclassify(x) == FP_NAN) +#define isnormal(x) (fpclassify(x) == FP_NORMAL) + +#define isgreater(x, y) (__extension__ ({__typeof__(x) __x = (x); \ + __typeof__(y) __y = (y); \ + !isunordered(__x, __y) && (__x > __y); \ + })) +#define isgreaterequal(x, y) (__extension__ ({__typeof__(x) __x = (x); \ + __typeof__(y) __y = (y); \ + !isunordered(__x, __y) && (__x >= __y); \ + })) +#define isless(x, y) (__extension__ ({__typeof__(x) __x = (x); \ + __typeof__(y) __y = (y); \ + !isunordered(__x, __y) && (__x < __y); \ + })) +#define islessequal(x, y) (__extension__ ({__typeof__(x) __x = (x); \ + __typeof__(y) __y = (y); \ + !isunordered(__x, __y) && (__x <= __y); \ + })) +#define islessgreater(x, y) (__extension__ ({__typeof__(x) __x = (x); \ + __typeof__(y) __y = (y); \ + !isunordered(__x, __y) && (__x < __y || __x > __y); \ + })) +#define isunordered(x, y) (__extension__ ({__typeof__(x) __xx = (x); \ + __typeof__(y) __yy = (y); \ + (fpclassify(__xx) == FP_NAN) || (fpclassify(__yy) == FP_NAN); \ + })) int __fpclassifyf(float) __attribute__((const)); int __fpclassifyd(double) __attribute__((const)); diff -aprNU3 djgpp.orig/src/libc/c99/math/ismacros.txh djgpp/src/libc/c99/math/ismacros.txh --- djgpp.orig/src/libc/c99/math/ismacros.txh 1970-01-01 00:00:00 +0000 +++ djgpp/src/libc/c99/math/ismacros.txh 2008-06-12 09:05:54 +0000 @@ -0,0 +1,422 @@ +@node isfinite, math +@findex isfinite +@subheading Syntax + +@example +#include + +int isfinite(x); +@end example + +@subheading Description + +The macro @code{isfinite} will determine whether its argument @var{x} has a finite +value (zero, subnormal, or normal, and not infinite or NaN). The operands can be +of any real floating-point type. + +@subheading Return Value + +non-zero for a finite value; +zero else. + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +long double ld = 3.14159265358979; + +if (isfinite(ld)) + printf("value is finite.\n"); +else if (isinf(ld)) + printf("value is infinite.\n"); +else if (isnan(ld)) + printf("value is NaN.\n"); + +@end example + +@c ---------------------------------------------------------------------- +@node isgreater, math +@findex isgreater +@subheading Syntax + +@example +#include + +int isgreater(x, y); +@end example + +@subheading Description + +The macro @code{isgreater} will determine whether its first argument @var{x} is +greater than its second argument @var{y} without failing if one of the operands is +@code{NaN}. The operands can be of any real floating-point type and the macro is +guaranteed to evaluate their operands only once. + +@subheading Return Value + +zero if one of @var{x} or @var{y} is @code{NaN}; +else the result of (@var{x}) > (@var{y}). + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +float f = 1; +double d = INFINITY; + +if (isnan(f) || isnan(d)) + printf("f or d is NaN.\n"); +else +@{ + if (isgreater(f, d)) + printf("f is greater than d.\n"); + else + printf("f is not greater than d.\n"); +@} + +@end example + +@c ---------------------------------------------------------------------- +@node isgreaterequal, math +@findex isgreaterequal +@subheading Syntax + +@example +#include + +int isgreaterequal(x, y); +@end example + +@subheading Description + +The macro @code{isgreaterequal} will determine whether its first argument @var{x} is +greater than or equal to its second argument @var{y} without failing if one of the operands +is @code{NaN}. The operands can be of any real floating-point type and the macro is +guaranteed to evaluate their operands only once. + +@subheading Return Value + +zero if one of @var{x} or @var{y} is @code{NaN}; +else the result of (@var{x}) >= (@var{y}). + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +float f = 1; +double d = INFINITY; + +if (isnan(f) || isnan(d)) + printf("f or d is NaN.\n"); +else +@{ + if (isgreaterequal(f, d)) + printf("f is greater than or equal to d.\n"); + else + printf("f is not greater than d.\n"); +@} + +@end example + +@c ---------------------------------------------------------------------- +@node isinf, math +@findex isinf +@subheading Syntax + +@example +#include + +int isinf(x); +@end example + +@subheading Description + +The macro @code{isinf} will determine whether its argument @var{x} value is a positive +or negative infinity. The operands can be of any real floating-point type. + +@subheading Return Value + +non-zero for a infinite value (positive or negative); +zero else. + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +double d = INFINITY; + +if (isinf(d)) + printf("value is infinite.\n"); +else if (isnan(d)) + printf("value is NaN.\n"); +else + printf("value is finite.\n"); + +@end example + +@c ---------------------------------------------------------------------- +@node isless, math +@findex isless +@subheading Syntax + +@example +#include + +int isless(x, y); +@end example + +@subheading Description + +The macro @code{isless} will determine whether its first argument @var{x} is less than +its second argument @var{y} without failing if one of the operands is @code{NaN}. The +operands can be of any real floating-point type and the macro is guaranteed to evaluate +their operands only once. + +@subheading Return Value + +zero if one of @var{x} or @var{y} is @code{NaN}; +else the result of (@var{x}) < (@var{y}). + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +float f = 1; +double d = INFINITY; + +if (isnan(f) || isnan(d)) + printf("f or d is NaN.\n"); +else +@{ + if (isless(f, d)) + printf("f is less than d.\n"); + else + printf("f is not less than d.\n"); +@} + +@end example + +@c ---------------------------------------------------------------------- +@node islessequal, math +@findex islessequal +@subheading Syntax + +@example +#include + +int islessequal(x, y); +@end example + +@subheading Description + +The macro @code{islessequal} will determine whether its first argument @var{x} is less +than or equal to its second argument @var{y} without failing if one of the operands is +@code{NaN}. The operands can be of any real floating-point type and the macro is +guaranteed to evaluate their operands only once. + +@subheading Return Value + +zero if one of @var{x} or @var{y} is @code{NaN}; +else the result of (@var{x}) <= (@var{y}). + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +float f = 1; +double d = INFINITY; + +if (isnan(f) || isnan(d)) + printf("f or d is NaN.\n"); +else +@{ + if (islessequal(f, d)) + printf("f is less than or equal to d.\n"); + else + printf("f is not less than d.\n"); +@} + +@end example + +@c ---------------------------------------------------------------------- +@node islessgreater, math +@findex islessgreater +@subheading Syntax + +@example +#include + +int islessgreater(x, y); +@end example + +@subheading Description + +The macro @code{islessgreater} will determine whether its first argument @var{x} is less +than or greater than its second argument @var{y} without failing if one of the operands +is @code{NaN}. The operands can be of any real floating-point type and the macro is +guaranteed to evaluate their operands only once. + +@subheading Return Value + +zero if one of @var{x} or @var{y} is @code{NaN}; +else the result of (@var{x}) < (@var{y}) || (@var{x}) > (@var{y}). + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +double d = 1; +long double ld = 1; + +if (isnan(ld) || isnan(d)) + printf("ld or d is NaN.\n"); +else +@{ + if (islessgreater(lf, d)) + printf("ld is less than d or ld is greater than d.\n"); + else + printf("ld is equal to d.\n"); +@} + +@end example + +@c ---------------------------------------------------------------------- +@node isnan, math +@findex isnan +@subheading Syntax + +@example +#include + +int isnan(x); +@end example + +@subheading Description + +The macro @code{isnan} will determine whether its argument @var{x} is a NaN. The operands +can be of any real floating-point type. + +@subheading Return Value + +non-zero for NaN; +zero else. + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +float f = NAN; + +if (isnan(f)) + printf("value is NaN.\n"); +else if (isinf(f)) + printf("value is infinite.\n"); +else + printf("value is finite.\n"); + +@end example + +@c ---------------------------------------------------------------------- +@node isnormal, math +@findex isnormal +@subheading Syntax + +@example +#include + +int isnormal(x); +@end example + +@subheading Description + +The macro @code{isnormal} will determine whether its argument @var{x} is normal +(neither zero, subnormal, infinite nor NaN). The operands can be of any real +floating-point type. + +@subheading Return Value + +non-zero for a normal value; +zero else. + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +long double ld = 3.14159265358979; + +if (isfinite(ld)) +@{ + if (isnormal(ld)) + printf("value is normal.\n"); + else + printf("value is either zero or subnormal.\n"); +@} +else + printf("value is either infinity or NaN.\n"); + +@end example + +@c ---------------------------------------------------------------------- +@node isunordered, math +@findex isunordered +@subheading Syntax + +@example +#include + +int isunordered(x); +@end example + +@subheading Description + +The macro @code{isunordered} will determine whether its arguments @var{x} or @var{y} are unordered. +The operands can be of any real floating-point type. + +@subheading Return Value + +non-zero if one of @var{x} or @var{y} is @code{NaN}; +zero else. + +@subheading Portability + +@portability !ansi-c89, ansi-c99 + +@subheading Example + +@example +float pi = 3.14159; +long double x = NAN; + +if (isunordered(pi, x)) + printf("one of the values is NaN.\n"); + +@end example + +@c ---------------------------------------------------------------------- diff -aprNU3 djgpp.orig/tests/libc/c99/math/makefile djgpp/tests/libc/c99/math/makefile --- djgpp.orig/tests/libc/c99/math/makefile 2003-10-25 11:22:52 +0000 +++ djgpp/tests/libc/c99/math/makefile 2008-06-12 09:05:54 +0000 @@ -3,5 +3,6 @@ TOP=../.. SRC += t-fpclas.c SRC += t-nan.c SRC += t-nan2.c +SRC += t-ismac.c include $(TOP)/../makefile.inc diff -aprNU3 djgpp.orig/tests/libc/c99/math/t-ismac.c djgpp/tests/libc/c99/math/t-ismac.c --- djgpp.orig/tests/libc/c99/math/t-ismac.c 1970-01-01 00:00:00 +0000 +++ djgpp/tests/libc/c99/math/t-ismac.c 2008-06-12 09:05:54 +0000 @@ -0,0 +1,472 @@ +#include +#include +#include + + +typedef union +{ + long_double_t ldt; + long double ld; +} test_long_double_union_t; + +typedef struct { + const char *class; + const char *type; + test_long_double_union_t number; +} test_long_double_t; + + +typedef union +{ + double_t dt; + double d; +} test_double_union_t; + +typedef struct { + const char *class; + const char *type; + test_double_union_t number; +} test_double_t; + + +typedef union +{ + float_t ft; + float f; +} test_float_union_t; + +typedef struct { + const char *class; + const char *type; + test_float_union_t number; +} test_float_t; + + +int main(void) +{ + int i; + + test_long_double_t test_ld[] = { + /* Normals. (4) */ + {"long double", "small positive normal", {{1, 0x80000000, 1, 0}}}, /* Smallest possible > 0. */ + {"long double", "small negative normal", {{1, 0x80000000, 1, 1}}}, /* Biggest possible < 0. */ + {"long double", "big positive normal", {{0xFFFFFFFF, 0xFFFFFFFF, 0x7FFE, 0}}}, /* Big number. */ + {"long double", "big negative normal", {{0xFFFFFFFF, 0xFFFFFFFF, 0x7FFE, 1}}}, /* Big -number. */ + + /* Subnormals aka denormals. (4 + 2) */ + {"long double", "positive subnormal", {{1, 0, 0, 0}}}, /* Smallest possible > 0. */ + {"long double", "negative subnormal", {{1, 0, 0, 1}}}, /* Biggest possible < 0. */ + + /* Zeros. (4 + 2 + 2) */ + {"long double", "positive zero", {{0, 0, 0, 0 }}}, /* 0.0 */ + {"long double", "negative zero", {{0, 0, 0, 1 }}}, /* -0.0 */ + + /* Infinities. (4 + 2 + 2 + 2) */ + {"long double", "positive infinity", {{0, 0x80000000, 0x7FFF, 0}}}, /* Inf. */ + {"long double", "negative infinity", {{0, 0x80000000, 0x7FFF, 1}}}, /* -Inf. */ + + /* NaNs. (4 + 2 + 2 + 2 + 4) */ + {"long double", "positive signalling NaN", {{1, 0x80000000, 0x7FFF, 0}}}, /* SNaN */ + {"long double", "negative signalling NaN", {{1, 0x80000000, 0x7FFF, 1}}}, /* -SNaN */ + {"long double", "positive quiet NaN", {{0, 0xFFFFFFFF, 0x7FFF, 0}}}, /* QNaN */ + {"long double", "negative quiet NaN", {{0, 0xFFFFFFFF, 0x7FFF, 1}}} /* -QNaN */ + }; + + test_double_t test_d[] = { + /* Normals. */ + {"double", "small positive normal", {{1, 0, 1, 0}}}, /* Small number. */ + {"double", "small negative normal", {{1, 0, 1, 1}}}, /* Small -number. */ + {"double", "big positive normal", {{0xFFFFFFFF, 0x7FFFF, 0x7FE, 0}}}, /* Big number. */ + {"double", "big negative normal", {{0xFFFFFFFF, 0x7FFFF, 0x7FE, 1}}}, /* Big -number. */ + + /* Subnormals aka denormals. */ + {"double", "positive subnormal", {{1, 0, 0, 0}}}, /* Very small number. */ + {"double", "negative subnormal", {{1, 0, 0, 1}}}, /* Very small -number. */ + + /* Zeros. */ + {"double", "positive zero", {{0, 0, 0, 0}}}, /* 0.0 */ + {"double", "negative zero", {{0, 0, 0, 1}}}, /* -0.0 */ + + /* Infinities. */ + {"double", "positive infinity", {{0, 0, 0x7FF, 0}}}, /* Inf. */ + {"double", "negative infinity", {{0, 0, 0x7FF, 1}}}, /* -Inf. */ + + /* NaNs. */ + {"double", "positive signalling NaN", {{1, 0, 0x7FF, 0}}}, /* SNaN */ + {"double", "negative signalling NaN", {{1, 0, 0x7FF, 1}}}, /* -SNaN */ + {"double", "positive quiet NaN", {{0, 0xFFFFF, 0x7FF, 0}}}, /* QNaN */ + {"double", "negative quiet NaN", {{0, 0xFFFFF, 0x7FF, 1}}} /* -QNaN */ + }; + + test_float_t test_f[] = { + /* Normals. */ + {"float", "small positive normal", {{1, 1, 0}}}, /* Small number. */ + {"float", "small negative normal", {{1, 1, 1}}}, /* Small -number. */ + {"float", "big positive normal", {{0xFF, 0xFE, 0}}}, /* Big number. */ + {"float", "big negative normal", {{0xFF, 0xFE, 1}}}, /* Big -number. */ + + /* Subnormals aka denormals. */ + {"float", "positive subnormal", {{1, 0, 0}}}, /* Very small number. */ + {"float", "negative subnormal", {{1, 0, 1}}}, /* Very small -number. */ + + /* Zeros. */ + {"float", "positive zero", {{0, 0, 0}}}, /* 0.0 */ + {"float", "negative zero", {{0, 0, 1}}}, /* -0.0 */ + + /* Infinities. */ + {"float", "positive infinity", {{0, 0xFF, 0}}}, /* Inf */ + {"float", "negative infinity", {{0, 0xFF, 1}}}, /* -Inf */ + + /* NaNs. */ + {"float", "positive signalling NaN", {{1, 0xFF, 0}}}, /* SNaN */ + {"float", "negative signalling NaN", {{1, 0xFF, 1}}}, /* -SNaN */ + {"float", "positive quiet NaN", {{0x7FFFFF, 0xFF, 0}}}, /* QNaN */ + {"float", "negative quiet NaN", {{0x7FFFFF, 0xFF, 1}}} /* -QNaN */ + }; + + + + /* + * isfinite must return non-zero for normals, subnormals and zero, + * and zero for infinity and NaN. + */ + printf("Testing isfinite macro...\n" + "isfinite(x) must return non-zero if x is normal, subnormal and zero,\n" + "and zero for infinity and NaN.\n"); + for (i = 0; i < (4 + 2 + 2); i++) + { + printf("Testing isfinite(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isfinite(test_ld[i].number.ld)); + printf("Testing isfinite(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isfinite(test_d[i].number.d)); + printf("Testing isfinite(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isfinite(test_f[i].number.f)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isfinite(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isfinite(test_ld[i].number.ld)); + printf("Testing isfinite(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isfinite(test_d[i].number.d)); + printf("Testing isfinite(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isfinite(test_f[i].number.f)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isnormal must return non-zero for normals + * and zero for subnormals, zero, infinity and NaN. + */ + printf("\n\nTesting isnormal macro...\n" + "isnormal(x) must return non-zero if x is normal\n" + "and zero for subnormals, zero, infinity and NaN.\n"); + for (i = 0; i < 4; i++) + { + printf("Testing isnormal(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isnormal(test_ld[i].number.ld)); + printf("Testing isnormal(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isnormal(test_d[i].number.d)); + printf("Testing isnormal(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isnormal(test_f[i].number.f)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isnormal(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isnormal(test_ld[i].number.ld)); + printf("Testing isnormal(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isnormal(test_d[i].number.d)); + printf("Testing isnormal(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isnormal(test_f[i].number.f)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isinf must return non-zero for infinity (positive or negative) + * and zero else. + */ + printf("\n\nTesting isinf macro...\n" + "isinf(x) must return non-zero if x is infinity (positive or negative)\n" + "else zero.\n"); + for (i = 0; i < (4 + 2 + 2); i++) + { + printf("Testing isinf(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isinf(test_ld[i].number.ld)); + printf("Testing isinf(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isinf(test_d[i].number.d)); + printf("Testing isinf(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isinf(test_f[i].number.f)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing isinf(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isinf(test_ld[i].number.ld)); + printf("Testing isinf(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isinf(test_d[i].number.d)); + printf("Testing isinf(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isinf(test_f[i].number.f)); + } + for (; i <(4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isinf(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isinf(test_ld[i].number.ld)); + printf("Testing isinf(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isinf(test_d[i].number.d)); + printf("Testing isinf(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isinf(test_f[i].number.f)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isnan must return non-zero for [SQ]NaN (positive or negative) + * and zero else. + */ + printf("\n\nTesting isnan macro...\n" + "isnan(x) must return non-zero if x is [SQ]NaN (positive or negative)\n" + "else zero.\n"); + for (i = 0; i < 10; i++) + { + printf("Testing isnan(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isnan(test_ld[i].number.ld)); + printf("Testing isnan(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isnan(test_d[i].number.d)); + printf("Testing isnan(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isnan(test_f[i].number.f)); + } + for (; i < 10 + 4; i++) + { + printf("Testing isnan(%La) for a %s %s: %d\n", test_ld[i].number.ld, test_ld[i].class, test_ld[i].type, isnan(test_ld[i].number.ld)); + printf("Testing isnan(%a) for a %s %s: %d\n", test_d[i].number.d, test_d[i].class, test_d[i].type, isnan(test_d[i].number.d)); + printf("Testing isnan(%a) for a %s %s: %d\n\n", test_f[i].number.f, test_f[i].class, test_f[i].type, isnan(test_f[i].number.f)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isgreater must return zero if x or y is [SQ]NaN (positive or negative) + * and else the result of x > y. + */ + printf("\n\nTesting isgreater macro...\n" + "isgreater(x, y) must return zero if x or y is [SQ]NaN (positive or negative)\n" + "and else the result of x > y.\n"); + for (i = 0; i < 4; i++) + { + printf("Testing isgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2); i++) + { + printf("Testing isgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2); i++) + { + printf("Testing isgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing isgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isgreaterequal must return zero if x or y is [SQ]NaN (positive or negative) + * and else the result of x >= y. + */ + printf("\n\nTesting isgreaterequal macro...\n" + "isgreaterequal(x, y) must return zero if x or y is [SQ]NaN (positive or negative)\n" + "and else the result of x >= y.\n"); + for (i = 0; i < 4; i++) + { + printf("Testing isgreaterequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreaterequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreaterequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreaterequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreaterequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreaterequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2); i++) + { + printf("Testing isgreaterequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreaterequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreaterequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreaterequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreaterequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreaterequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2); i++) + { + printf("Testing isgreaterequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreaterequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreaterequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreaterequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreaterequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreaterequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing isgreaterequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreaterequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreaterequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreaterequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreaterequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreaterequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isgreaterequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isgreaterequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isgreaterequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isgreaterequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isgreaterequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isgreaterequal(test_f[i].number.f, test_ld[i].number.ld)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isless must return zero if x or y is [SQ]NaN (positive or negative) + * and else the result of x < y. + */ + printf("\n\nTesting isless macro...\n" + "isless(x, y) must return zero if x or y is [SQ]NaN (positive or negative)\n" + "and else the result of x < y.\n"); + for (i = 0; i < 4; i++) + { + printf("Testing isless(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isless(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isless(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isless(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isless(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isless(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2); i++) + { + printf("Testing isless(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isless(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isless(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isless(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isless(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isless(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2); i++) + { + printf("Testing isless(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isless(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isless(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isless(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isless(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isless(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing isless(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isless(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isless(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isless(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isless(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isless(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isless(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isless(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isless(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isless(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isless(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isless(test_f[i].number.f, test_ld[i].number.ld)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * islessequal must return zero if x or y is [SQ]NaN (positive or negative) + * and else the result of x <= y. + */ + printf("\n\nTesting islessequal macro...\n" + "islessequal(x, y) must return zero if x or y is [SQ]NaN (positive or negative)\n" + "and else the result of x <= y.\n"); + for (i = 0; i < 4; i++) + { + printf("Testing islessequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2); i++) + { + printf("Testing islessequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2); i++) + { + printf("Testing islessequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing islessequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessequal(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing islessequal(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessequal(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessequal(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessequal(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessequal(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessequal(test_f[i].number.f, test_ld[i].number.ld)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * islessgreater must return zero if x or y is [SQ]NaN (positive or negative) + * and else the result of (x < y) || x > y). + */ + printf("\n\nTesting islessgreater macro...\n" + "islessgreater(x, y) must return zero if x or y is [SQ]NaN (positive or negative)\n" + "and else the result of (x < y) || x > y).\n"); + for (i = 0; i < 4; i++) + { + printf("Testing islessgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2); i++) + { + printf("Testing islessgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2); i++) + { + printf("Testing islessgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing islessgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing islessgreater(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, islessgreater(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing islessgreater(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, islessgreater(test_d[i].number.d, test_f[i].number.f)); + printf("Testing islessgreater(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, islessgreater(test_f[i].number.f, test_ld[i].number.ld)); + } + printf("----------------------------------------------------------------------\n"); + + + + /* + * isunordered must return non-zero if x or y is [SQ]NaN (positive or negative) + * and zero else. + */ + printf("\n\nTesting isunordered macro...\n" + "isunordered(x, y) must return non-zero if x or y is [SQ]NaN (positive or negative)\n" + "and zero else.\n"); + for (i = 0; i < 4; i++) + { + printf("Testing isunordered(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isunordered(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isunordered(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isunordered(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isunordered(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isunordered(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2); i++) + { + printf("Testing isunordered(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isunordered(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isunordered(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isunordered(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isunordered(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isunordered(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2); i++) + { + printf("Testing isunordered(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isunordered(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isunordered(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isunordered(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isunordered(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isunordered(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2); i++) + { + printf("Testing isunordered(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isunordered(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isunordered(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isunordered(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isunordered(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isunordered(test_f[i].number.f, test_ld[i].number.ld)); + } + for (; i < (4 + 2 + 2 + 2 + 4); i++) + { + printf("Testing isunordered(%La, %a) for a %s %s and %s %s: %d\n", test_ld[i].number.ld, test_d[i].number.d, test_ld[i].class, test_ld[i].type, test_d[i].class, test_d[i].type, isunordered(test_ld[i].number.ld, test_d[i].number.d)); + printf("Testing isunordered(%a, %a) for a %s %s and %s %s: %d\n", test_d[i].number.d, test_f[i].number.f, test_d[i].class, test_d[i].type, test_f[i].class, test_f[i].type, isunordered(test_d[i].number.d, test_f[i].number.f)); + printf("Testing isunordered(%a, %La) for a %s %s and %s %s: %d\n\n", test_f[i].number.f, test_ld[i].number.ld, test_f[i].class, test_f[i].type, test_ld[i].class, test_ld[i].type, isunordered(test_f[i].number.f, test_ld[i].number.ld)); + } + printf("----------------------------------------------------------------------\n"); + + return 0; +}