1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: GPL - See COPYING in the top level directory 4 * PURPOSE: Tests for IEEE floatting-point functions 5 * PROGRAMMER: Pierre Schweitzer (pierre@reactos.org) 6 * REFERENCES: http://msdn.microsoft.com/en-US/library/h7zkk1bz%28v=VS.80%29.aspx 7 */ 8 9 #include <apitest.h> 10 11 #include <float.h> 12 #include <math.h> 13 14 typedef union 15 { 16 double d; 17 long long l; 18 } ieee_double; 19 20 void test_finite(void) 21 { 22 ieee_double tested; 23 24 tested.l = 0xFFFFFFFFFFFFFFFFLL; 25 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 26 tested.l = 0xFFF8000000000001LL; 27 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 28 tested.l = 0xFFF8000000000000LL; 29 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 30 tested.l = 0xFFF7FFFFFFFFFFFFLL; 31 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 32 tested.l = 0xFFF0000000000001LL; 33 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 34 tested.l = 0xFFF0000000000000LL; 35 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 36 tested.l = 0xFFEFFFFFFFFFFFFFLL; 37 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 38 tested.l = 0x8010000000000000LL; 39 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 40 tested.l = 0x800FFFFFFFFFFFFFLL; 41 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 42 tested.l = 0x8000000000000001LL; 43 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 44 tested.l = 0x8000000000000000LL; 45 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 46 tested.l = 0x0000000000000000LL; 47 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 48 tested.l = 0x0000000000000001LL; 49 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 50 tested.l = 0x000FFFFFFFFFFFFFLL; 51 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 52 tested.l = 0x0010000000000000LL; 53 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 54 tested.l = 0x7FEFFFFFFFFFFFFFLL; 55 ok(_finite(tested.d) == TRUE, "_finite = FALSE\n"); 56 tested.l = 0x7FF0000000000000LL; 57 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 58 tested.l = 0x7FF0000000000001LL; 59 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 60 tested.l = 0x7FF7FFFFFFFFFFFFLL; 61 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 62 tested.l = 0x7FF8000000000000LL; 63 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 64 tested.l = 0x7FFFFFFFFFFFFFFFLL; 65 ok(_finite(tested.d) == FALSE, "_finite = TRUE\n"); 66 67 /* MSDN example */ 68 ok(_finite(2.387000) == TRUE, "_finite = FALSE\n"); 69 } 70 71 void test_fpclass(void) 72 { 73 int class; 74 ieee_double tested; 75 76 tested.l = 0xFFFFFFFFFFFFFFFFLL; 77 class = _fpclass(tested.d); 78 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 79 tested.l = 0xFFF8000000000001LL; 80 class = _fpclass(tested.d); 81 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 82 tested.l = 0xFFF8000000000000LL; 83 class = _fpclass(tested.d); 84 /* Normally it has no class, but w2k3 defines it 85 * like that 86 */ 87 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 88 tested.l = 0xFFF7FFFFFFFFFFFFLL; 89 class = _fpclass(tested.d); 90 /* According to IEEE, it should be Signaling NaN, but 91 * on w2k3, it's Quiet NAN 92 * ok(class == _FPCLASS_SNAN, "class = %d\n", class); 93 */ 94 #ifdef _M_AMD64 95 ok(class == _FPCLASS_SNAN, "class = %d\n", class); 96 #else 97 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 98 #endif 99 tested.l = 0xFFF0000000000001LL; 100 class = _fpclass(tested.d); 101 /* According to IEEE, it should be Signaling NaN, but 102 * on w2k3, it's Quiet NAN 103 * ok(class == _FPCLASS_SNAN, "class = %d\n", class); 104 */ 105 #ifdef _M_AMD64 106 ok(class == _FPCLASS_SNAN, "class = %d\n", class); 107 #else 108 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 109 #endif 110 tested.l = 0xFFF0000000000000LL; 111 class = _fpclass(tested.d); 112 ok(class == _FPCLASS_NINF, "class = %d\n", class); 113 tested.l = 0xFFEFFFFFFFFFFFFFLL; 114 class = _fpclass(tested.d); 115 ok(class == _FPCLASS_NN, "class = %d\n", class); 116 tested.l = 0x8010000000000000LL; 117 class = _fpclass(tested.d); 118 ok(class == _FPCLASS_NN, "class = %d\n", class); 119 tested.l = 0x800FFFFFFFFFFFFFLL; 120 class = _fpclass(tested.d); 121 ok(class == _FPCLASS_ND, "class = %d\n", class); 122 tested.l = 0x8000000000000001LL; 123 class = _fpclass(tested.d); 124 ok(class == _FPCLASS_ND, "class = %d\n", class); 125 tested.l = 0x8000000000000000LL; 126 class = _fpclass(tested.d); 127 ok(class == _FPCLASS_NZ, "class = %d\n", class); 128 tested.l = 0x0000000000000000LL; 129 class = _fpclass(tested.d); 130 ok(class == _FPCLASS_PZ, "class = %d\n", class); 131 tested.l = 0x0000000000000001LL; 132 class = _fpclass(tested.d); 133 ok(class == _FPCLASS_PD, "class = %d\n", class); 134 tested.l = 0x000FFFFFFFFFFFFFLL; 135 class = _fpclass(tested.d); 136 ok(class == _FPCLASS_PD, "class = %d\n", class); 137 tested.l = 0x0010000000000000LL; 138 class = _fpclass(tested.d); 139 ok(class == _FPCLASS_PN, "class = %d\n", class); 140 tested.l = 0x7FEFFFFFFFFFFFFFLL; 141 class = _fpclass(tested.d); 142 ok(class == _FPCLASS_PN, "class = %d\n", class); 143 tested.l = 0x7FF0000000000000LL; 144 class = _fpclass(tested.d); 145 ok(class == _FPCLASS_PINF, "class = %d\n", class); 146 tested.l = 0x7FF0000000000001LL; 147 class = _fpclass(tested.d); 148 /* According to IEEE, it should be Signaling NaN, but 149 * on w2k3, it's Quiet NAN 150 * ok(class == _FPCLASS_SNAN, "class = %d\n", class); 151 */ 152 #ifdef _M_AMD64 153 ok(class == _FPCLASS_SNAN, "class = %d\n", class); 154 #else 155 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 156 #endif 157 tested.l = 0x7FF7FFFFFFFFFFFFLL; 158 class = _fpclass(tested.d); 159 /* According to IEEE, it should be Signaling NaN, but 160 * on w2k3, it's Quiet NAN 161 * ok(class == _FPCLASS_SNAN, "class = %d\n", class); 162 */ 163 #ifdef _M_AMD64 164 ok(class == _FPCLASS_SNAN, "class = %d\n", class); 165 #else 166 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 167 #endif 168 tested.l = 0x7FF8000000000000LL; 169 class = _fpclass(tested.d); 170 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 171 tested.l = 0x7FFFFFFFFFFFFFFFLL; 172 class = _fpclass(tested.d); 173 ok(class == _FPCLASS_QNAN, "class = %d\n", class); 174 175 /* MSDN example */ 176 class = _fpclass(2.387000); 177 ok(class == _FPCLASS_PN, "class = %d\n", class); 178 } 179 180 void test_isnan(void) 181 { 182 ieee_double tested; 183 184 tested.l = 0xFFFFFFFFFFFFFFFFLL; 185 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 186 tested.l = 0xFFF8000000000001LL; 187 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 188 tested.l = 0xFFF8000000000000LL; 189 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 190 tested.l = 0xFFF7FFFFFFFFFFFFLL; 191 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 192 tested.l = 0xFFF0000000000001LL; 193 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 194 tested.l = 0xFFF0000000000000LL; 195 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 196 tested.l = 0xFFEFFFFFFFFFFFFFLL; 197 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 198 tested.l = 0x8010000000000000LL; 199 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 200 tested.l = 0x800FFFFFFFFFFFFFLL; 201 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 202 tested.l = 0x8000000000000001LL; 203 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 204 tested.l = 0x8000000000000000LL; 205 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 206 tested.l = 0x0000000000000000LL; 207 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 208 tested.l = 0x0000000000000001LL; 209 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 210 tested.l = 0x000FFFFFFFFFFFFFLL; 211 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 212 tested.l = 0x0010000000000000LL; 213 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 214 tested.l = 0x7FEFFFFFFFFFFFFFLL; 215 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 216 tested.l = 0x7FF0000000000000LL; 217 ok(_isnan(tested.d) == FALSE, "_isnan = TRUE\n"); 218 tested.l = 0x7FF0000000000001LL; 219 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 220 tested.l = 0x7FF7FFFFFFFFFFFFLL; 221 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 222 tested.l = 0x7FF8000000000000LL; 223 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 224 tested.l = 0x7FFFFFFFFFFFFFFFLL; 225 ok(_isnan(tested.d) == TRUE, "_isnan = FALSE\n"); 226 227 /* MSDN example */ 228 ok(_isnan(2.387000) == FALSE, "_isnan = TRUE\n"); 229 } 230 231 void test_j0(void) 232 { 233 ieee_double tested; 234 ieee_double expected; 235 ieee_double result; 236 237 expected.l = 0; 238 239 errno = 0xDEADBEEF; 240 tested.l = 0xFFFFFFFFFFFFFFFFLL; 241 expected.l = 0xFFFFFFFFFFFFFFFFLL; 242 result.d = _j0(tested.d); 243 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 244 ok(errno == EDOM, "errno: %d\n", errno); 245 errno = 0xDEADBEEF; 246 tested.l = 0xFFF8000000000001LL; 247 expected.l = 0xFFF8000000000001LL; 248 result.d = _j0(tested.d); 249 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 250 ok(errno == EDOM, "errno: %d\n", errno); 251 errno = 0xDEADBEEF; 252 tested.l = 0xFFF8000000000000LL; 253 expected.l = 0xFFF8000000000000LL; 254 result.d = _j0(tested.d); 255 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 256 ok(errno == EDOM, "errno: %d\n", errno); 257 errno = 0xDEADBEEF; 258 tested.l = 0xFFF7FFFFFFFFFFFFLL; 259 expected.l = 0xFFFFFFFFFFFFFFFFLL; 260 result.d = _j0(tested.d); 261 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 262 ok(errno == EDOM, "errno: %d\n", errno); 263 errno = 0xDEADBEEF; 264 tested.l = 0xFFF0000000000001LL; 265 expected.l = 0xFFF8000000000001LL; 266 result.d = _j0(tested.d); 267 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 268 ok(errno == EDOM, "errno: %d\n", errno); 269 errno = 0xDEADBEEF; 270 tested.l = 0xFFF0000000000000LL; 271 expected.l = 0xFFF8000000000000LL; 272 result.d = _j0(tested.d); 273 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 274 ok(errno == EDOM, "errno: %d\n", errno); 275 errno = 0xDEADBEEF; 276 tested.l = 0xFFEFFFFFFFFFFFFFLL; 277 #ifdef _M_AMD64 278 expected.l = 0x8000000000000000LL; 279 #else 280 expected.l = 0x1FE7206E1D6FDCFALL; 281 #endif 282 result.d = _j0(tested.d); 283 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 284 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 285 errno = 0xDEADBEEF; 286 tested.l = 0x8010000000000000LL; 287 expected.l = 0x3FF0000000000000LL; 288 result.d = _j0(tested.d); 289 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 290 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 291 errno = 0xDEADBEEF; 292 tested.l = 0x800FFFFFFFFFFFFFLL; 293 expected.l = 0x3FF0000000000000LL; 294 result.d = _j0(tested.d); 295 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 296 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 297 errno = 0xDEADBEEF; 298 tested.l = 0x8000000000000001LL; 299 expected.l = 0x3FF0000000000000LL; 300 result.d = _j0(tested.d); 301 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 302 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 303 errno = 0xDEADBEEF; 304 tested.l = 0x8000000000000000LL; 305 expected.l = 0x3FF0000000000000LL; 306 result.d = _j0(tested.d); 307 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 308 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 309 errno = 0xDEADBEEF; 310 tested.l = 0x0000000000000000LL; 311 expected.l = 0x3FF0000000000000LL; 312 result.d = _j0(tested.d); 313 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 314 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 315 errno = 0xDEADBEEF; 316 tested.l = 0x0000000000000001LL; 317 expected.l = 0x3FF0000000000000LL; 318 result.d = _j0(tested.d); 319 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 320 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 321 errno = 0xDEADBEEF; 322 tested.l = 0x000FFFFFFFFFFFFFLL; 323 expected.l = 0x3FF0000000000000LL; 324 result.d = _j0(tested.d); 325 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 326 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 327 errno = 0xDEADBEEF; 328 tested.l = 0x0010000000000000LL; 329 expected.l = 0x3FF0000000000000LL; 330 result.d = _j0(tested.d); 331 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 332 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 333 errno = 0xDEADBEEF; 334 tested.l = 0x7FEFFFFFFFFFFFFFLL; 335 #ifdef _M_AMD64 336 expected.l = 0x8000000000000000LL; 337 #else 338 expected.l = 0x1FE7206E1D6FDCFALL; 339 #endif 340 result.d = _j0(tested.d); 341 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 342 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 343 errno = 0xDEADBEEF; 344 tested.l = 0x7FF0000000000000LL; 345 expected.l = 0xFFF8000000000000LL; 346 result.d = _j0(tested.d); 347 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 348 ok(errno == EDOM, "errno: %d\n", errno); 349 errno = 0xDEADBEEF; 350 tested.l = 0x7FF0000000000001LL; 351 expected.l = 0x7FF8000000000001LL; 352 result.d = _j0(tested.d); 353 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 354 ok(errno == EDOM, "errno: %d\n", errno); 355 errno = 0xDEADBEEF; 356 tested.l = 0x7FF7FFFFFFFFFFFFLL; 357 expected.l = 0x7FFFFFFFFFFFFFFFLL; 358 result.d = _j0(tested.d); 359 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 360 ok(errno == EDOM, "errno: %d\n", errno); 361 errno = 0xDEADBEEF; 362 tested.l = 0x7FF8000000000000LL; 363 expected.l = 0x7FF8000000000000LL; 364 result.d = _j0(tested.d); 365 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 366 ok(errno == EDOM, "errno: %d\n", errno); 367 errno = 0xDEADBEEF; 368 tested.l = 0x7FFFFFFFFFFFFFFFLL; 369 expected.l = 0x7FFFFFFFFFFFFFFFLL; 370 result.d = _j0(tested.d); 371 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 372 ok(errno == EDOM, "errno: %d\n", errno); 373 374 /* MSDN example */ 375 errno = 0xDEADBEEF; 376 tested.d = 2.387000; 377 expected.l = 0x3F83059F9F6F30CALL; 378 result.d = _j0(tested.d); 379 ok(result.l == expected.l, "_j0 returned: %I64x\n", result.l); 380 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 381 } 382 383 void test_j1(void) 384 { 385 ieee_double tested; 386 ieee_double expected; 387 ieee_double result; 388 389 expected.l = 0; 390 391 errno = 0xDEADBEEF; 392 tested.l = 0xFFFFFFFFFFFFFFFFLL; 393 expected.l = 0xFFFFFFFFFFFFFFFFLL; 394 result.d = _j1(tested.d); 395 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 396 ok(errno == EDOM, "errno: %d\n", errno); 397 errno = 0xDEADBEEF; 398 tested.l = 0xFFF8000000000001LL; 399 expected.l = 0xFFF8000000000001LL; 400 result.d = _j1(tested.d); 401 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 402 ok(errno == EDOM, "errno: %d\n", errno); 403 errno = 0xDEADBEEF; 404 tested.l = 0xFFF8000000000000LL; 405 expected.l = 0xFFF8000000000000LL; 406 result.d = _j1(tested.d); 407 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 408 ok(errno == EDOM, "errno: %d\n", errno); 409 errno = 0xDEADBEEF; 410 tested.l = 0xFFF7FFFFFFFFFFFFLL; 411 expected.l = 0xFFFFFFFFFFFFFFFFLL; 412 result.d = _j1(tested.d); 413 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 414 ok(errno == EDOM, "errno: %d\n", errno); 415 errno = 0xDEADBEEF; 416 tested.l = 0xFFF0000000000001LL; 417 expected.l = 0xFFF8000000000001LL; 418 result.d = _j1(tested.d); 419 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 420 ok(errno == EDOM, "errno: %d\n", errno); 421 errno = 0xDEADBEEF; 422 tested.l = 0xFFF0000000000000LL; 423 expected.l = 0xFFF8000000000000LL; 424 result.d = _j1(tested.d); 425 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 426 ok(errno == EDOM, "errno: %d\n", errno); 427 errno = 0xDEADBEEF; 428 tested.l = 0xFFEFFFFFFFFFFFFFLL; 429 #ifdef _M_AMD64 430 expected.l = 0; 431 #else 432 expected.l = 0x9FE7206E1D6FDCFALL; 433 #endif 434 result.d = _j1(tested.d); 435 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 436 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 437 errno = 0xDEADBEEF; 438 tested.l = 0x8010000000000000LL; 439 expected.l = 0x8008000000000000LL; 440 result.d = _j1(tested.d); 441 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 442 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 443 errno = 0xDEADBEEF; 444 tested.l = 0x800FFFFFFFFFFFFFLL; 445 expected.l = 0x8008000000000000LL; 446 result.d = _j1(tested.d); 447 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 448 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 449 errno = 0xDEADBEEF; 450 tested.l = 0x8000000000000001LL; 451 expected.l = 0x8000000000000000LL; 452 result.d = _j1(tested.d); 453 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 454 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 455 errno = 0xDEADBEEF; 456 tested.l = 0x8000000000000000LL; 457 expected.l = 0x8000000000000000LL; 458 result.d = _j1(tested.d); 459 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 460 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 461 errno = 0xDEADBEEF; 462 tested.l = 0x0000000000000000LL; 463 expected.l = 0x0000000000000000LL; 464 result.d = _j1(tested.d); 465 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 466 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 467 errno = 0xDEADBEEF; 468 tested.l = 0x0000000000000001LL; 469 expected.l = 0x0000000000000000LL; 470 result.d = _j1(tested.d); 471 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 472 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 473 errno = 0xDEADBEEF; 474 tested.l = 0x000FFFFFFFFFFFFFLL; 475 expected.l = 0x0008000000000000LL; 476 result.d = _j1(tested.d); 477 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 478 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 479 errno = 0xDEADBEEF; 480 tested.l = 0x0010000000000000LL; 481 expected.l = 0x0008000000000000LL; 482 result.d = _j1(tested.d); 483 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 484 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 485 errno = 0xDEADBEEF; 486 tested.l = 0x7FEFFFFFFFFFFFFFLL; 487 #ifdef _M_AMD64 488 expected.l = 0x8000000000000000LL; 489 #else 490 expected.l = 0x1FE7206E1D6FDCFALL; 491 #endif 492 result.d = _j1(tested.d); 493 ok(result.l == expected.l, "_j1 returned: %I64x, expected %I64x\n", result.l, expected.l); 494 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 495 errno = 0xDEADBEEF; 496 tested.l = 0x7FF0000000000000LL; 497 expected.l = 0xFFF8000000000000LL; 498 result.d = _j1(tested.d); 499 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 500 ok(errno == EDOM, "errno: %d\n", errno); 501 errno = 0xDEADBEEF; 502 tested.l = 0x7FF0000000000001LL; 503 expected.l = 0x7FF8000000000001LL; 504 result.d = _j1(tested.d); 505 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 506 ok(errno == EDOM, "errno: %d\n", errno); 507 errno = 0xDEADBEEF; 508 tested.l = 0x7FF7FFFFFFFFFFFFLL; 509 expected.l = 0x7FFFFFFFFFFFFFFFLL; 510 result.d = _j1(tested.d); 511 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 512 ok(errno == EDOM, "errno: %d\n", errno); 513 errno = 0xDEADBEEF; 514 tested.l = 0x7FF8000000000000LL; 515 expected.l = 0x7FF8000000000000LL; 516 result.d = _j1(tested.d); 517 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 518 ok(errno == EDOM, "errno: %d\n", errno); 519 errno = 0xDEADBEEF; 520 tested.l = 0x7FFFFFFFFFFFFFFFLL; 521 expected.l = 0x7FFFFFFFFFFFFFFFLL; 522 result.d = _j1(tested.d); 523 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 524 ok(errno == EDOM, "errno: %d\n", errno); 525 526 /* MSDN example */ 527 errno = 0xDEADBEEF; 528 tested.d = 2.387000; 529 expected.l = 0x3FE0BBEFC62ABAB1LL; 530 result.d = _j1(tested.d); 531 ok(result.l == expected.l, "_j1 returned: %I64x\n", result.l); 532 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 533 } 534 535 void test_scalb(void) 536 { 537 ieee_double tested; 538 ieee_double expected; 539 ieee_double result; 540 541 expected.l = 0; 542 543 errno = 0xDEADBEEF; 544 tested.l = 0xFFFFFFFFFFFFFFFFLL; 545 expected.l = 0xFFFFFFFFFFFFFFFFLL; 546 result.d = _scalb(tested.d, 3); 547 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 548 ok(errno == EDOM, "errno: %d\n", errno); 549 errno = 0xDEADBEEF; 550 tested.l = 0xFFF8000000000001LL; 551 expected.l = 0xFFF8000000000001LL; 552 result.d = _scalb(tested.d, 3); 553 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 554 ok(errno == EDOM, "errno: %d\n", errno); 555 errno = 0xDEADBEEF; 556 tested.l = 0xFFF8000000000000LL; 557 expected.l = 0xFFF8000000000000LL; 558 result.d = _scalb(tested.d, 3); 559 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 560 ok(errno == EDOM, "errno: %d\n", errno); 561 errno = 0xDEADBEEF; 562 tested.l = 0xFFF7FFFFFFFFFFFFLL; 563 expected.l = 0xFFFFFFFFFFFFFFFFLL; 564 result.d = _scalb(tested.d, 3); 565 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 566 ok(errno == EDOM, "errno: %d\n", errno); 567 errno = 0xDEADBEEF; 568 tested.l = 0xFFF0000000000001LL; 569 expected.l = 0xFFF8000000000001LL; 570 result.d = _scalb(tested.d, 3); 571 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 572 ok(errno == EDOM, "errno: %d\n", errno); 573 errno = 0xDEADBEEF; 574 tested.l = 0xFFF0000000000000LL; 575 expected.l = 0xFFF0000000000000LL; 576 result.d = _scalb(tested.d, 3); 577 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 578 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 579 errno = 0xDEADBEEF; 580 tested.l = 0xFFEFFFFFFFFFFFFFLL; 581 expected.l = 0xFFF0000000000000LL; 582 result.d = _scalb(tested.d, 3); 583 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 584 ok(errno == ERANGE, "errno: %d\n", errno); 585 errno = 0xDEADBEEF; 586 tested.l = 0x8010000000000000LL; 587 expected.l = 0x8040000000000000LL; 588 result.d = _scalb(tested.d, 3); 589 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 590 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 591 errno = 0xDEADBEEF; 592 tested.l = 0x800FFFFFFFFFFFFFLL; 593 expected.l = 0x803FFFFFFFFFFFFELL; 594 result.d = _scalb(tested.d, 3); 595 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 596 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 597 errno = 0xDEADBEEF; 598 tested.l = 0x8000000000000001LL; 599 expected.l = 0x8000000000000008LL; 600 result.d = _scalb(tested.d, 3); 601 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 602 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 603 errno = 0xDEADBEEF; 604 tested.l = 0x8000000000000000LL; 605 expected.l = 0x8000000000000000LL; 606 result.d = _scalb(tested.d, 3); 607 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 608 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 609 errno = 0xDEADBEEF; 610 tested.l = 0x0000000000000000LL; 611 expected.l = 0x0000000000000000LL; 612 result.d = _scalb(tested.d, 3); 613 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 614 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 615 errno = 0xDEADBEEF; 616 tested.l = 0x0000000000000001LL; 617 expected.l = 0x0000000000000008LL; 618 result.d = _scalb(tested.d, 3); 619 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 620 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 621 errno = 0xDEADBEEF; 622 tested.l = 0x000FFFFFFFFFFFFFLL; 623 expected.l = 0x003FFFFFFFFFFFFELL; 624 result.d = _scalb(tested.d, 3); 625 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 626 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 627 errno = 0xDEADBEEF; 628 tested.l = 0x0010000000000000LL; 629 expected.l = 0x0040000000000000LL; 630 result.d = _scalb(tested.d, 3); 631 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 632 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 633 errno = 0xDEADBEEF; 634 tested.l = 0x7FEFFFFFFFFFFFFFLL; 635 expected.l = 0x7FF0000000000000LL; 636 result.d = _scalb(tested.d, 3); 637 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 638 ok(errno == ERANGE, "errno: %d\n", errno); 639 errno = 0xDEADBEEF; 640 tested.l = 0x7FF0000000000000LL; 641 expected.l = 0x7FF0000000000000LL; 642 result.d = _scalb(tested.d, 3); 643 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 644 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 645 errno = 0xDEADBEEF; 646 tested.l = 0x7FF0000000000001LL; 647 expected.l = 0x7FF8000000000001LL; 648 result.d = _scalb(tested.d, 3); 649 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 650 ok(errno == EDOM, "errno: %d\n", errno); 651 errno = 0xDEADBEEF; 652 tested.l = 0x7FF7FFFFFFFFFFFFLL; 653 expected.l = 0x7FFFFFFFFFFFFFFFLL; 654 result.d = _scalb(tested.d, 3); 655 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 656 ok(errno == EDOM, "errno: %d\n", errno); 657 errno = 0xDEADBEEF; 658 tested.l = 0x7FF8000000000000LL; 659 expected.l = 0x7FF8000000000000LL; 660 result.d = _scalb(tested.d, 3); 661 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 662 ok(errno == EDOM, "errno: %d\n", errno); 663 errno = 0xDEADBEEF; 664 tested.l = 0x7FFFFFFFFFFFFFFFLL; 665 expected.l = 0x7FFFFFFFFFFFFFFFLL; 666 result.d = _scalb(tested.d, 3); 667 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 668 ok(errno == EDOM, "errno: %d\n", errno); 669 670 /* MSDN example */ 671 errno = 0xDEADBEEF; 672 tested.d = 2.387000; 673 expected.l = 0x4033189374BC6A7FLL; 674 result.d = _scalb(tested.d, 3); 675 ok(result.l == expected.l, "_scalb returned: %I64x\n", result.l); 676 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 677 } 678 679 void test_y0(void) 680 { 681 ieee_double tested; 682 ieee_double expected; 683 ieee_double result; 684 685 expected.l = 0; 686 687 errno = 0xDEADBEEF; 688 tested.l = 0xFFFFFFFFFFFFFFFFLL; 689 expected.l = 0xFFFFFFFFFFFFFFFFLL; 690 result.d = _y0(tested.d); 691 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 692 ok(errno == EDOM, "errno: %d\n", errno); 693 errno = 0xDEADBEEF; 694 tested.l = 0xFFF8000000000001LL; 695 expected.l = 0xFFF8000000000001LL; 696 result.d = _y0(tested.d); 697 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 698 ok(errno == EDOM, "errno: %d\n", errno); 699 errno = 0xDEADBEEF; 700 tested.l = 0xFFF8000000000000LL; 701 expected.l = 0xFFF8000000000000LL; 702 result.d = _y0(tested.d); 703 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 704 ok(errno == EDOM, "errno: %d\n", errno); 705 errno = 0xDEADBEEF; 706 tested.l = 0xFFF7FFFFFFFFFFFFLL; 707 expected.l = 0xFFFFFFFFFFFFFFFFLL; 708 result.d = _y0(tested.d); 709 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 710 ok(errno == EDOM, "errno: %d\n", errno); 711 errno = 0xDEADBEEF; 712 tested.l = 0xFFF0000000000001LL; 713 expected.l = 0xFFF8000000000001LL; 714 result.d = _y0(tested.d); 715 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 716 ok(errno == EDOM, "errno: %d\n", errno); 717 errno = 0xDEADBEEF; 718 tested.l = 0xFFF0000000000000LL; 719 expected.l = 0xFFF8000000000000LL; 720 result.d = _y0(tested.d); 721 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 722 ok(errno == EDOM, "errno: %d\n", errno); 723 errno = 0xDEADBEEF; 724 tested.l = 0xFFEFFFFFFFFFFFFFLL; 725 expected.l = 0xFFF8000000000000LL; 726 result.d = _y0(tested.d); 727 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 728 ok(errno == EDOM, "errno: %d\n", errno); 729 errno = 0xDEADBEEF; 730 tested.l = 0x8010000000000000LL; 731 expected.l = 0xFFF8000000000000LL; 732 result.d = _y0(tested.d); 733 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 734 ok(errno == EDOM, "errno: %d\n", errno); 735 errno = 0xDEADBEEF; 736 tested.l = 0x800FFFFFFFFFFFFFLL; 737 expected.l = 0xFFF8000000000000LL; 738 result.d = _y0(tested.d); 739 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 740 ok(errno == EDOM, "errno: %d\n", errno); 741 errno = 0xDEADBEEF; 742 tested.l = 0x8000000000000001LL; 743 expected.l = 0xFFF8000000000000LL; 744 result.d = _y0(tested.d); 745 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 746 ok(errno == EDOM, "errno: %d\n", errno); 747 errno = 0xDEADBEEF; 748 tested.l = 0x8000000000000000LL; 749 expected.l = 0xFFF0000000000000LL; 750 result.d = _y0(tested.d); 751 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 752 ok(errno == ERANGE, "errno: %d\n", errno); 753 errno = 0xDEADBEEF; 754 tested.l = 0x0000000000000000LL; 755 expected.l = 0xFFF0000000000000LL; 756 result.d = _y0(tested.d); 757 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 758 ok(errno == ERANGE, "errno: %d\n", errno); 759 errno = 0xDEADBEEF; 760 tested.l = 0x0000000000000001LL; 761 expected.l = 0xC07D9FFC3469E1B3LL; 762 result.d = _y0(tested.d); 763 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 764 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 765 errno = 0xDEADBEEF; 766 tested.l = 0x000FFFFFFFFFFFFFLL; 767 expected.l = 0xC07C30D8F820740ELL; 768 result.d = _y0(tested.d); 769 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 770 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 771 errno = 0xDEADBEEF; 772 tested.l = 0x0010000000000000LL; 773 expected.l = 0xC07C30D8F820740ELL; 774 result.d = _y0(tested.d); 775 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 776 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 777 errno = 0xDEADBEEF; 778 tested.l = 0x7FEFFFFFFFFFFFFFLL; 779 #ifdef _M_AMD64 780 expected.l = 0; 781 #else 782 expected.l = 0x9FD5A36F8428F58BLL; 783 #endif 784 result.d = _y0(tested.d); 785 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 786 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 787 errno = 0xDEADBEEF; 788 tested.l = 0x7FF0000000000000LL; 789 expected.l = 0xFFF8000000000000LL; 790 result.d = _y0(tested.d); 791 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 792 ok(errno == EDOM, "errno: %d\n", errno); 793 errno = 0xDEADBEEF; 794 tested.l = 0x7FF0000000000001LL; 795 expected.l = 0x7FF8000000000001LL; 796 result.d = _y0(tested.d); 797 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 798 ok(errno == EDOM, "errno: %d\n", errno); 799 errno = 0xDEADBEEF; 800 tested.l = 0x7FF7FFFFFFFFFFFFLL; 801 expected.l = 0x7FFFFFFFFFFFFFFFLL; 802 result.d = _y0(tested.d); 803 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 804 ok(errno == EDOM, "errno: %d\n", errno); 805 errno = 0xDEADBEEF; 806 tested.l = 0x7FF8000000000000LL; 807 expected.l = 0x7FF8000000000000LL; 808 result.d = _y0(tested.d); 809 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 810 ok(errno == EDOM, "errno: %d\n", errno); 811 errno = 0xDEADBEEF; 812 tested.l = 0x7FFFFFFFFFFFFFFFLL; 813 expected.l = 0x7FFFFFFFFFFFFFFFLL; 814 result.d = _y0(tested.d); 815 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 816 ok(errno == EDOM, "errno: %d\n", errno); 817 818 /* MSDN example */ 819 errno = 0xDEADBEEF; 820 tested.d = 2.387000; 821 expected.l = 0x3FE05FB1B1E49E66LL; 822 result.d = _y0(tested.d); 823 ok(result.l == expected.l, "_y0 returned: %I64x\n", result.l); 824 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 825 } 826 827 void test_y1(void) 828 { 829 ieee_double tested; 830 ieee_double expected; 831 ieee_double result; 832 833 expected.l = 0; 834 835 errno = 0xDEADBEEF; 836 tested.l = 0xFFFFFFFFFFFFFFFFLL; 837 expected.l = 0xFFFFFFFFFFFFFFFFLL; 838 result.d = _y1(tested.d); 839 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 840 ok(errno == EDOM, "errno: %d\n", errno); 841 errno = 0xDEADBEEF; 842 tested.l = 0xFFF8000000000001LL; 843 expected.l = 0xFFF8000000000001LL; 844 result.d = _y1(tested.d); 845 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 846 ok(errno == EDOM, "errno: %d\n", errno); 847 errno = 0xDEADBEEF; 848 tested.l = 0xFFF8000000000000LL; 849 expected.l = 0xFFF8000000000000LL; 850 result.d = _y1(tested.d); 851 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 852 ok(errno == EDOM, "errno: %d\n", errno); 853 errno = 0xDEADBEEF; 854 tested.l = 0xFFF7FFFFFFFFFFFFLL; 855 expected.l = 0xFFFFFFFFFFFFFFFFLL; 856 result.d = _y1(tested.d); 857 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 858 ok(errno == EDOM, "errno: %d\n", errno); 859 errno = 0xDEADBEEF; 860 tested.l = 0xFFF0000000000001LL; 861 expected.l = 0xFFF8000000000001LL; 862 result.d = _y1(tested.d); 863 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 864 ok(errno == EDOM, "errno: %d\n", errno); 865 errno = 0xDEADBEEF; 866 tested.l = 0xFFF0000000000000LL; 867 expected.l = 0xFFF8000000000000LL; 868 result.d = _y1(tested.d); 869 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 870 ok(errno == EDOM, "errno: %d\n", errno); 871 errno = 0xDEADBEEF; 872 tested.l = 0xFFEFFFFFFFFFFFFFLL; 873 expected.l = 0xFFF8000000000000LL; 874 result.d = _y1(tested.d); 875 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 876 ok(errno == EDOM, "errno: %d\n", errno); 877 errno = 0xDEADBEEF; 878 tested.l = 0x8010000000000000LL; 879 expected.l = 0xFFF8000000000000LL; 880 result.d = _y1(tested.d); 881 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 882 ok(errno == EDOM, "errno: %d\n", errno); 883 errno = 0xDEADBEEF; 884 tested.l = 0x800FFFFFFFFFFFFFLL; 885 expected.l = 0xFFF8000000000000LL; 886 result.d = _y1(tested.d); 887 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 888 ok(errno == EDOM, "errno: %d\n", errno); 889 errno = 0xDEADBEEF; 890 tested.l = 0x8000000000000001LL; 891 expected.l = 0xFFF8000000000000LL; 892 result.d = _y1(tested.d); 893 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 894 ok(errno == EDOM, "errno: %d\n", errno); 895 errno = 0xDEADBEEF; 896 tested.l = 0x8000000000000000LL; 897 expected.l = 0xFFF8000000000000LL; 898 result.d = _y1(tested.d); 899 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 900 ok(errno == ERANGE, "errno: %d\n", errno); 901 errno = 0xDEADBEEF; 902 tested.l = 0x0000000000000000LL; 903 expected.l = 0xFFF8000000000000LL; 904 result.d = _y1(tested.d); 905 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 906 ok(errno == ERANGE, "errno: %d\n", errno); 907 errno = 0xDEADBEEF; 908 tested.l = 0x0000000000000001LL; 909 expected.l = 0xFFF0000000000000LL; 910 result.d = _y1(tested.d); 911 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 912 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 913 errno = 0xDEADBEEF; 914 tested.l = 0x000FFFFFFFFFFFFFLL; 915 expected.l = 0xFFC45F306DC9C884LL; 916 result.d = _y1(tested.d); 917 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 918 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 919 errno = 0xDEADBEEF; 920 tested.l = 0x0010000000000000LL; 921 expected.l = 0xFFC45F306DC9C883LL; 922 result.d = _y1(tested.d); 923 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 924 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 925 errno = 0xDEADBEEF; 926 tested.l = 0x7FEFFFFFFFFFFFFFLL; 927 #ifdef _M_AMD64 928 expected.l = 0; 929 #else 930 expected.l = 0x9FD5A36F8428F58BLL; 931 #endif 932 result.d = _y1(tested.d); 933 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 934 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 935 errno = 0xDEADBEEF; 936 tested.l = 0x7FF0000000000000LL; 937 expected.l = 0xFFF8000000000000LL; 938 result.d = _y1(tested.d); 939 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 940 ok(errno == EDOM, "errno: %d\n", errno); 941 errno = 0xDEADBEEF; 942 tested.l = 0x7FF0000000000001LL; 943 expected.l = 0x7FF8000000000001LL; 944 result.d = _y1(tested.d); 945 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 946 ok(errno == EDOM, "errno: %d\n", errno); 947 errno = 0xDEADBEEF; 948 tested.l = 0x7FF7FFFFFFFFFFFFLL; 949 expected.l = 0x7FFFFFFFFFFFFFFFLL; 950 result.d = _y1(tested.d); 951 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 952 ok(errno == EDOM, "errno: %d\n", errno); 953 errno = 0xDEADBEEF; 954 tested.l = 0x7FF8000000000000LL; 955 expected.l = 0x7FF8000000000000LL; 956 result.d = _y1(tested.d); 957 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 958 ok(errno == EDOM, "errno: %d\n", errno); 959 errno = 0xDEADBEEF; 960 tested.l = 0x7FFFFFFFFFFFFFFFLL; 961 expected.l = 0x7FFFFFFFFFFFFFFFLL; 962 result.d = _y1(tested.d); 963 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 964 ok(errno == EDOM, "errno: %d\n", errno); 965 966 /* MSDN example */ 967 errno = 0xDEADBEEF; 968 tested.d = 2.387000; 969 expected.l = 0x3FB828EC13723EE6LL; 970 result.d = _y1(tested.d); 971 ok(result.l == expected.l, "_y1 returned: %I64x\n", result.l); 972 ok(errno == 0xDEADBEEF, "errno: %d\n", errno); 973 } 974 975 START_TEST(ieee) 976 { 977 test_finite(); 978 test_fpclass(); 979 test_isnan(); 980 test_j0(); 981 test_j1(); 982 test_scalb(); 983 test_y0(); 984 test_y1(); 985 } 986