24 /*******************************************************************************
26 ******************************************************************************/
29 (u)->ulp_max = -DBL_MAX; \
30 (u)->ulp_min = DBL_MAX; \
32 (u)->ulp_skipped = 0; \
33 (u)->ulp_maxl = -LDBL_MAX; \
34 (u)->ulp_minl = LDBL_MAX; \
35 (u)->ulp_avgl = 0.0; \
36 (u)->ulp_skippedl = 0;
38 #define ULP_UPDATE(u, n) \
41 if ((n) > (u)->ulp_max) \
43 if ((n) < (u)->ulp_min) \
48 #define ULP_UPDATEL(u, nl) \
51 if ((nl) > (u)->ulp_maxl) \
53 if ((nl) < (u)->ulp_minl) \
55 (u)->ulp_avgl += nl; \
59 /*******************************************************************************
61 ******************************************************************************/
62 #define ULP_COMPLEX_INIT(uc) \
63 ULP_INIT(&uc->ulp_real); \
64 ULP_INIT(&uc->ulp_imag); \
65 ULP_INIT(&uc->ulp_total);
67 #define ULP_COMPLEX_UPDATE(uc, n) \
69 ULP_UPDATE(&uc->ulp_real, creal(n)); \
70 ULP_UPDATE(&uc->ulp_imag, cimag(n)); \
71 ULP_UPDATE(&uc->ulp_total, fabs(creal(n)) + fabs(cimag(n)));
73 #define ULP_COMPLEX_UPDATEL(uc, n) \
75 ULP_UPDATEL(&uc->ulp_real, creall(n)); \
76 ULP_UPDATEL(&uc->ulp_imag, cimagl(n)); \
77 ULP_UPDATEL(&uc->ulp_total, fabsl(creall(n)) + fabsl(cimagl(n)));
79 double calculp_double(double computed, double exact);
80 long double calculp_long_double(long double computedl, long double exactl);
82 void getfunctionulp_real(const struct fentry *f, struct ulp *u);
83 void getfunctionulp_complex(const struct fentry *f, struct ulp_complex *u);
85 void printulps_double(struct ulp u);
86 void printulps_long_double(struct ulp u);
87 void printulps_double_complex(struct ulp_complex u);
88 void printulps_long_double_complex(struct ulp_complex u);
90 #define NITERATIONS (1 * 1000)
92 #endif /* ! __ULP_H__ */