00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SOI_NaN_INCL
00021
00022
00023
00024
00025
00026 #ifndef SOI_VERSION_INCL
00027 #include <soi_version.h>
00028 #endif
00029
00030 #ifndef SOI_machine_INCL
00031 #include "soi_machine.h"
00032 #endif
00033
00034
00035
00036
00037
00038 #define SOI_NaN_VERSION_NUM (0.8)
00039 #define SOI_NaN_INCL 1
00040
00041
00042
00043
00044
00045 #if defined IEEE_EL
00046 typedef union {
00047 double d;
00048 struct {
00049 unsigned int frac2:32;
00050 unsigned int frac1:16;
00051 unsigned int frac : 3;
00052 unsigned int quiet: 1;
00053 unsigned int exp :11;
00054 unsigned int sign : 1;
00055 } NaN_mask;
00056 struct {
00057 unsigned int frac1:32;
00058 unsigned int frac :20;
00059 unsigned int exp :11;
00060 unsigned int sign : 1;
00061 } fp_mask;
00062 } dNaN;
00063 typedef union {
00064 float f;
00065 struct {
00066 unsigned int frac1:16;
00067 unsigned int frac : 6;
00068 unsigned int quiet: 1;
00069 unsigned int exp : 8;
00070 unsigned int sign : 1;
00071 } NaN_mask;
00072 struct {
00073 unsigned int frac :23;
00074 unsigned int exp : 8;
00075 unsigned int sign : 1;
00076 } fp_mask;
00077 } fNaN;
00078
00079 #elif defined IEEE_EB
00080 typedef union {
00081 double d;
00082 struct {
00083 unsigned int sign : 1;
00084 unsigned int exp :11;
00085 unsigned int quiet: 1;
00086 unsigned int frac : 3;
00087 unsigned int frac1:16;
00088 unsigned int frac2:32;
00089 } NaN_mask;
00090 struct {
00091 unsigned int sign : 1;
00092 unsigned int exp :11;
00093 unsigned int frac :20;
00094 unsigned int frac1:32;
00095 } fp_mask;
00096 } dNaN;
00097 typedef union {
00098 float f;
00099 struct {
00100 unsigned int sign : 1;
00101 unsigned int exp : 8;
00102 unsigned int quiet: 1;
00103 unsigned int frac : 6;
00104 unsigned int frac1:16;
00105 } NaN_mask;
00106 struct {
00107 unsigned int sign : 1;
00108 unsigned int exp : 8;
00109 unsigned int frac :23;
00110 } fp_mask;
00111 } fNaN;
00112
00113 #elif defined vax
00114 typedef union {
00115 double d;
00116 struct {
00117 unsigned int frac : 6;
00118 unsigned int quiet: 1;
00119 unsigned int exp : 8;
00120 unsigned int sign : 1;
00121 unsigned int frac1:16;
00122 unsigned int frac2:32;
00123 } NaN_mask;
00124 struct {
00125 unsigned int frac : 7;
00126 unsigned int exp : 8;
00127 unsigned int sign : 1;
00128 unsigned int frac1:16;
00129 unsigned int frac2:32;
00130 } fp_mask;
00131 } dNaN;
00132 typedef union {
00133 float f;
00134 struct {
00135 unsigned int frac : 6;
00136 unsigned int quiet: 1;
00137 unsigned int exp : 8;
00138 unsigned int sign : 1;
00139 unsigned int frac1:16;
00140 } NaN_mask;
00141 struct {
00142 unsigned int frac : 7;
00143 unsigned int exp : 8;
00144 unsigned int sign : 1;
00145 unsigned int frac1:16;
00146 } fp_mask;
00147 } fNaN;
00148 #endif
00149
00150
00151
00152
00153
00154 #if defined IEEE
00155 # define IsdNaN(X) ((((dNaN *)&(X))->fp_mask.exp == 0x7ff) && \
00156 ((((dNaN *)&(X))->fp_mask.frac != 0x0) || \
00157 (((dNaN *)&(X))->fp_mask.frac1 != 0x0)))
00158 # define IsdqNaN(X) ((((dNaN *)&(X))->fp_mask.exp == 0x7ff) && \
00159 (((dNaN *)&(X))->NaN_mask.quiet != 0x0))
00160 # define IsdsNaN(X) ((((dNaN *)&(X))->fp_mask.exp == 0x7ff) && \
00161 (((dNaN *)&(X))->NaN_mask.quiet == 0x0) && \
00162 ((((dNaN *)&(X))->fp_mask.frac != 0x0) || \
00163 (((dNaN *)&(X))->fp_mask.frac1 != 0x0)))
00164 # define IsfNaN(X) ((((fNaN *)&(X))->fp_mask.exp == 0xff) && \
00165 (((fNaN *)&(X))->fp_mask.frac != 0x0))
00166 # define IsfqNaN(X) ((((fNaN *)&(X))->fp_mask.exp == 0xff) && \
00167 (((fNaN *)&(X))->NaN_mask.quiet != 0x0))
00168 # define IsfsNaN(X) ((((fNaN *)&(X))->fp_mask.exp == 0xff) && \
00169 (((fNaN *)&(X))->NaN_mask.quiet == 0x0) && \
00170 (((fNaN *)&(X))->fp_mask.frac != 0x0))
00171 # define IsdNaNorINF(X) (((dNaN *)&(X))->fp_mask.exp == 0x7ff)
00172
00173 #elif defined vax
00174 # define IsdNaN(X) ((((dNaN *)&(X))->fp_mask.exp == 0xff) && \
00175 (((dNaN *)&(X))->NaN_mask.frac == 0x3f) && \
00176 (((dNaN *)&(X))->fp_mask.frac1 == 0x0) && \
00177 (((dNaN *)&(X))->fp_mask.frac2 == 0x0))
00178 # define IsdqNaN(X) ((((dNaN *)&(X))->fp_mask.exp == 0xff) && \
00179 (((dNaN *)&(X))->fp_mask.frac == 0x7f) && \
00180 (((dNaN *)&(X))->fp_mask.frac1 == 0x0))
00181 # define IsdsNaN(X) ((((dNaN *)&(X))->fp_mask.exp == 0xff) && \
00182 (((dNaN *)&(X))->fp_mask.frac == 0x3f) && \
00183 (((dNaN *)&(X))->fp_mask.frac1 == 0x0))
00184 # define IsfNaN(X) ((((fNaN *)&(X))->fp_mask.exp == 0xff) && \
00185 (((fNaN *)&(X))->NaN_mask.frac == 0x3f) && \
00186 (((fNaN *)&(X))->fp_mask.frac1 == 0x0))
00187 # define IsfqNaN(X) ((((fNaN *)&(X))->fp_mask.exp == 0xff) && \
00188 (((fNaN *)&(X))->fp_mask.frac == 0x7f) && \
00189 (((fNaN *)&(X))->fp_mask.frac1 == 0x0))
00190 # define IsfsNaN(X) ((((fNaN *)&(X))->fp_mask.exp == 0xff) && \
00191 (((fNaN *)&(X))->fp_mask.frac == 0x3f) && \
00192 (((fNaN *)&(X))->fp_mask.frac1 == 0x0))
00193 #endif
00194
00195
00196
00197
00198
00199
00200 extern double A_Signaling_dNaN (void);
00201
00202 extern double A_Quiet_dNaN (void);
00203
00204 extern double dInfinity (void);
00205
00206 extern float A_Signaling_fNaN (void);
00207
00208 extern float A_Quiet_fNaN (void);
00209
00210 extern float fInfinity (void);
00211
00212 #endif
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240