50#if defined(TRIO_PLATFORM_UNIX)
53#if defined(TRIO_COMPILER_DECC)
54# if defined(__linux__)
62#if defined(TRIO_DOCUMENTATION)
63# include "doc/doc_nan.h"
73#define TRIO_TRUE (1 == 1)
74#define TRIO_FALSE (0 == 1)
79#if defined(__alpha) && !defined(_IEEE_FP)
80# if defined(TRIO_COMPILER_DECC)
81# if defined(TRIO_PLATFORM_VMS)
82# error "Must be compiled with option /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE"
85# error "Must be compiled with option -ieee"
88# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__))
89# error "Must be compiled with option -mieee"
106#if (FLT_RADIX == 2) && (DBL_MAX_EXP == 1024) && (DBL_MANT_DIG == 53)
117#if defined(USE_IEEE_754)
130#define TRIO_DOUBLE_INDEX(x) (((unsigned char *)&internalEndianMagic)[7-(x)])
132#if (defined(__BORLANDC__) && __BORLANDC__ >= 0x0590)
133static TRIO_CONST double internalEndianMagic = 7.949928895127362e-275;
135static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275;
139static TRIO_CONST unsigned char ieee_754_exponent_mask[] = {
140 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
144static TRIO_CONST unsigned char ieee_754_mantissa_mask[] = {
145 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
149static TRIO_CONST unsigned char ieee_754_sign_mask[] = {
150 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
154static TRIO_CONST unsigned char ieee_754_negzero_array[] = {
155 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
159static TRIO_CONST unsigned char ieee_754_infinity_array[] = {
160 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
164static TRIO_CONST unsigned char ieee_754_qnan_array[] = {
165 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
184 for (
i = 0;
i < (
int)
sizeof(
double);
i++) {
194trio_is_special_quantity
205 for (
i = 0;
i < (
unsigned int)
sizeof(
double);
i++) {
208 &= ((
current & ieee_754_exponent_mask[
i]) == ieee_754_exponent_mask[
i]);
209 *has_mantissa |= (
current & ieee_754_mantissa_mask[
i]);
211 return is_special_quantity;
225 for (
i = 0;
i < (
unsigned int)
sizeof(
double);
i++) {
226 is_negative |= (((
unsigned char *)&
number)[TRIO_DOUBLE_INDEX(
i)]
227 & ieee_754_sign_mask[
i]);
243#if defined(USE_IEEE_754)
244 return trio_make_double(ieee_754_negzero_array);
261 static double result = 0.0;
265#if defined(INFINITY) && defined(__STDC_IEC_559__)
268#elif defined(USE_IEEE_754)
269 result = trio_make_double(ieee_754_infinity_array);
277# if defined(TRIO_PLATFORM_UNIX)
287# if defined(TRIO_PLATFORM_UNIX)
304 static double result = 0.0;
326 static double result = 0.0;
330#if defined(TRIO_COMPILER_SUPPORTS_C99) && (!defined(__REACTOS__) || !defined(__clang__))
333#elif defined(NAN) && defined(__STDC_IEC_559__)
336#elif defined(USE_IEEE_754)
337 result = trio_make_double(ieee_754_qnan_array);
349# if defined(TRIO_PLATFORM_UNIX)
355# if defined(TRIO_PLATFORM_UNIX)
375#if (defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isnan)) \
376 || defined(TRIO_COMPILER_SUPPORTS_UNIX95)
385#elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
392#elif defined(USE_IEEE_754)
398 int is_special_quantity;
400 is_special_quantity = trio_is_special_quantity(
number, &has_mantissa);
402 return (is_special_quantity && has_mantissa);
409 double integral, fraction;
411# if defined(TRIO_PLATFORM_UNIX)
424 integral == fraction)));
426# if defined(TRIO_PLATFORM_UNIX)
446#if defined(TRIO_COMPILER_DECC) && !defined(__linux__)
451 return ((fp_class(
number) == FP_POS_INF)
453 : ((fp_class(
number) == FP_NEG_INF) ? -1 : 0));
460 ? ((
number > 0.0) ? 1 : -1)
463#elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
472#elif defined(USE_IEEE_754)
478 int is_special_quantity;
480 is_special_quantity = trio_is_special_quantity(
number, &has_mantissa);
482 return (is_special_quantity && !has_mantissa)
483 ? ((
number < 0.0) ? -1 : 1)
492# if defined(TRIO_PLATFORM_UNIX)
500 : ((
number == -infinity) ? -1 : 0));
502# if defined(TRIO_PLATFORM_UNIX)
524#if defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isfinite)
530#elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
536#elif defined(USE_IEEE_754)
543 return (! trio_is_special_quantity(
number, &
dummy));
549 return ((trio_isinf(
number) == 0) && (trio_isnan(
number) == 0));
560trio_fpclassify_and_signbit
565#if defined(fpclassify) && defined(signbit)
584# if defined(TRIO_COMPILER_DECC)
588# define TRIO_FPCLASSIFY(n) fp_class(n)
589# define TRIO_QUIET_NAN FP_QNAN
590# define TRIO_SIGNALLING_NAN FP_SNAN
591# define TRIO_POSITIVE_INFINITY FP_POS_INF
592# define TRIO_NEGATIVE_INFINITY FP_NEG_INF
593# define TRIO_POSITIVE_SUBNORMAL FP_POS_DENORM
594# define TRIO_NEGATIVE_SUBNORMAL FP_NEG_DENORM
595# define TRIO_POSITIVE_ZERO FP_POS_ZERO
596# define TRIO_NEGATIVE_ZERO FP_NEG_ZERO
597# define TRIO_POSITIVE_NORMAL FP_POS_NORM
598# define TRIO_NEGATIVE_NORMAL FP_NEG_NORM
600# elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
605# define TRIO_FPCLASSIFY(n) _fpclass(n)
606# define TRIO_QUIET_NAN _FPCLASS_QNAN
607# define TRIO_SIGNALLING_NAN _FPCLASS_SNAN
608# define TRIO_POSITIVE_INFINITY _FPCLASS_PINF
609# define TRIO_NEGATIVE_INFINITY _FPCLASS_NINF
610# define TRIO_POSITIVE_SUBNORMAL _FPCLASS_PD
611# define TRIO_NEGATIVE_SUBNORMAL _FPCLASS_ND
612# define TRIO_POSITIVE_ZERO _FPCLASS_PZ
613# define TRIO_NEGATIVE_ZERO _FPCLASS_NZ
614# define TRIO_POSITIVE_NORMAL _FPCLASS_PN
615# define TRIO_NEGATIVE_NORMAL _FPCLASS_NN
617# elif defined(FP_PLUS_NORM)
625# if defined(TRIO_PLATFORM_AIX)
626# if defined(__cplusplus)
627# define TRIO_FPCLASSIFY(n) _class(n)
629# define TRIO_FPCLASSIFY(n) class(n)
632# define TRIO_FPCLASSIFY(n) fpclassify(n)
634# define TRIO_QUIET_NAN FP_QNAN
635# define TRIO_SIGNALLING_NAN FP_SNAN
636# define TRIO_POSITIVE_INFINITY FP_PLUS_INF
637# define TRIO_NEGATIVE_INFINITY FP_MINUS_INF
638# define TRIO_POSITIVE_SUBNORMAL FP_PLUS_DENORM
639# define TRIO_NEGATIVE_SUBNORMAL FP_MINUS_DENORM
640# define TRIO_POSITIVE_ZERO FP_PLUS_ZERO
641# define TRIO_NEGATIVE_ZERO FP_MINUS_ZERO
642# define TRIO_POSITIVE_NORMAL FP_PLUS_NORM
643# define TRIO_NEGATIVE_NORMAL FP_MINUS_NORM
646# if defined(TRIO_FPCLASSIFY)
647 switch (TRIO_FPCLASSIFY(
number)) {
649 case TRIO_SIGNALLING_NAN:
652 case TRIO_POSITIVE_INFINITY:
655 case TRIO_NEGATIVE_INFINITY:
658 case TRIO_POSITIVE_SUBNORMAL:
661 case TRIO_NEGATIVE_SUBNORMAL:
664 case TRIO_POSITIVE_ZERO:
667 case TRIO_NEGATIVE_ZERO:
670 case TRIO_POSITIVE_NORMAL:
673 case TRIO_NEGATIVE_NORMAL:
678 *is_negative = (
number < 0.0);
694# if defined(USE_IEEE_754)
695 *is_negative = trio_is_negative(
number);
705 if ((rc = trio_isinf(
number))) {
706 *is_negative = (rc == -1);
717 *is_negative = (
number < 0.0);
738 (
void)trio_fpclassify_and_signbit(
number, &is_negative);
757 return trio_fpclassify_and_signbit(
number, &
dummy);
772#if defined(STANDALONE)
782 return "FP_INFINITE";
788 return "FP_SUBNORMAL";
802 printf(
"%-6s: %s %-15s %g\n",
804 trio_signbit(
number) ?
"-" :
"+",
805 getClassification(TRIO_FPCLASSIFY(
number)),
814# if defined(TRIO_PLATFORM_UNIX)
822 print_class(
"Nan", my_nan);
823 print_class(
"PInf", my_pinf);
824 print_class(
"NInf", my_ninf);
825 print_class(
"PZero", 0.0);
826 print_class(
"NZero", -0.0);
827 print_class(
"PNorm", 1.0);
828 print_class(
"NNorm", -1.0);
829 print_class(
"PSub", 1.01e-307 - 1.00e-307);
830 print_class(
"NSub", 1.00e-307 - 1.01e-307);
832 printf(
"NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
834 ((
unsigned char *)&my_nan)[0],
835 ((
unsigned char *)&my_nan)[1],
836 ((
unsigned char *)&my_nan)[2],
837 ((
unsigned char *)&my_nan)[3],
838 ((
unsigned char *)&my_nan)[4],
839 ((
unsigned char *)&my_nan)[5],
840 ((
unsigned char *)&my_nan)[6],
841 ((
unsigned char *)&my_nan)[7],
842 trio_isnan(my_nan), trio_isinf(my_nan));
843 printf(
"PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
845 ((
unsigned char *)&my_pinf)[0],
846 ((
unsigned char *)&my_pinf)[1],
847 ((
unsigned char *)&my_pinf)[2],
848 ((
unsigned char *)&my_pinf)[3],
849 ((
unsigned char *)&my_pinf)[4],
850 ((
unsigned char *)&my_pinf)[5],
851 ((
unsigned char *)&my_pinf)[6],
852 ((
unsigned char *)&my_pinf)[7],
853 trio_isnan(my_pinf), trio_isinf(my_pinf));
854 printf(
"NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
856 ((
unsigned char *)&my_ninf)[0],
857 ((
unsigned char *)&my_ninf)[1],
858 ((
unsigned char *)&my_ninf)[2],
859 ((
unsigned char *)&my_ninf)[3],
860 ((
unsigned char *)&my_ninf)[4],
861 ((
unsigned char *)&my_ninf)[5],
862 ((
unsigned char *)&my_ninf)[6],
863 ((
unsigned char *)&my_ninf)[7],
864 trio_isnan(my_ninf), trio_isinf(my_ninf));
866# if defined(TRIO_PLATFORM_UNIX)
872 my_nan = my_pinf / my_pinf;
874# if defined(TRIO_PLATFORM_UNIX)
878 printf(
"NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
880 ((
unsigned char *)&my_nan)[0],
881 ((
unsigned char *)&my_nan)[1],
882 ((
unsigned char *)&my_nan)[2],
883 ((
unsigned char *)&my_nan)[3],
884 ((
unsigned char *)&my_nan)[4],
885 ((
unsigned char *)&my_nan)[5],
886 ((
unsigned char *)&my_nan)[6],
887 ((
unsigned char *)&my_nan)[7],
888 trio_isnan(my_nan), trio_isinf(my_nan));
889 printf(
"PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
891 ((
unsigned char *)&my_pinf)[0],
892 ((
unsigned char *)&my_pinf)[1],
893 ((
unsigned char *)&my_pinf)[2],
894 ((
unsigned char *)&my_pinf)[3],
895 ((
unsigned char *)&my_pinf)[4],
896 ((
unsigned char *)&my_pinf)[5],
897 ((
unsigned char *)&my_pinf)[6],
898 ((
unsigned char *)&my_pinf)[7],
899 trio_isnan(my_pinf), trio_isinf(my_pinf));
900 printf(
"NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
902 ((
unsigned char *)&my_ninf)[0],
903 ((
unsigned char *)&my_ninf)[1],
904 ((
unsigned char *)&my_ninf)[2],
905 ((
unsigned char *)&my_ninf)[3],
906 ((
unsigned char *)&my_ninf)[4],
907 ((
unsigned char *)&my_ninf)[5],
908 ((
unsigned char *)&my_ninf)[6],
909 ((
unsigned char *)&my_ninf)[7],
910 trio_isnan(my_ninf), trio_isinf(my_ninf));
#define TRIO_ARGS2(list, a1, a2)
#define TRIO_ARGS1(list, a1)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLuint GLsizei GLenum type
GLboolean GLenum GLenum GLvoid * values
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
TRIO_PUBLIC double trio_nzero(TRIO_NOARGS)
static TRIO_CONST char rcsid[]
TRIO_PUBLIC double trio_pinf(TRIO_NOARGS)
TRIO_PUBLIC double trio_ninf(TRIO_NOARGS)
TRIO_PUBLIC double trio_nan(TRIO_NOARGS)
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _fpclass(_In_ double)
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)
double __cdecl nan(const char *tagp)
struct task_struct * current
static unsigned int number
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double