1 /*************************************************************************
3 * $Id: trionan.c,v 1.26 2002/12/08 12:08:21 breese Exp $
5 * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
16 ************************************************************************
18 * Functions to handle special quantities in floating-point numbers
19 * (that is, NaNs and infinity). They provide the capability to detect
20 * and fabricate special quantities.
22 * Although written to be as portable as possible, it can never be
23 * guaranteed to work on all platforms, as not all hardware supports
26 * The approach used here (approximately) is to:
28 * 1. Use C99 functionality when available.
29 * 2. Use IEEE 754 bit-patterns if possible.
30 * 3. Use platform-specific techniques.
32 ************************************************************************/
36 * o Put all the magic into trio_fpclassify_and_signbit(), and use this from
40 /*************************************************************************
50 #if defined(TRIO_PLATFORM_UNIX)
53 #if defined(TRIO_COMPILER_DECC)
54 # include <fp_class.h>
58 #if defined(TRIO_DOCUMENTATION)
59 # include "doc/doc_nan.h"
61 /** @addtogroup SpecialQuantities
65 /*************************************************************************
69 #define TRIO_TRUE (1 == 1)
70 #define TRIO_FALSE (0 == 1)
73 * We must enable IEEE floating-point on Alpha
75 #if defined(__alpha) && !defined(_IEEE_FP)
76 # if defined(TRIO_COMPILER_DECC)
77 # if defined(TRIO_PLATFORM_VMS)
78 # error "Must be compiled with option /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE"
81 # error "Must be compiled with option -ieee"
84 # elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__))
85 # error "Must be compiled with option -mieee"
87 #endif /* __alpha && ! _IEEE_FP */
90 * In ANSI/IEEE 754-1985 64-bits double format numbers have the
91 * following properties (amoungst others)
93 * o FLT_RADIX == 2: binary encoding
94 * o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used
95 * to indicate special numbers (e.g. NaN and Infinity), so the
96 * maximum exponent is 10 bits wide (2^10 == 1024).
97 * o DBL_MANT_DIG == 53: The mantissa is 52 bits wide, but because
98 * numbers are normalized the initial binary 1 is represented
99 * implicitly (the so-called "hidden bit"), which leaves us with
100 * the ability to represent 53 bits wide mantissa.
102 #if (FLT_RADIX == 2) && (DBL_MAX_EXP == 1024) && (DBL_MANT_DIG == 53)
103 # define USE_IEEE_754
107 /*************************************************************************
111 static TRIO_CONST char rcsid[] = "@(#)$Id: trionan.c,v 1.26 2002/12/08 12:08:21 breese Exp $";
113 #if defined(USE_IEEE_754)
116 * Endian-agnostic indexing macro.
118 * The value of internalEndianMagic, when converted into a 64-bit
119 * integer, becomes 0x0706050403020100 (we could have used a 64-bit
120 * integer value instead of a double, but not all platforms supports
121 * that type). The value is automatically encoded with the correct
122 * endianess by the compiler, which means that we can support any
123 * kind of endianess. The individual bytes are then used as an index
124 * for the IEEE 754 bit-patterns and masks.
126 #define TRIO_DOUBLE_INDEX(x) (((unsigned char *)&internalEndianMagic)[7-(x)])
128 static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275;
130 /* Mask for the exponent */
131 static TRIO_CONST unsigned char ieee_754_exponent_mask[] = {
132 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
135 /* Mask for the mantissa */
136 static TRIO_CONST unsigned char ieee_754_mantissa_mask[] = {
137 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
140 /* Mask for the sign bit */
141 static TRIO_CONST unsigned char ieee_754_sign_mask[] = {
142 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
145 /* Bit-pattern for negative zero */
146 static TRIO_CONST unsigned char ieee_754_negzero_array[] = {
147 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
150 /* Bit-pattern for infinity */
151 static TRIO_CONST unsigned char ieee_754_infinity_array[] = {
152 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
155 /* Bit-pattern for quiet NaN */
156 static TRIO_CONST unsigned char ieee_754_qnan_array[] = {
157 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
161 /*************************************************************************
171 TRIO_CONST unsigned char *values)
173 TRIO_VOLATILE double result;
176 for (i = 0; i < (int)sizeof(double); i++) {
177 ((TRIO_VOLATILE unsigned char *)&result)[TRIO_DOUBLE_INDEX(i)] = values[i];
183 * trio_is_special_quantity
186 trio_is_special_quantity
187 TRIO_ARGS2((number, has_mantissa),
192 unsigned char current;
193 int is_special_quantity = TRIO_TRUE;
197 for (i = 0; i < (unsigned int)sizeof(double); i++) {
198 current = ((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)];
200 &= ((current & ieee_754_exponent_mask[i]) == ieee_754_exponent_mask[i]);
201 *has_mantissa |= (current & ieee_754_mantissa_mask[i]);
203 return is_special_quantity;
215 int is_negative = TRIO_FALSE;
217 for (i = 0; i < (unsigned int)sizeof(double); i++) {
218 is_negative |= (((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)]
219 & ieee_754_sign_mask[i]);
224 #endif /* USE_IEEE_754 */
228 Generate negative zero.
230 @return Floating-point representation of negative zero.
233 trio_nzero(TRIO_NOARGS)
235 #if defined(USE_IEEE_754)
236 return trio_make_double(ieee_754_negzero_array);
238 TRIO_VOLATILE double zero = 0.0;
245 Generate positive infinity.
247 @return Floating-point representation of positive infinity.
250 trio_pinf(TRIO_NOARGS)
252 /* Cache the result */
253 static double result = 0.0;
257 #if defined(INFINITY) && defined(__STDC_IEC_559__)
258 result = (double)INFINITY;
260 #elif defined(USE_IEEE_754)
261 result = trio_make_double(ieee_754_infinity_array);
265 * If HUGE_VAL is different from DBL_MAX, then HUGE_VAL is used
266 * as infinity. Otherwise we have to resort to an overflow
267 * operation to generate infinity.
269 # if defined(TRIO_PLATFORM_UNIX)
270 void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
274 if (HUGE_VAL == DBL_MAX) {
279 # if defined(TRIO_PLATFORM_UNIX)
280 signal(SIGFPE, signal_handler);
289 Generate negative infinity.
291 @return Floating-point value of negative infinity.
294 trio_ninf(TRIO_NOARGS)
296 static double result = 0.0;
300 * Negative infinity is calculated by negating positive infinity,
301 * which can be done because it is legal to do calculations on
302 * infinity (for example, 1 / infinity == 0).
304 result = -trio_pinf();
312 @return Floating-point representation of NaN.
315 trio_nan(TRIO_NOARGS)
317 /* Cache the result */
318 static double result = 0.0;
322 #if defined(TRIO_COMPILER_SUPPORTS_C99)
325 #elif defined(NAN) && defined(__STDC_IEC_559__)
326 result = (double)NAN;
328 #elif defined(USE_IEEE_754)
329 result = trio_make_double(ieee_754_qnan_array);
333 * There are several ways to generate NaN. The one used here is
334 * to divide infinity by infinity. I would have preferred to add
335 * negative infinity to positive infinity, but that yields wrong
336 * result (infinity) on FreeBSD.
338 * This may fail if the hardware does not support NaN, or if
339 * the Invalid Operation floating-point exception is unmasked.
341 # if defined(TRIO_PLATFORM_UNIX)
342 void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
345 result = trio_pinf() / trio_pinf();
347 # if defined(TRIO_PLATFORM_UNIX)
348 signal(SIGFPE, signal_handler);
359 @param number An arbitrary floating-point number.
360 @return Boolean value indicating whether or not the number is a NaN.
367 #if (defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isnan)) \
368 || defined(TRIO_COMPILER_SUPPORTS_UNIX95)
370 * C99 defines isnan() as a macro. UNIX95 defines isnan() as a
371 * function. This function was already present in XPG4, but this
372 * is a bit tricky to detect with compiler defines, so we choose
373 * the conservative approach and only use it for UNIX95.
375 return isnan(number);
377 #elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
379 * Microsoft Visual C++ and Borland C++ Builder have an _isnan()
382 return _isnan(number) ? TRIO_TRUE : TRIO_FALSE;
384 #elif defined(USE_IEEE_754)
386 * Examine IEEE 754 bit-pattern. A NaN must have a special exponent
387 * pattern, and a non-empty mantissa.
390 int is_special_quantity;
392 is_special_quantity = trio_is_special_quantity(number, &has_mantissa);
394 return (is_special_quantity && has_mantissa);
401 double integral, fraction;
403 # if defined(TRIO_PLATFORM_UNIX)
404 void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
408 * NaN is the only number which does not compare to itself
410 ((TRIO_VOLATILE double)number != (TRIO_VOLATILE double)number) ||
412 * Fallback solution if NaN compares to NaN
415 (fraction = modf(number, &integral),
416 integral == fraction)));
418 # if defined(TRIO_PLATFORM_UNIX)
419 signal(SIGFPE, signal_handler);
430 @param number An arbitrary floating-point number.
431 @return 1 if positive infinity, -1 if negative infinity, 0 otherwise.
438 #if defined(TRIO_COMPILER_DECC)
440 * DECC has an isinf() macro, but it works differently than that
441 * of C99, so we use the fp_class() function instead.
443 return ((fp_class(number) == FP_POS_INF)
445 : ((fp_class(number) == FP_NEG_INF) ? -1 : 0));
449 * C99 defines isinf() as a macro.
452 ? ((number > 0.0) ? 1 : -1)
455 #elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
457 * Microsoft Visual C++ and Borland C++ Builder have an _fpclass()
458 * function that can be used to detect infinity.
460 return ((_fpclass(number) == _FPCLASS_PINF)
462 : ((_fpclass(number) == _FPCLASS_NINF) ? -1 : 0));
464 #elif defined(USE_IEEE_754)
466 * Examine IEEE 754 bit-pattern. Infinity must have a special exponent
467 * pattern, and an empty mantissa.
470 int is_special_quantity;
472 is_special_quantity = trio_is_special_quantity(number, &has_mantissa);
474 return (is_special_quantity && !has_mantissa)
475 ? ((number < 0.0) ? -1 : 1)
484 # if defined(TRIO_PLATFORM_UNIX)
485 void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
488 double infinity = trio_pinf();
490 status = ((number == infinity)
492 : ((number == -infinity) ? -1 : 0));
494 # if defined(TRIO_PLATFORM_UNIX)
495 signal(SIGFPE, signal_handler);
507 @param number An arbitrary floating-point number.
508 @return Boolean value indicating whether or not the number is a finite.
515 #if defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isfinite)
517 * C99 defines isfinite() as a macro.
519 return isfinite(number);
521 #elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
523 * Microsoft Visual C++ and Borland C++ Builder use _finite().
525 return _finite(number);
527 #elif defined(USE_IEEE_754)
529 * Examine IEEE 754 bit-pattern. For finity we do not care about the
534 return (! trio_is_special_quantity(number, &dummy));
540 return ((trio_isinf(number) == 0) && (trio_isnan(number) == 0));
547 * The sign of NaN is always false
550 trio_fpclassify_and_signbit
551 TRIO_ARGS2((number, is_negative),
555 #if defined(fpclassify) && defined(signbit)
557 * C99 defines fpclassify() and signbit() as a macros
559 *is_negative = signbit(number);
560 switch (fpclassify(number)) {
564 return TRIO_FP_INFINITE;
566 return TRIO_FP_SUBNORMAL;
570 return TRIO_FP_NORMAL;
574 # if defined(TRIO_COMPILER_DECC)
576 * DECC has an fp_class() function.
578 # define TRIO_FPCLASSIFY(n) fp_class(n)
579 # define TRIO_QUIET_NAN FP_QNAN
580 # define TRIO_SIGNALLING_NAN FP_SNAN
581 # define TRIO_POSITIVE_INFINITY FP_POS_INF
582 # define TRIO_NEGATIVE_INFINITY FP_NEG_INF
583 # define TRIO_POSITIVE_SUBNORMAL FP_POS_DENORM
584 # define TRIO_NEGATIVE_SUBNORMAL FP_NEG_DENORM
585 # define TRIO_POSITIVE_ZERO FP_POS_ZERO
586 # define TRIO_NEGATIVE_ZERO FP_NEG_ZERO
587 # define TRIO_POSITIVE_NORMAL FP_POS_NORM
588 # define TRIO_NEGATIVE_NORMAL FP_NEG_NORM
590 # elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
592 * Microsoft Visual C++ and Borland C++ Builder have an _fpclass()
595 # define TRIO_FPCLASSIFY(n) _fpclass(n)
596 # define TRIO_QUIET_NAN _FPCLASS_QNAN
597 # define TRIO_SIGNALLING_NAN _FPCLASS_SNAN
598 # define TRIO_POSITIVE_INFINITY _FPCLASS_PINF
599 # define TRIO_NEGATIVE_INFINITY _FPCLASS_NINF
600 # define TRIO_POSITIVE_SUBNORMAL _FPCLASS_PD
601 # define TRIO_NEGATIVE_SUBNORMAL _FPCLASS_ND
602 # define TRIO_POSITIVE_ZERO _FPCLASS_PZ
603 # define TRIO_NEGATIVE_ZERO _FPCLASS_NZ
604 # define TRIO_POSITIVE_NORMAL _FPCLASS_PN
605 # define TRIO_NEGATIVE_NORMAL _FPCLASS_NN
607 # elif defined(FP_PLUS_NORM)
609 * HP-UX 9.x and 10.x have an fpclassify() function, that is different
610 * from the C99 fpclassify() macro supported on HP-UX 11.x.
612 * AIX has class() for C, and _class() for C++, which returns the
613 * same values as the HP-UX fpclassify() function.
615 # if defined(TRIO_PLATFORM_AIX)
616 # if defined(__cplusplus)
617 # define TRIO_FPCLASSIFY(n) _class(n)
619 # define TRIO_FPCLASSIFY(n) class(n)
622 # define TRIO_FPCLASSIFY(n) fpclassify(n)
624 # define TRIO_QUIET_NAN FP_QNAN
625 # define TRIO_SIGNALLING_NAN FP_SNAN
626 # define TRIO_POSITIVE_INFINITY FP_PLUS_INF
627 # define TRIO_NEGATIVE_INFINITY FP_MINUS_INF
628 # define TRIO_POSITIVE_SUBNORMAL FP_PLUS_DENORM
629 # define TRIO_NEGATIVE_SUBNORMAL FP_MINUS_DENORM
630 # define TRIO_POSITIVE_ZERO FP_PLUS_ZERO
631 # define TRIO_NEGATIVE_ZERO FP_MINUS_ZERO
632 # define TRIO_POSITIVE_NORMAL FP_PLUS_NORM
633 # define TRIO_NEGATIVE_NORMAL FP_MINUS_NORM
636 # if defined(TRIO_FPCLASSIFY)
637 switch (TRIO_FPCLASSIFY(number)) {
639 case TRIO_SIGNALLING_NAN:
640 *is_negative = TRIO_FALSE; /* NaN has no sign */
642 case TRIO_POSITIVE_INFINITY:
643 *is_negative = TRIO_FALSE;
644 return TRIO_FP_INFINITE;
645 case TRIO_NEGATIVE_INFINITY:
646 *is_negative = TRIO_TRUE;
647 return TRIO_FP_INFINITE;
648 case TRIO_POSITIVE_SUBNORMAL:
649 *is_negative = TRIO_FALSE;
650 return TRIO_FP_SUBNORMAL;
651 case TRIO_NEGATIVE_SUBNORMAL:
652 *is_negative = TRIO_TRUE;
653 return TRIO_FP_SUBNORMAL;
654 case TRIO_POSITIVE_ZERO:
655 *is_negative = TRIO_FALSE;
657 case TRIO_NEGATIVE_ZERO:
658 *is_negative = TRIO_TRUE;
660 case TRIO_POSITIVE_NORMAL:
661 *is_negative = TRIO_FALSE;
662 return TRIO_FP_NORMAL;
663 case TRIO_NEGATIVE_NORMAL:
664 *is_negative = TRIO_TRUE;
665 return TRIO_FP_NORMAL;
667 /* Just in case... */
668 *is_negative = (number < 0.0);
669 return TRIO_FP_NORMAL;
680 * In IEEE 754 the sign of zero is ignored in comparisons, so we
681 * have to handle this as a special case by examining the sign bit
684 # if defined(USE_IEEE_754)
685 *is_negative = trio_is_negative(number);
687 *is_negative = TRIO_FALSE; /* FIXME */
691 if (trio_isnan(number)) {
692 *is_negative = TRIO_FALSE;
695 if ((rc = trio_isinf(number))) {
696 *is_negative = (rc == -1);
697 return TRIO_FP_INFINITE;
699 if ((number > 0.0) && (number < DBL_MIN)) {
700 *is_negative = TRIO_FALSE;
701 return TRIO_FP_SUBNORMAL;
703 if ((number < 0.0) && (number > -DBL_MIN)) {
704 *is_negative = TRIO_TRUE;
705 return TRIO_FP_SUBNORMAL;
707 *is_negative = (number < 0.0);
708 return TRIO_FP_NORMAL;
715 Examine the sign of a number.
717 @param number An arbitrary floating-point number.
718 @return Boolean value indicating whether or not the number has the
719 sign bit set (i.e. is negative).
728 (void)trio_fpclassify_and_signbit(number, &is_negative);
733 Examine the class of a number.
735 @param number An arbitrary floating-point number.
736 @return Enumerable value indicating the class of @p number
745 return trio_fpclassify_and_signbit(number, &dummy);
749 /** @} SpecialQuantities */
751 /*************************************************************************
754 * Add the following compiler option to include this test code.
756 * Unix : -DSTANDALONE
757 * VMS : /DEFINE=(STANDALONE)
759 #if defined(STANDALONE)
762 static TRIO_CONST char *
768 case TRIO_FP_INFINITE:
769 return "FP_INFINITE";
774 case TRIO_FP_SUBNORMAL:
775 return "FP_SUBNORMAL";
785 TRIO_ARGS2((prefix, number),
786 TRIO_CONST char *prefix,
789 printf("%-6s: %s %-15s %g\n",
791 trio_signbit(number) ? "-" : "+",
792 getClassification(trio_fpclassify(number)),
796 int main(TRIO_NOARGS)
801 # if defined(TRIO_PLATFORM_UNIX)
802 void (*signal_handler) TRIO_PROTO((int));
806 my_pinf = trio_pinf();
807 my_ninf = trio_ninf();
809 print_class("Nan", my_nan);
810 print_class("PInf", my_pinf);
811 print_class("NInf", my_ninf);
812 print_class("PZero", 0.0);
813 print_class("NZero", -0.0);
814 print_class("PNorm", 1.0);
815 print_class("NNorm", -1.0);
816 print_class("PSub", 1.01e-307 - 1.00e-307);
817 print_class("NSub", 1.00e-307 - 1.01e-307);
819 printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
821 ((unsigned char *)&my_nan)[0],
822 ((unsigned char *)&my_nan)[1],
823 ((unsigned char *)&my_nan)[2],
824 ((unsigned char *)&my_nan)[3],
825 ((unsigned char *)&my_nan)[4],
826 ((unsigned char *)&my_nan)[5],
827 ((unsigned char *)&my_nan)[6],
828 ((unsigned char *)&my_nan)[7],
829 trio_isnan(my_nan), trio_isinf(my_nan));
830 printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
832 ((unsigned char *)&my_pinf)[0],
833 ((unsigned char *)&my_pinf)[1],
834 ((unsigned char *)&my_pinf)[2],
835 ((unsigned char *)&my_pinf)[3],
836 ((unsigned char *)&my_pinf)[4],
837 ((unsigned char *)&my_pinf)[5],
838 ((unsigned char *)&my_pinf)[6],
839 ((unsigned char *)&my_pinf)[7],
840 trio_isnan(my_pinf), trio_isinf(my_pinf));
841 printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
843 ((unsigned char *)&my_ninf)[0],
844 ((unsigned char *)&my_ninf)[1],
845 ((unsigned char *)&my_ninf)[2],
846 ((unsigned char *)&my_ninf)[3],
847 ((unsigned char *)&my_ninf)[4],
848 ((unsigned char *)&my_ninf)[5],
849 ((unsigned char *)&my_ninf)[6],
850 ((unsigned char *)&my_ninf)[7],
851 trio_isnan(my_ninf), trio_isinf(my_ninf));
853 # if defined(TRIO_PLATFORM_UNIX)
854 signal_handler = signal(SIGFPE, SIG_IGN);
857 my_pinf = DBL_MAX + DBL_MAX;
859 my_nan = my_pinf / my_pinf;
861 # if defined(TRIO_PLATFORM_UNIX)
862 signal(SIGFPE, signal_handler);
865 printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
867 ((unsigned char *)&my_nan)[0],
868 ((unsigned char *)&my_nan)[1],
869 ((unsigned char *)&my_nan)[2],
870 ((unsigned char *)&my_nan)[3],
871 ((unsigned char *)&my_nan)[4],
872 ((unsigned char *)&my_nan)[5],
873 ((unsigned char *)&my_nan)[6],
874 ((unsigned char *)&my_nan)[7],
875 trio_isnan(my_nan), trio_isinf(my_nan));
876 printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
878 ((unsigned char *)&my_pinf)[0],
879 ((unsigned char *)&my_pinf)[1],
880 ((unsigned char *)&my_pinf)[2],
881 ((unsigned char *)&my_pinf)[3],
882 ((unsigned char *)&my_pinf)[4],
883 ((unsigned char *)&my_pinf)[5],
884 ((unsigned char *)&my_pinf)[6],
885 ((unsigned char *)&my_pinf)[7],
886 trio_isnan(my_pinf), trio_isinf(my_pinf));
887 printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
889 ((unsigned char *)&my_ninf)[0],
890 ((unsigned char *)&my_ninf)[1],
891 ((unsigned char *)&my_ninf)[2],
892 ((unsigned char *)&my_ninf)[3],
893 ((unsigned char *)&my_ninf)[4],
894 ((unsigned char *)&my_ninf)[5],
895 ((unsigned char *)&my_ninf)[6],
896 ((unsigned char *)&my_ninf)[7],
897 trio_isnan(my_ninf), trio_isinf(my_ninf));