Changeset ba8eecf in mainline
 Timestamp:
 20150905T12:03:54Z (9 years ago)
 Branches:
 lfn, master, serial, ticket/834toolchainupdate, topic/msimupgrade, topic/simplifydevexport
 Children:
 b69786e
 Parents:
 9adb61d
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

uspace/app/tester/float/float2.c
r9adb61d rba8eecf 127 127 128 128 for (unsigned int i = 0; i < OPERANDS; i++) { 129 double res = ceil(arguments[i]); 130 131 if (!cmp_double(res, results_ceil[i])) { 132 TPRINTF("Double precision ceil failed " 133 "(%lf != %lf, arg %u)\n", res, results_ceil[i], i); 134 fail = true; 135 } 136 } 137 138 for (unsigned int i = 0; i < OPERANDS; i++) { 139 float res = ceilf(arguments[i]); 140 141 if (!cmp_float(res, results_ceil[i])) { 142 TPRINTF("Single precision ceil failed " 143 "(%f != %lf, arg %u)\n", res, results_ceil[i], i); 144 fail = true; 145 } 146 } 147 148 for (unsigned int i = 0; i < OPERANDS; i++) { 149 double res = cos(arguments[i]); 150 151 if (!cmp_double(res, results_cos[i])) { 152 TPRINTF("Double precision cos failed " 153 "(%lf != %lf, arg %u)\n", res, results_cos[i], i); 154 fail = true; 155 } 156 } 157 158 for (unsigned int i = 0; i < OPERANDS; i++) { 159 float res = cosf(arguments[i]); 160 161 if (!cmp_float(res, results_cos[i])) { 162 TPRINTF("Single precision cos failed " 163 "(%f != %lf, arg %u)\n", res, results_cos[i], i); 164 fail = true; 165 } 166 } 167 168 for (unsigned int i = 0; i < OPERANDS; i++) { 169 double res = exp(arguments_exp[i]); 170 171 if (!cmp_double(res, results_exp[i])) { 172 TPRINTF("Double precision exp failed " 173 "(%lf != %lf, arg %u)\n", res, results_exp[i], i); 174 fail = true; 175 } 176 } 177 178 for (unsigned int i = 0; i < OPERANDS; i++) { 179 float res = expf(arguments_exp[i]); 180 181 if (!cmp_float(res, results_exp[i])) { 182 TPRINTF("Single precision exp failed " 183 "(%f != %lf, arg %u)\n", res, results_exp[i], i); 184 fail = true; 185 } 186 } 187 188 for (unsigned int i = 0; i < OPERANDS; i++) { 129 189 double res = floor(arguments[i]); 130 int64_t res_int = (int64_t) (res * PRECISION); 131 int64_t corr_int = (int64_t) (results_floor[i] * PRECISION); 132 133 if (res_int != corr_int) { 134 TPRINTF("Double precision floor failed (%" PRId64 135 " != %" PRId64 ", arg %u)\n", res_int, corr_int, i); 136 fail = true; 137 } 138 } 139 140 for (unsigned int i = 0; i < OPERANDS; i++) { 141 double res = ceil(arguments[i]); 142 int64_t res_int = (int64_t) (res * PRECISION); 143 int64_t corr_int = (int64_t) (results_ceil[i] * PRECISION); 144 145 if (res_int != corr_int) { 146 TPRINTF("Double precision ceil failed (%" PRId64 147 " != %" PRId64 ", arg %u)\n", res_int, corr_int, i); 190 191 if (!cmp_double(res, results_floor[i])) { 192 TPRINTF("Double precision floor failed " 193 "(%lf != %lf, arg %u)\n", res, results_floor[i], i); 194 fail = true; 195 } 196 } 197 198 for (unsigned int i = 0; i < OPERANDS; i++) { 199 float res = floorf(arguments[i]); 200 201 if (!cmp_float(res, results_floor[i])) { 202 TPRINTF("Single precision floor failed " 203 "(%f != %lf, arg %u)\n", res, results_floor[i], i); 204 fail = true; 205 } 206 } 207 208 for (unsigned int i = 0; i < OPERANDS; i++) { 209 double res = log(arguments_log[i]); 210 211 if (!cmp_double(res, results_log[i])) { 212 TPRINTF("Double precision log failed " 213 "(%lf != %lf, arg %u)\n", res, results_log[i], i); 214 fail = true; 215 } 216 } 217 218 for (unsigned int i = 0; i < OPERANDS; i++) { 219 float res = logf(arguments_log[i]); 220 221 if (!cmp_float(res, results_log[i])) { 222 TPRINTF("Single precision log failed " 223 "(%f != %lf, arg %u)\n", res, results_log[i], i); 224 fail = true; 225 } 226 } 227 228 for (unsigned int i = 0; i < OPERANDS; i++) { 229 double res = sin(arguments[i]); 230 231 if (!cmp_double(res, results_sin[i])) { 232 TPRINTF("Double precision sin failed " 233 "(%lf != %lf, arg %u)\n", res, results_sin[i], i); 234 fail = true; 235 } 236 } 237 238 for (unsigned int i = 0; i < OPERANDS; i++) { 239 float res = sinf(arguments[i]); 240 241 if (!cmp_float(res, results_sin[i])) { 242 TPRINTF("Single precision sin failed " 243 "(%f != %lf, arg %u)\n", res, results_sin[i], i); 148 244 fail = true; 149 245 } … … 152 248 for (unsigned int i = 0; i < OPERANDS; i++) { 153 249 double res = trunc(arguments[i]); 154 int64_t res_int = (int64_t) (res * PRECISION); 155 int64_t corr_int = (int64_t) (results_trunc[i] * PRECISION); 156 157 if (res_int != corr_int) { 158 TPRINTF("Double precisiontruncation failed (%" PRId64 159 " != %" PRId64 ", arg %u)\n", res_int, corr_int, i); 160 fail = true; 161 } 162 } 163 164 for (unsigned int i = 0; i < OPERANDS; i++) { 165 double res = sin(arguments[i]); 166 int64_t res_int = (int64_t) (res * PRECISION); 167 int64_t corr_int = (int64_t) (results_sin[i] * PRECISION); 168 169 if (res_int != corr_int) { 170 TPRINTF("Double precision sine failed (%" PRId64 171 " != %" PRId64 ", arg %u)\n", res_int, corr_int, i); 172 fail = true; 173 } 174 } 175 176 for (unsigned int i = 0; i < OPERANDS; i++) { 177 double res = cos(arguments[i]); 178 int64_t res_int = (int64_t) (res * PRECISION); 179 int64_t corr_int = (int64_t) (results_cos[i] * PRECISION); 180 181 if (res_int != corr_int) { 182 TPRINTF("Double precision cosine failed (%" PRId64 183 " != %" PRId64 ", arg %u)\n", res_int, corr_int, i); 184 fail = true; 185 } 186 } 187 188 for (unsigned int i = 0; i < OPERANDS; i++) { 189 float res = logf(arguments_log[i]); 190 191 if (!cmp_float(res, results_log[i])) { 192 TPRINTF("Single precision logarithm failed " 193 "(%lf != %lf, arg %u)\n", res, results_log[i], i); 194 fail = true; 195 } 196 } 197 198 for (unsigned int i = 0; i < OPERANDS; i++) { 199 double res = log(arguments_log[i]); 200 201 if (!cmp_double(res, results_log[i])) { 202 TPRINTF("Double precision logarithm failed " 203 "(%lf != %lf, arg %u)\n", res, results_log[i], i); 204 fail = true; 205 } 206 } 207 208 for (unsigned int i = 0; i < OPERANDS; i++) { 209 float res = exp(arguments_exp[i]); 210 211 if (!cmp_float(res, results_exp[i])) { 212 TPRINTF("Single precision exponential failed " 213 "(%lf != %lf, arg %u)\n", res, results_exp[i], i); 214 fail = true; 215 } 216 } 217 218 for (unsigned int i = 0; i < OPERANDS; i++) { 219 double res = exp(arguments_exp[i]); 220 221 if (!cmp_double(res, results_exp[i])) { 222 TPRINTF("Double precision exponential failed " 223 "(%lf != %lf, arg %u)\n", res, results_exp[i], i); 224 fail = true; 225 } 226 } 227 250 251 if (!cmp_double(res, results_trunc[i])) { 252 TPRINTF("Double precision trunc failed " 253 "(%lf != %lf, arg %u)\n", res, results_trunc[i], i); 254 fail = true; 255 } 256 } 257 258 for (unsigned int i = 0; i < OPERANDS; i++) { 259 float res = truncf(arguments[i]); 260 261 if (!cmp_float(res, results_trunc[i])) { 262 TPRINTF("truncgle precision trunc failed " 263 "(%f != %lf, arg %u)\n", res, results_trunc[i], i); 264 fail = true; 265 } 266 } 267 228 268 if (fail) 229 269 return "Floating point imprecision"; 230 270 231 271 return NULL; 232 272 }
Note:
See TracChangeset
for help on using the changeset viewer.