10 #define RN FE_TONEAREST
15 #define RZ FE_TOWARDZERO
20 #define RD FE_DOWNWARD
36 #define INEXACT FE_INEXACT
41 #define INVALID FE_INVALID
46 #define DIVBYZERO FE_DIVBYZERO
51 #define UNDERFLOW FE_UNDERFLOW
56 #define OVERFLOW FE_OVERFLOW
66 #define T(...) {__FILE__, __LINE__, __VA_ARGS__},
68 #define POS char *file; int line;
69 struct d_d {POS int r; double x; double y; float dy; int e; };
70 struct f_f {POS int r; float x; float y; float dy; int e; };
71 struct l_l {POS int r; long double x; long double y; float dy; int e; };
72 struct ff_f {POS int r; float x; float x2; float y; float dy; int e; };
73 struct dd_d {POS int r; double x; double x2; double y; float dy; int e; };
74 struct ll_l {POS int r; long double x; long double x2; long double y; float dy; int e; };
75 struct d_di {POS int r; double x; double y; float dy; long long i; int e; };
76 struct f_fi {POS int r; float x; float y; float dy; long long i; int e; };
77 struct l_li {POS int r; long double x; long double y; float dy; long long i; int e; };
78 struct di_d {POS int r; double x; long long i; double y; float dy; int e; };
79 struct fi_f {POS int r; float x; long long i; float y; float dy; int e; };
80 struct li_l {POS int r; long double x; long long i; long double y; float dy; int e; };
86 float ulperr(double got, double want, float dwant);
87 float ulperrf(float got, float want, float dwant);
88 float ulperrl(long double got, long double want, float dwant);
90 static int checkexcept(int got, int want, int r)
92 // TODO: we dont checkunderflow and inexact for now
94 return (got|INEXACT|UNDERFLOW) == (want|INEXACT|UNDERFLOW);
95 // return got == want || got == (want|INEXACT);
99 static int checkulp(float d, int r)
101 // TODO: we only care about >=1.5 ulp errors for now, should be 1.0
103 return fabsf(d) < 1.5;