Fix up mix of man(7)/mdoc(7).
[netbsd-mini2440.git] / regress / lib / libc / ieeefp / testfloat / testCases.c
blobf25e1b3a5542e09f90227e4c61cebe25c8821735
1 /* $NetBSD: testCases.c,v 1.4 2002/02/21 07:38:16 itojun Exp $ */
3 /* This is a derivative work. */
5 /*-
6 * Copyright (c) 2001 The NetBSD Foundation, Inc.
7 * All rights reserved.
9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Ross Harvey.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
35 ===============================================================================
37 This C source file is part of TestFloat, Release 2a, a package of programs
38 for testing the correctness of floating-point arithmetic complying to the
39 IEC/IEEE Standard for Floating-Point.
41 Written by John R. Hauser. More information is available through the Web
42 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
44 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
45 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
46 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
47 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
48 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
50 Derivative works are acceptable, even for commercial purposes, so long as
51 (1) they include prominent notice that the work is derivative, and (2) they
52 include prominent notice akin to these four paragraphs for those parts of
53 this code that are retained.
55 ===============================================================================
58 #include <stdlib.h>
60 #include "milieu.h"
61 #include "fail.h"
62 #include "softfloat.h"
63 #include "testCases.h"
64 #include "random.h"
66 typedef struct {
67 int16 expNum, term1Num, term2Num;
68 flag done;
69 } sequenceT;
71 enum {
72 int32NumP1 = 124
75 static const uint32 int32P1[ int32NumP1 ] = {
76 0x00000000,
77 0x00000001,
78 0x00000002,
79 0x00000004,
80 0x00000008,
81 0x00000010,
82 0x00000020,
83 0x00000040,
84 0x00000080,
85 0x00000100,
86 0x00000200,
87 0x00000400,
88 0x00000800,
89 0x00001000,
90 0x00002000,
91 0x00004000,
92 0x00008000,
93 0x00010000,
94 0x00020000,
95 0x00040000,
96 0x00080000,
97 0x00100000,
98 0x00200000,
99 0x00400000,
100 0x00800000,
101 0x01000000,
102 0x02000000,
103 0x04000000,
104 0x08000000,
105 0x10000000,
106 0x20000000,
107 0x40000000,
108 0x80000000,
109 0xC0000000,
110 0xE0000000,
111 0xF0000000,
112 0xF8000000,
113 0xFC000000,
114 0xFE000000,
115 0xFF000000,
116 0xFF800000,
117 0xFFC00000,
118 0xFFE00000,
119 0xFFF00000,
120 0xFFF80000,
121 0xFFFC0000,
122 0xFFFE0000,
123 0xFFFF0000,
124 0xFFFF8000,
125 0xFFFFC000,
126 0xFFFFE000,
127 0xFFFFF000,
128 0xFFFFF800,
129 0xFFFFFC00,
130 0xFFFFFE00,
131 0xFFFFFF00,
132 0xFFFFFF80,
133 0xFFFFFFC0,
134 0xFFFFFFE0,
135 0xFFFFFFF0,
136 0xFFFFFFF8,
137 0xFFFFFFFC,
138 0xFFFFFFFE,
139 0xFFFFFFFF,
140 0xFFFFFFFD,
141 0xFFFFFFFB,
142 0xFFFFFFF7,
143 0xFFFFFFEF,
144 0xFFFFFFDF,
145 0xFFFFFFBF,
146 0xFFFFFF7F,
147 0xFFFFFEFF,
148 0xFFFFFDFF,
149 0xFFFFFBFF,
150 0xFFFFF7FF,
151 0xFFFFEFFF,
152 0xFFFFDFFF,
153 0xFFFFBFFF,
154 0xFFFF7FFF,
155 0xFFFEFFFF,
156 0xFFFDFFFF,
157 0xFFFBFFFF,
158 0xFFF7FFFF,
159 0xFFEFFFFF,
160 0xFFDFFFFF,
161 0xFFBFFFFF,
162 0xFF7FFFFF,
163 0xFEFFFFFF,
164 0xFDFFFFFF,
165 0xFBFFFFFF,
166 0xF7FFFFFF,
167 0xEFFFFFFF,
168 0xDFFFFFFF,
169 0xBFFFFFFF,
170 0x7FFFFFFF,
171 0x3FFFFFFF,
172 0x1FFFFFFF,
173 0x0FFFFFFF,
174 0x07FFFFFF,
175 0x03FFFFFF,
176 0x01FFFFFF,
177 0x00FFFFFF,
178 0x007FFFFF,
179 0x003FFFFF,
180 0x001FFFFF,
181 0x000FFFFF,
182 0x0007FFFF,
183 0x0003FFFF,
184 0x0001FFFF,
185 0x0000FFFF,
186 0x00007FFF,
187 0x00003FFF,
188 0x00001FFF,
189 0x00000FFF,
190 0x000007FF,
191 0x000003FF,
192 0x000001FF,
193 0x000000FF,
194 0x0000007F,
195 0x0000003F,
196 0x0000001F,
197 0x0000000F,
198 0x00000007,
199 0x00000003
202 static int32 int32NextP1( sequenceT *sequencePtr )
204 uint8 termNum;
205 int32 z;
207 termNum = sequencePtr->term1Num;
208 z = int32P1[ termNum ];
209 ++termNum;
210 if ( int32NumP1 <= termNum ) {
211 termNum = 0;
212 sequencePtr->done = TRUE;
214 sequencePtr->term1Num = termNum;
215 return (sbits32) z;
219 static const int32 int32NumP2 = ( int32NumP1 * int32NumP1 + int32NumP1 ) / 2;
221 static int32 int32NextP2( sequenceT *sequencePtr )
223 uint8 term1Num, term2Num;
224 int32 z;
226 term2Num = sequencePtr->term2Num;
227 term1Num = sequencePtr->term1Num;
228 z = int32P1[ term1Num ] + int32P1[ term2Num ];
229 ++term2Num;
230 if ( int32NumP1 <= term2Num ) {
231 ++term1Num;
232 if ( int32NumP1 <= term1Num ) {
233 term1Num = 0;
234 sequencePtr->done = TRUE;
236 term2Num = term1Num;
237 sequencePtr->term1Num = term1Num;
239 sequencePtr->term2Num = term2Num;
240 return (sbits32) z;
244 static int32 int32RandomP3( void )
247 return
248 (sbits32) (
249 int32P1[ randomUint8() % int32NumP1 ]
250 + int32P1[ randomUint8() % int32NumP1 ]
251 + int32P1[ randomUint8() % int32NumP1 ]
256 enum {
257 int32NumPInfWeightMasks = 29
260 static const uint32 int32PInfWeightMasks[ int32NumPInfWeightMasks ] = {
261 0xFFFFFFFF,
262 0x7FFFFFFF,
263 0x3FFFFFFF,
264 0x1FFFFFFF,
265 0x0FFFFFFF,
266 0x07FFFFFF,
267 0x03FFFFFF,
268 0x01FFFFFF,
269 0x00FFFFFF,
270 0x007FFFFF,
271 0x003FFFFF,
272 0x001FFFFF,
273 0x000FFFFF,
274 0x0007FFFF,
275 0x0003FFFF,
276 0x0001FFFF,
277 0x0000FFFF,
278 0x00007FFF,
279 0x00003FFF,
280 0x00001FFF,
281 0x00000FFF,
282 0x000007FF,
283 0x000003FF,
284 0x000001FF,
285 0x000000FF,
286 0x0000007F,
287 0x0000003F,
288 0x0000001F,
289 0x0000000F
292 static const uint32 int32PInfWeightOffsets[ int32NumPInfWeightMasks ] = {
293 0x00000000,
294 0xC0000000,
295 0xE0000000,
296 0xF0000000,
297 0xF8000000,
298 0xFC000000,
299 0xFE000000,
300 0xFF000000,
301 0xFF800000,
302 0xFFC00000,
303 0xFFE00000,
304 0xFFF00000,
305 0xFFF80000,
306 0xFFFC0000,
307 0xFFFE0000,
308 0xFFFF0000,
309 0xFFFF8000,
310 0xFFFFC000,
311 0xFFFFE000,
312 0xFFFFF000,
313 0xFFFFF800,
314 0xFFFFFC00,
315 0xFFFFFE00,
316 0xFFFFFF00,
317 0xFFFFFF80,
318 0xFFFFFFC0,
319 0xFFFFFFE0,
320 0xFFFFFFF0,
321 0xFFFFFFF8
324 static int32 int32RandomPInf( void )
326 int8 weightMaskNum;
328 weightMaskNum = randomUint8() % int32NumPInfWeightMasks;
329 return
330 (sbits32) (
331 ( randomUint32() & int32PInfWeightMasks[ weightMaskNum ] )
332 + int32PInfWeightOffsets[ weightMaskNum ]
337 #ifdef BITS64
339 enum {
340 int64NumP1 = 252
343 static const uint64 int64P1[ int64NumP1 ] = {
344 LIT64( 0x0000000000000000 ),
345 LIT64( 0x0000000000000001 ),
346 LIT64( 0x0000000000000002 ),
347 LIT64( 0x0000000000000004 ),
348 LIT64( 0x0000000000000008 ),
349 LIT64( 0x0000000000000010 ),
350 LIT64( 0x0000000000000020 ),
351 LIT64( 0x0000000000000040 ),
352 LIT64( 0x0000000000000080 ),
353 LIT64( 0x0000000000000100 ),
354 LIT64( 0x0000000000000200 ),
355 LIT64( 0x0000000000000400 ),
356 LIT64( 0x0000000000000800 ),
357 LIT64( 0x0000000000001000 ),
358 LIT64( 0x0000000000002000 ),
359 LIT64( 0x0000000000004000 ),
360 LIT64( 0x0000000000008000 ),
361 LIT64( 0x0000000000010000 ),
362 LIT64( 0x0000000000020000 ),
363 LIT64( 0x0000000000040000 ),
364 LIT64( 0x0000000000080000 ),
365 LIT64( 0x0000000000100000 ),
366 LIT64( 0x0000000000200000 ),
367 LIT64( 0x0000000000400000 ),
368 LIT64( 0x0000000000800000 ),
369 LIT64( 0x0000000001000000 ),
370 LIT64( 0x0000000002000000 ),
371 LIT64( 0x0000000004000000 ),
372 LIT64( 0x0000000008000000 ),
373 LIT64( 0x0000000010000000 ),
374 LIT64( 0x0000000020000000 ),
375 LIT64( 0x0000000040000000 ),
376 LIT64( 0x0000000080000000 ),
377 LIT64( 0x0000000100000000 ),
378 LIT64( 0x0000000200000000 ),
379 LIT64( 0x0000000400000000 ),
380 LIT64( 0x0000000800000000 ),
381 LIT64( 0x0000001000000000 ),
382 LIT64( 0x0000002000000000 ),
383 LIT64( 0x0000004000000000 ),
384 LIT64( 0x0000008000000000 ),
385 LIT64( 0x0000010000000000 ),
386 LIT64( 0x0000020000000000 ),
387 LIT64( 0x0000040000000000 ),
388 LIT64( 0x0000080000000000 ),
389 LIT64( 0x0000100000000000 ),
390 LIT64( 0x0000200000000000 ),
391 LIT64( 0x0000400000000000 ),
392 LIT64( 0x0000800000000000 ),
393 LIT64( 0x0001000000000000 ),
394 LIT64( 0x0002000000000000 ),
395 LIT64( 0x0004000000000000 ),
396 LIT64( 0x0008000000000000 ),
397 LIT64( 0x0010000000000000 ),
398 LIT64( 0x0020000000000000 ),
399 LIT64( 0x0040000000000000 ),
400 LIT64( 0x0080000000000000 ),
401 LIT64( 0x0100000000000000 ),
402 LIT64( 0x0200000000000000 ),
403 LIT64( 0x0400000000000000 ),
404 LIT64( 0x0800000000000000 ),
405 LIT64( 0x1000000000000000 ),
406 LIT64( 0x2000000000000000 ),
407 LIT64( 0x4000000000000000 ),
408 LIT64( 0x8000000000000000 ),
409 LIT64( 0xC000000000000000 ),
410 LIT64( 0xE000000000000000 ),
411 LIT64( 0xF000000000000000 ),
412 LIT64( 0xF800000000000000 ),
413 LIT64( 0xFC00000000000000 ),
414 LIT64( 0xFE00000000000000 ),
415 LIT64( 0xFF00000000000000 ),
416 LIT64( 0xFF80000000000000 ),
417 LIT64( 0xFFC0000000000000 ),
418 LIT64( 0xFFE0000000000000 ),
419 LIT64( 0xFFF0000000000000 ),
420 LIT64( 0xFFF8000000000000 ),
421 LIT64( 0xFFFC000000000000 ),
422 LIT64( 0xFFFE000000000000 ),
423 LIT64( 0xFFFF000000000000 ),
424 LIT64( 0xFFFF800000000000 ),
425 LIT64( 0xFFFFC00000000000 ),
426 LIT64( 0xFFFFE00000000000 ),
427 LIT64( 0xFFFFF00000000000 ),
428 LIT64( 0xFFFFF80000000000 ),
429 LIT64( 0xFFFFFC0000000000 ),
430 LIT64( 0xFFFFFE0000000000 ),
431 LIT64( 0xFFFFFF0000000000 ),
432 LIT64( 0xFFFFFF8000000000 ),
433 LIT64( 0xFFFFFFC000000000 ),
434 LIT64( 0xFFFFFFE000000000 ),
435 LIT64( 0xFFFFFFF000000000 ),
436 LIT64( 0xFFFFFFF800000000 ),
437 LIT64( 0xFFFFFFFC00000000 ),
438 LIT64( 0xFFFFFFFE00000000 ),
439 LIT64( 0xFFFFFFFF00000000 ),
440 LIT64( 0xFFFFFFFF80000000 ),
441 LIT64( 0xFFFFFFFFC0000000 ),
442 LIT64( 0xFFFFFFFFE0000000 ),
443 LIT64( 0xFFFFFFFFF0000000 ),
444 LIT64( 0xFFFFFFFFF8000000 ),
445 LIT64( 0xFFFFFFFFFC000000 ),
446 LIT64( 0xFFFFFFFFFE000000 ),
447 LIT64( 0xFFFFFFFFFF000000 ),
448 LIT64( 0xFFFFFFFFFF800000 ),
449 LIT64( 0xFFFFFFFFFFC00000 ),
450 LIT64( 0xFFFFFFFFFFE00000 ),
451 LIT64( 0xFFFFFFFFFFF00000 ),
452 LIT64( 0xFFFFFFFFFFF80000 ),
453 LIT64( 0xFFFFFFFFFFFC0000 ),
454 LIT64( 0xFFFFFFFFFFFE0000 ),
455 LIT64( 0xFFFFFFFFFFFF0000 ),
456 LIT64( 0xFFFFFFFFFFFF8000 ),
457 LIT64( 0xFFFFFFFFFFFFC000 ),
458 LIT64( 0xFFFFFFFFFFFFE000 ),
459 LIT64( 0xFFFFFFFFFFFFF000 ),
460 LIT64( 0xFFFFFFFFFFFFF800 ),
461 LIT64( 0xFFFFFFFFFFFFFC00 ),
462 LIT64( 0xFFFFFFFFFFFFFE00 ),
463 LIT64( 0xFFFFFFFFFFFFFF00 ),
464 LIT64( 0xFFFFFFFFFFFFFF80 ),
465 LIT64( 0xFFFFFFFFFFFFFFC0 ),
466 LIT64( 0xFFFFFFFFFFFFFFE0 ),
467 LIT64( 0xFFFFFFFFFFFFFFF0 ),
468 LIT64( 0xFFFFFFFFFFFFFFF8 ),
469 LIT64( 0xFFFFFFFFFFFFFFFC ),
470 LIT64( 0xFFFFFFFFFFFFFFFE ),
471 LIT64( 0xFFFFFFFFFFFFFFFF ),
472 LIT64( 0xFFFFFFFFFFFFFFFD ),
473 LIT64( 0xFFFFFFFFFFFFFFFB ),
474 LIT64( 0xFFFFFFFFFFFFFFF7 ),
475 LIT64( 0xFFFFFFFFFFFFFFEF ),
476 LIT64( 0xFFFFFFFFFFFFFFDF ),
477 LIT64( 0xFFFFFFFFFFFFFFBF ),
478 LIT64( 0xFFFFFFFFFFFFFF7F ),
479 LIT64( 0xFFFFFFFFFFFFFEFF ),
480 LIT64( 0xFFFFFFFFFFFFFDFF ),
481 LIT64( 0xFFFFFFFFFFFFFBFF ),
482 LIT64( 0xFFFFFFFFFFFFF7FF ),
483 LIT64( 0xFFFFFFFFFFFFEFFF ),
484 LIT64( 0xFFFFFFFFFFFFDFFF ),
485 LIT64( 0xFFFFFFFFFFFFBFFF ),
486 LIT64( 0xFFFFFFFFFFFF7FFF ),
487 LIT64( 0xFFFFFFFFFFFEFFFF ),
488 LIT64( 0xFFFFFFFFFFFDFFFF ),
489 LIT64( 0xFFFFFFFFFFFBFFFF ),
490 LIT64( 0xFFFFFFFFFFF7FFFF ),
491 LIT64( 0xFFFFFFFFFFEFFFFF ),
492 LIT64( 0xFFFFFFFFFFDFFFFF ),
493 LIT64( 0xFFFFFFFFFFBFFFFF ),
494 LIT64( 0xFFFFFFFFFF7FFFFF ),
495 LIT64( 0xFFFFFFFFFEFFFFFF ),
496 LIT64( 0xFFFFFFFFFDFFFFFF ),
497 LIT64( 0xFFFFFFFFFBFFFFFF ),
498 LIT64( 0xFFFFFFFFF7FFFFFF ),
499 LIT64( 0xFFFFFFFFEFFFFFFF ),
500 LIT64( 0xFFFFFFFFDFFFFFFF ),
501 LIT64( 0xFFFFFFFFBFFFFFFF ),
502 LIT64( 0xFFFFFFFF7FFFFFFF ),
503 LIT64( 0xFFFFFFFEFFFFFFFF ),
504 LIT64( 0xFFFFFFFDFFFFFFFF ),
505 LIT64( 0xFFFFFFFBFFFFFFFF ),
506 LIT64( 0xFFFFFFF7FFFFFFFF ),
507 LIT64( 0xFFFFFFEFFFFFFFFF ),
508 LIT64( 0xFFFFFFDFFFFFFFFF ),
509 LIT64( 0xFFFFFFBFFFFFFFFF ),
510 LIT64( 0xFFFFFF7FFFFFFFFF ),
511 LIT64( 0xFFFFFEFFFFFFFFFF ),
512 LIT64( 0xFFFFFDFFFFFFFFFF ),
513 LIT64( 0xFFFFFBFFFFFFFFFF ),
514 LIT64( 0xFFFFF7FFFFFFFFFF ),
515 LIT64( 0xFFFFEFFFFFFFFFFF ),
516 LIT64( 0xFFFFDFFFFFFFFFFF ),
517 LIT64( 0xFFFFBFFFFFFFFFFF ),
518 LIT64( 0xFFFF7FFFFFFFFFFF ),
519 LIT64( 0xFFFEFFFFFFFFFFFF ),
520 LIT64( 0xFFFDFFFFFFFFFFFF ),
521 LIT64( 0xFFFBFFFFFFFFFFFF ),
522 LIT64( 0xFFF7FFFFFFFFFFFF ),
523 LIT64( 0xFFEFFFFFFFFFFFFF ),
524 LIT64( 0xFFDFFFFFFFFFFFFF ),
525 LIT64( 0xFFBFFFFFFFFFFFFF ),
526 LIT64( 0xFF7FFFFFFFFFFFFF ),
527 LIT64( 0xFEFFFFFFFFFFFFFF ),
528 LIT64( 0xFDFFFFFFFFFFFFFF ),
529 LIT64( 0xFBFFFFFFFFFFFFFF ),
530 LIT64( 0xF7FFFFFFFFFFFFFF ),
531 LIT64( 0xEFFFFFFFFFFFFFFF ),
532 LIT64( 0xDFFFFFFFFFFFFFFF ),
533 LIT64( 0xBFFFFFFFFFFFFFFF ),
534 LIT64( 0x7FFFFFFFFFFFFFFF ),
535 LIT64( 0x3FFFFFFFFFFFFFFF ),
536 LIT64( 0x1FFFFFFFFFFFFFFF ),
537 LIT64( 0x0FFFFFFFFFFFFFFF ),
538 LIT64( 0x07FFFFFFFFFFFFFF ),
539 LIT64( 0x03FFFFFFFFFFFFFF ),
540 LIT64( 0x01FFFFFFFFFFFFFF ),
541 LIT64( 0x00FFFFFFFFFFFFFF ),
542 LIT64( 0x007FFFFFFFFFFFFF ),
543 LIT64( 0x003FFFFFFFFFFFFF ),
544 LIT64( 0x001FFFFFFFFFFFFF ),
545 LIT64( 0x000FFFFFFFFFFFFF ),
546 LIT64( 0x0007FFFFFFFFFFFF ),
547 LIT64( 0x0003FFFFFFFFFFFF ),
548 LIT64( 0x0001FFFFFFFFFFFF ),
549 LIT64( 0x0000FFFFFFFFFFFF ),
550 LIT64( 0x00007FFFFFFFFFFF ),
551 LIT64( 0x00003FFFFFFFFFFF ),
552 LIT64( 0x00001FFFFFFFFFFF ),
553 LIT64( 0x00000FFFFFFFFFFF ),
554 LIT64( 0x000007FFFFFFFFFF ),
555 LIT64( 0x000003FFFFFFFFFF ),
556 LIT64( 0x000001FFFFFFFFFF ),
557 LIT64( 0x000000FFFFFFFFFF ),
558 LIT64( 0x0000007FFFFFFFFF ),
559 LIT64( 0x0000003FFFFFFFFF ),
560 LIT64( 0x0000001FFFFFFFFF ),
561 LIT64( 0x0000000FFFFFFFFF ),
562 LIT64( 0x00000007FFFFFFFF ),
563 LIT64( 0x00000003FFFFFFFF ),
564 LIT64( 0x00000001FFFFFFFF ),
565 LIT64( 0x00000000FFFFFFFF ),
566 LIT64( 0x000000007FFFFFFF ),
567 LIT64( 0x000000003FFFFFFF ),
568 LIT64( 0x000000001FFFFFFF ),
569 LIT64( 0x000000000FFFFFFF ),
570 LIT64( 0x0000000007FFFFFF ),
571 LIT64( 0x0000000003FFFFFF ),
572 LIT64( 0x0000000001FFFFFF ),
573 LIT64( 0x0000000000FFFFFF ),
574 LIT64( 0x00000000007FFFFF ),
575 LIT64( 0x00000000003FFFFF ),
576 LIT64( 0x00000000001FFFFF ),
577 LIT64( 0x00000000000FFFFF ),
578 LIT64( 0x000000000007FFFF ),
579 LIT64( 0x000000000003FFFF ),
580 LIT64( 0x000000000001FFFF ),
581 LIT64( 0x000000000000FFFF ),
582 LIT64( 0x0000000000007FFF ),
583 LIT64( 0x0000000000003FFF ),
584 LIT64( 0x0000000000001FFF ),
585 LIT64( 0x0000000000000FFF ),
586 LIT64( 0x00000000000007FF ),
587 LIT64( 0x00000000000003FF ),
588 LIT64( 0x00000000000001FF ),
589 LIT64( 0x00000000000000FF ),
590 LIT64( 0x000000000000007F ),
591 LIT64( 0x000000000000003F ),
592 LIT64( 0x000000000000001F ),
593 LIT64( 0x000000000000000F ),
594 LIT64( 0x0000000000000007 ),
595 LIT64( 0x0000000000000003 )
598 static int64 int64NextP1( sequenceT *sequencePtr )
600 uint8 termNum;
601 int64 z;
603 termNum = sequencePtr->term1Num;
604 z = int64P1[ termNum ];
605 ++termNum;
606 if ( int64NumP1 <= termNum ) {
607 termNum = 0;
608 sequencePtr->done = TRUE;
610 sequencePtr->term1Num = termNum;
611 return (sbits64) z;
615 static const int64 int64NumP2 = ( int64NumP1 * int64NumP1 + int64NumP1 ) / 2;
617 static int64 int64NextP2( sequenceT *sequencePtr )
619 uint8 term1Num, term2Num;
620 int64 z;
622 term2Num = sequencePtr->term2Num;
623 term1Num = sequencePtr->term1Num;
624 z = int64P1[ term1Num ] + int64P1[ term2Num ];
625 ++term2Num;
626 if ( int64NumP1 <= term2Num ) {
627 ++term1Num;
628 if ( int64NumP1 <= term1Num ) {
629 term1Num = 0;
630 sequencePtr->done = TRUE;
632 term2Num = term1Num;
633 sequencePtr->term1Num = term1Num;
635 sequencePtr->term2Num = term2Num;
636 return (sbits64) z;
640 static int64 int64RandomP3( void )
643 return
644 (sbits64) (
645 int64P1[ randomUint8() % int64NumP1 ]
646 + int64P1[ randomUint8() % int64NumP1 ]
647 + int64P1[ randomUint8() % int64NumP1 ]
652 enum {
653 int64NumPInfWeightMasks = 61
656 static const uint64 int64PInfWeightMasks[ int64NumPInfWeightMasks ] = {
657 LIT64( 0xFFFFFFFFFFFFFFFF ),
658 LIT64( 0x7FFFFFFFFFFFFFFF ),
659 LIT64( 0x3FFFFFFFFFFFFFFF ),
660 LIT64( 0x1FFFFFFFFFFFFFFF ),
661 LIT64( 0x0FFFFFFFFFFFFFFF ),
662 LIT64( 0x07FFFFFFFFFFFFFF ),
663 LIT64( 0x03FFFFFFFFFFFFFF ),
664 LIT64( 0x01FFFFFFFFFFFFFF ),
665 LIT64( 0x00FFFFFFFFFFFFFF ),
666 LIT64( 0x007FFFFFFFFFFFFF ),
667 LIT64( 0x003FFFFFFFFFFFFF ),
668 LIT64( 0x001FFFFFFFFFFFFF ),
669 LIT64( 0x000FFFFFFFFFFFFF ),
670 LIT64( 0x0007FFFFFFFFFFFF ),
671 LIT64( 0x0003FFFFFFFFFFFF ),
672 LIT64( 0x0001FFFFFFFFFFFF ),
673 LIT64( 0x0000FFFFFFFFFFFF ),
674 LIT64( 0x00007FFFFFFFFFFF ),
675 LIT64( 0x00003FFFFFFFFFFF ),
676 LIT64( 0x00001FFFFFFFFFFF ),
677 LIT64( 0x00000FFFFFFFFFFF ),
678 LIT64( 0x000007FFFFFFFFFF ),
679 LIT64( 0x000003FFFFFFFFFF ),
680 LIT64( 0x000001FFFFFFFFFF ),
681 LIT64( 0x000000FFFFFFFFFF ),
682 LIT64( 0x0000007FFFFFFFFF ),
683 LIT64( 0x0000003FFFFFFFFF ),
684 LIT64( 0x0000001FFFFFFFFF ),
685 LIT64( 0x0000000FFFFFFFFF ),
686 LIT64( 0x00000007FFFFFFFF ),
687 LIT64( 0x00000003FFFFFFFF ),
688 LIT64( 0x00000001FFFFFFFF ),
689 LIT64( 0x00000000FFFFFFFF ),
690 LIT64( 0x000000007FFFFFFF ),
691 LIT64( 0x000000003FFFFFFF ),
692 LIT64( 0x000000001FFFFFFF ),
693 LIT64( 0x000000000FFFFFFF ),
694 LIT64( 0x0000000007FFFFFF ),
695 LIT64( 0x0000000003FFFFFF ),
696 LIT64( 0x0000000001FFFFFF ),
697 LIT64( 0x0000000000FFFFFF ),
698 LIT64( 0x00000000007FFFFF ),
699 LIT64( 0x00000000003FFFFF ),
700 LIT64( 0x00000000001FFFFF ),
701 LIT64( 0x00000000000FFFFF ),
702 LIT64( 0x000000000007FFFF ),
703 LIT64( 0x000000000003FFFF ),
704 LIT64( 0x000000000001FFFF ),
705 LIT64( 0x000000000000FFFF ),
706 LIT64( 0x0000000000007FFF ),
707 LIT64( 0x0000000000003FFF ),
708 LIT64( 0x0000000000001FFF ),
709 LIT64( 0x0000000000000FFF ),
710 LIT64( 0x00000000000007FF ),
711 LIT64( 0x00000000000003FF ),
712 LIT64( 0x00000000000001FF ),
713 LIT64( 0x00000000000000FF ),
714 LIT64( 0x000000000000007F ),
715 LIT64( 0x000000000000003F ),
716 LIT64( 0x000000000000001F ),
717 LIT64( 0x000000000000000F )
720 static const uint64 int64PInfWeightOffsets[ int64NumPInfWeightMasks ] = {
721 LIT64( 0x0000000000000000 ),
722 LIT64( 0xC000000000000000 ),
723 LIT64( 0xE000000000000000 ),
724 LIT64( 0xF000000000000000 ),
725 LIT64( 0xF800000000000000 ),
726 LIT64( 0xFC00000000000000 ),
727 LIT64( 0xFE00000000000000 ),
728 LIT64( 0xFF00000000000000 ),
729 LIT64( 0xFF80000000000000 ),
730 LIT64( 0xFFC0000000000000 ),
731 LIT64( 0xFFE0000000000000 ),
732 LIT64( 0xFFF0000000000000 ),
733 LIT64( 0xFFF8000000000000 ),
734 LIT64( 0xFFFC000000000000 ),
735 LIT64( 0xFFFE000000000000 ),
736 LIT64( 0xFFFF000000000000 ),
737 LIT64( 0xFFFF800000000000 ),
738 LIT64( 0xFFFFC00000000000 ),
739 LIT64( 0xFFFFE00000000000 ),
740 LIT64( 0xFFFFF00000000000 ),
741 LIT64( 0xFFFFF80000000000 ),
742 LIT64( 0xFFFFFC0000000000 ),
743 LIT64( 0xFFFFFE0000000000 ),
744 LIT64( 0xFFFFFF0000000000 ),
745 LIT64( 0xFFFFFF8000000000 ),
746 LIT64( 0xFFFFFFC000000000 ),
747 LIT64( 0xFFFFFFE000000000 ),
748 LIT64( 0xFFFFFFF000000000 ),
749 LIT64( 0xFFFFFFF800000000 ),
750 LIT64( 0xFFFFFFFC00000000 ),
751 LIT64( 0xFFFFFFFE00000000 ),
752 LIT64( 0xFFFFFFFF00000000 ),
753 LIT64( 0xFFFFFFFF80000000 ),
754 LIT64( 0xFFFFFFFFC0000000 ),
755 LIT64( 0xFFFFFFFFE0000000 ),
756 LIT64( 0xFFFFFFFFF0000000 ),
757 LIT64( 0xFFFFFFFFF8000000 ),
758 LIT64( 0xFFFFFFFFFC000000 ),
759 LIT64( 0xFFFFFFFFFE000000 ),
760 LIT64( 0xFFFFFFFFFF000000 ),
761 LIT64( 0xFFFFFFFFFF800000 ),
762 LIT64( 0xFFFFFFFFFFC00000 ),
763 LIT64( 0xFFFFFFFFFFE00000 ),
764 LIT64( 0xFFFFFFFFFFF00000 ),
765 LIT64( 0xFFFFFFFFFFF80000 ),
766 LIT64( 0xFFFFFFFFFFFC0000 ),
767 LIT64( 0xFFFFFFFFFFFE0000 ),
768 LIT64( 0xFFFFFFFFFFFF0000 ),
769 LIT64( 0xFFFFFFFFFFFF8000 ),
770 LIT64( 0xFFFFFFFFFFFFC000 ),
771 LIT64( 0xFFFFFFFFFFFFE000 ),
772 LIT64( 0xFFFFFFFFFFFFF000 ),
773 LIT64( 0xFFFFFFFFFFFFF800 ),
774 LIT64( 0xFFFFFFFFFFFFFC00 ),
775 LIT64( 0xFFFFFFFFFFFFFE00 ),
776 LIT64( 0xFFFFFFFFFFFFFF00 ),
777 LIT64( 0xFFFFFFFFFFFFFF80 ),
778 LIT64( 0xFFFFFFFFFFFFFFC0 ),
779 LIT64( 0xFFFFFFFFFFFFFFE0 ),
780 LIT64( 0xFFFFFFFFFFFFFFF0 ),
781 LIT64( 0xFFFFFFFFFFFFFFF8 )
784 static int64 int64RandomPInf( void )
786 int8 weightMaskNum;
788 weightMaskNum = randomUint8() % int64NumPInfWeightMasks;
789 return
790 (sbits64) (
791 ( randomUint64() & int64PInfWeightMasks[ weightMaskNum ] )
792 + int64PInfWeightOffsets[ weightMaskNum ]
797 #endif
799 enum {
800 float32NumQIn = 22,
801 float32NumQOut = 50,
802 float32NumP1 = 4,
803 float32NumP2 = 88
806 static const uint32 float32QIn[ float32NumQIn ] = {
807 0x00000000, /* positive, subnormal */
808 0x00800000, /* positive, -126 */
809 0x33800000, /* positive, -24 */
810 0x3E800000, /* positive, -2 */
811 0x3F000000, /* positive, -1 */
812 0x3F800000, /* positive, 0 */
813 0x40000000, /* positive, 1 */
814 0x40800000, /* positive, 2 */
815 0x4B800000, /* positive, 24 */
816 0x7F000000, /* positive, 127 */
817 0x7F800000, /* positive, infinity or NaN */
818 0x80000000, /* negative, subnormal */
819 0x80800000, /* negative, -126 */
820 0xB3800000, /* negative, -24 */
821 0xBE800000, /* negative, -2 */
822 0xBF000000, /* negative, -1 */
823 0xBF800000, /* negative, 0 */
824 0xC0000000, /* negative, 1 */
825 0xC0800000, /* negative, 2 */
826 0xCB800000, /* negative, 24 */
827 0xFE800000, /* negative, 126 */
828 0xFF800000 /* negative, infinity or NaN */
831 static const uint32 float32QOut[ float32NumQOut ] = {
832 0x00000000, /* positive, subnormal */
833 0x00800000, /* positive, -126 */
834 0x01000000, /* positive, -125 */
835 0x33800000, /* positive, -24 */
836 0x3D800000, /* positive, -4 */
837 0x3E000000, /* positive, -3 */
838 0x3E800000, /* positive, -2 */
839 0x3F000000, /* positive, -1 */
840 0x3F800000, /* positive, 0 */
841 0x40000000, /* positive, 1 */
842 0x40800000, /* positive, 2 */
843 0x41000000, /* positive, 3 */
844 0x41800000, /* positive, 4 */
845 0x4B800000, /* positive, 24 */
846 0x4E000000, /* positive, 29 */
847 0x4E800000, /* positive, 30 */
848 0x4F000000, /* positive, 31 */
849 0x4F800000, /* positive, 32 */
850 0x5E000000, /* positive, 61 */
851 0x5E800000, /* positive, 62 */
852 0x5F000000, /* positive, 63 */
853 0x5F800000, /* positive, 64 */
854 0x7E800000, /* positive, 126 */
855 0x7F000000, /* positive, 127 */
856 0x7F800000, /* positive, infinity or NaN */
857 0x80000000, /* negative, subnormal */
858 0x80800000, /* negative, -126 */
859 0x81000000, /* negative, -125 */
860 0xB3800000, /* negative, -24 */
861 0xBD800000, /* negative, -4 */
862 0xBE000000, /* negative, -3 */
863 0xBE800000, /* negative, -2 */
864 0xBF000000, /* negative, -1 */
865 0xBF800000, /* negative, 0 */
866 0xC0000000, /* negative, 1 */
867 0xC0800000, /* negative, 2 */
868 0xC1000000, /* negative, 3 */
869 0xC1800000, /* negative, 4 */
870 0xCB800000, /* negative, 24 */
871 0xCE000000, /* negative, 29 */
872 0xCE800000, /* negative, 30 */
873 0xCF000000, /* negative, 31 */
874 0xCF800000, /* negative, 32 */
875 0xDE000000, /* negative, 61 */
876 0xDE800000, /* negative, 62 */
877 0xDF000000, /* negative, 63 */
878 0xDF800000, /* negative, 64 */
879 0xFE800000, /* negative, 126 */
880 0xFF000000, /* negative, 127 */
881 0xFF800000 /* negative, infinity or NaN */
884 static const uint32 float32P1[ float32NumP1 ] = {
885 0x00000000,
886 0x00000001,
887 0x007FFFFF,
888 0x007FFFFE
891 static const uint32 float32P2[ float32NumP2 ] = {
892 0x00000000,
893 0x00000001,
894 0x00000002,
895 0x00000004,
896 0x00000008,
897 0x00000010,
898 0x00000020,
899 0x00000040,
900 0x00000080,
901 0x00000100,
902 0x00000200,
903 0x00000400,
904 0x00000800,
905 0x00001000,
906 0x00002000,
907 0x00004000,
908 0x00008000,
909 0x00010000,
910 0x00020000,
911 0x00040000,
912 0x00080000,
913 0x00100000,
914 0x00200000,
915 0x00400000,
916 0x00600000,
917 0x00700000,
918 0x00780000,
919 0x007C0000,
920 0x007E0000,
921 0x007F0000,
922 0x007F8000,
923 0x007FC000,
924 0x007FE000,
925 0x007FF000,
926 0x007FF800,
927 0x007FFC00,
928 0x007FFE00,
929 0x007FFF00,
930 0x007FFF80,
931 0x007FFFC0,
932 0x007FFFE0,
933 0x007FFFF0,
934 0x007FFFF8,
935 0x007FFFFC,
936 0x007FFFFE,
937 0x007FFFFF,
938 0x007FFFFD,
939 0x007FFFFB,
940 0x007FFFF7,
941 0x007FFFEF,
942 0x007FFFDF,
943 0x007FFFBF,
944 0x007FFF7F,
945 0x007FFEFF,
946 0x007FFDFF,
947 0x007FFBFF,
948 0x007FF7FF,
949 0x007FEFFF,
950 0x007FDFFF,
951 0x007FBFFF,
952 0x007F7FFF,
953 0x007EFFFF,
954 0x007DFFFF,
955 0x007BFFFF,
956 0x0077FFFF,
957 0x006FFFFF,
958 0x005FFFFF,
959 0x003FFFFF,
960 0x001FFFFF,
961 0x000FFFFF,
962 0x0007FFFF,
963 0x0003FFFF,
964 0x0001FFFF,
965 0x0000FFFF,
966 0x00007FFF,
967 0x00003FFF,
968 0x00001FFF,
969 0x00000FFF,
970 0x000007FF,
971 0x000003FF,
972 0x000001FF,
973 0x000000FF,
974 0x0000007F,
975 0x0000003F,
976 0x0000001F,
977 0x0000000F,
978 0x00000007,
979 0x00000003
982 static const uint32 float32NumQInP1 = float32NumQIn * float32NumP1;
983 static const uint32 float32NumQOutP1 = float32NumQOut * float32NumP1;
985 static float32 float32NextQInP1( sequenceT *sequencePtr )
987 uint8 expNum, sigNum;
988 float32 z;
990 sigNum = sequencePtr->term1Num;
991 expNum = sequencePtr->expNum;
992 z = float32QIn[ expNum ] | float32P1[ sigNum ];
993 ++sigNum;
994 if ( float32NumP1 <= sigNum ) {
995 sigNum = 0;
996 ++expNum;
997 if ( float32NumQIn <= expNum ) {
998 expNum = 0;
999 sequencePtr->done = TRUE;
1001 sequencePtr->expNum = expNum;
1003 sequencePtr->term1Num = sigNum;
1004 return z;
1008 static float32 float32NextQOutP1( sequenceT *sequencePtr )
1010 uint8 expNum, sigNum;
1011 float32 z;
1013 sigNum = sequencePtr->term1Num;
1014 expNum = sequencePtr->expNum;
1015 z = float32QOut[ expNum ] | float32P1[ sigNum ];
1016 ++sigNum;
1017 if ( float32NumP1 <= sigNum ) {
1018 sigNum = 0;
1019 ++expNum;
1020 if ( float32NumQOut <= expNum ) {
1021 expNum = 0;
1022 sequencePtr->done = TRUE;
1024 sequencePtr->expNum = expNum;
1026 sequencePtr->term1Num = sigNum;
1027 return z;
1031 static const uint32 float32NumQInP2 = float32NumQIn * float32NumP2;
1032 static const uint32 float32NumQOutP2 = float32NumQOut * float32NumP2;
1034 static float32 float32NextQInP2( sequenceT *sequencePtr )
1036 uint8 expNum, sigNum;
1037 float32 z;
1039 sigNum = sequencePtr->term1Num;
1040 expNum = sequencePtr->expNum;
1041 z = float32QIn[ expNum ] | float32P2[ sigNum ];
1042 ++sigNum;
1043 if ( float32NumP2 <= sigNum ) {
1044 sigNum = 0;
1045 ++expNum;
1046 if ( float32NumQIn <= expNum ) {
1047 expNum = 0;
1048 sequencePtr->done = TRUE;
1050 sequencePtr->expNum = expNum;
1052 sequencePtr->term1Num = sigNum;
1053 return z;
1057 static float32 float32NextQOutP2( sequenceT *sequencePtr )
1059 uint8 expNum, sigNum;
1060 float32 z;
1062 sigNum = sequencePtr->term1Num;
1063 expNum = sequencePtr->expNum;
1064 z = float32QOut[ expNum ] | float32P2[ sigNum ];
1065 ++sigNum;
1066 if ( float32NumP2 <= sigNum ) {
1067 sigNum = 0;
1068 ++expNum;
1069 if ( float32NumQOut <= expNum ) {
1070 expNum = 0;
1071 sequencePtr->done = TRUE;
1073 sequencePtr->expNum = expNum;
1075 sequencePtr->term1Num = sigNum;
1076 return z;
1080 static float32 float32RandomQOutP3( void )
1083 return
1084 float32QOut[ randomUint8() % float32NumQOut ]
1085 | ( ( float32P2[ randomUint8() % float32NumP2 ]
1086 + float32P2[ randomUint8() % float32NumP2 ] )
1087 & 0x007FFFFF );
1091 static float32 float32RandomQOutPInf( void )
1094 return
1095 float32QOut[ randomUint8() % float32NumQOut ]
1096 | ( randomUint32() & 0x007FFFFF );
1100 enum {
1101 float32NumQInfWeightMasks = 7
1104 static const uint32 float32QInfWeightMasks[ float32NumQInfWeightMasks ] = {
1105 0x7F800000,
1106 0x7F800000,
1107 0x3F800000,
1108 0x1F800000,
1109 0x0F800000,
1110 0x07800000,
1111 0x03800000
1114 static const uint32 float32QInfWeightOffsets[ float32NumQInfWeightMasks ] = {
1115 0x00000000,
1116 0x00000000,
1117 0x20000000,
1118 0x30000000,
1119 0x38000000,
1120 0x3C000000,
1121 0x3E000000
1124 static float32 float32RandomQInfP3( void )
1126 int8 weightMaskNum;
1128 weightMaskNum = randomUint8() % float32NumQInfWeightMasks;
1129 return
1130 ( ( (uint32) ( randomUint8() & 1 ) )<<31 )
1131 | ( ( ( ( (uint32) ( randomUint16() & 0x1FF ) )<<23 )
1132 & float32QInfWeightMasks[ weightMaskNum ] )
1133 + float32QInfWeightOffsets[ weightMaskNum ]
1135 | ( ( float32P2[ randomUint8() % float32NumP2 ]
1136 + float32P2[ randomUint8() % float32NumP2 ] )
1137 & 0x007FFFFF );
1141 static float32 float32RandomQInfPInf( void )
1143 int8 weightMaskNum;
1145 weightMaskNum = randomUint8() % float32NumQInfWeightMasks;
1146 return
1147 ( ( (uint32) ( randomUint8() & 1 ) )<<31 )
1148 | ( ( ( ( (uint32) ( randomUint16() & 0x1FF ) )<<23 )
1149 & float32QInfWeightMasks[ weightMaskNum ] )
1150 + float32QInfWeightOffsets[ weightMaskNum ]
1152 | ( randomUint32() & 0x007FFFFF );
1156 static float32 float32Random( void )
1159 switch ( randomUint8() & 7 ) {
1160 case 0:
1161 case 1:
1162 case 2:
1163 return float32RandomQOutP3();
1164 case 3:
1165 return float32RandomQOutPInf();
1166 case 4:
1167 case 5:
1168 case 6:
1169 return float32RandomQInfP3();
1170 case 7:
1171 return float32RandomQInfPInf();
1173 abort();
1174 return 0;
1177 #ifdef BITS64
1178 #define SETFLOAT64( z, zHigh, zLow ) z = ( ( (float64) zHigh )<<32 ) | zLow
1179 #else
1180 #define SETFLOAT64( z, zHigh, zLow ) z.low = zLow; z.high = zHigh
1181 #endif
1183 enum {
1184 float64NumQIn = 22,
1185 float64NumQOut = 64,
1186 float64NumP1 = 4,
1187 float64NumP2 = 204
1190 static const uint32 float64QIn[ float64NumQIn ] = {
1191 0x00000000, /* positive, subnormal */
1192 0x00100000, /* positive, -1022 */
1193 0x3CA00000, /* positive, -53 */
1194 0x3FD00000, /* positive, -2 */
1195 0x3FE00000, /* positive, -1 */
1196 0x3FF00000, /* positive, 0 */
1197 0x40000000, /* positive, 1 */
1198 0x40100000, /* positive, 2 */
1199 0x43400000, /* positive, 53 */
1200 0x7FE00000, /* positive, 1023 */
1201 0x7FF00000, /* positive, infinity or NaN */
1202 0x80000000, /* negative, subnormal */
1203 0x80100000, /* negative, -1022 */
1204 0xBCA00000, /* negative, -53 */
1205 0xBFD00000, /* negative, -2 */
1206 0xBFE00000, /* negative, -1 */
1207 0xBFF00000, /* negative, 0 */
1208 0xC0000000, /* negative, 1 */
1209 0xC0100000, /* negative, 2 */
1210 0xC3400000, /* negative, 53 */
1211 0xFFE00000, /* negative, 1023 */
1212 0xFFF00000 /* negative, infinity or NaN */
1215 static const uint32 float64QOut[ float64NumQOut ] = {
1216 0x00000000, /* positive, subnormal */
1217 0x00100000, /* positive, -1022 */
1218 0x00200000, /* positive, -1021 */
1219 0x37E00000, /* positive, -129 */
1220 0x37F00000, /* positive, -128 */
1221 0x38000000, /* positive, -127 */
1222 0x38100000, /* positive, -126 */
1223 0x3CA00000, /* positive, -53 */
1224 0x3FB00000, /* positive, -4 */
1225 0x3FC00000, /* positive, -3 */
1226 0x3FD00000, /* positive, -2 */
1227 0x3FE00000, /* positive, -1 */
1228 0x3FF00000, /* positive, 0 */
1229 0x40000000, /* positive, 1 */
1230 0x40100000, /* positive, 2 */
1231 0x40200000, /* positive, 3 */
1232 0x40300000, /* positive, 4 */
1233 0x41C00000, /* positive, 29 */
1234 0x41D00000, /* positive, 30 */
1235 0x41E00000, /* positive, 31 */
1236 0x41F00000, /* positive, 32 */
1237 0x43400000, /* positive, 53 */
1238 0x43C00000, /* positive, 61 */
1239 0x43D00000, /* positive, 62 */
1240 0x43E00000, /* positive, 63 */
1241 0x43F00000, /* positive, 64 */
1242 0x47E00000, /* positive, 127 */
1243 0x47F00000, /* positive, 128 */
1244 0x48000000, /* positive, 129 */
1245 0x7FD00000, /* positive, 1022 */
1246 0x7FE00000, /* positive, 1023 */
1247 0x7FF00000, /* positive, infinity or NaN */
1248 0x80000000, /* negative, subnormal */
1249 0x80100000, /* negative, -1022 */
1250 0x80200000, /* negative, -1021 */
1251 0xB7E00000, /* negative, -129 */
1252 0xB7F00000, /* negative, -128 */
1253 0xB8000000, /* negative, -127 */
1254 0xB8100000, /* negative, -126 */
1255 0xBCA00000, /* negative, -53 */
1256 0xBFB00000, /* negative, -4 */
1257 0xBFC00000, /* negative, -3 */
1258 0xBFD00000, /* negative, -2 */
1259 0xBFE00000, /* negative, -1 */
1260 0xBFF00000, /* negative, 0 */
1261 0xC0000000, /* negative, 1 */
1262 0xC0100000, /* negative, 2 */
1263 0xC0200000, /* negative, 3 */
1264 0xC0300000, /* negative, 4 */
1265 0xC1C00000, /* negative, 29 */
1266 0xC1D00000, /* negative, 30 */
1267 0xC1E00000, /* negative, 31 */
1268 0xC1F00000, /* negative, 32 */
1269 0xC3400000, /* negative, 53 */
1270 0xC3C00000, /* negative, 61 */
1271 0xC3D00000, /* negative, 62 */
1272 0xC3E00000, /* negative, 63 */
1273 0xC3F00000, /* negative, 64 */
1274 0xC7E00000, /* negative, 127 */
1275 0xC7F00000, /* negative, 128 */
1276 0xC8000000, /* negative, 129 */
1277 0xFFD00000, /* negative, 1022 */
1278 0xFFE00000, /* negative, 1023 */
1279 0xFFF00000 /* negative, infinity or NaN */
1282 static const struct { bits32 high, low; } float64P1[ float64NumP1 ] = {
1283 { 0x00000000, 0x00000000 },
1284 { 0x00000000, 0x00000001 },
1285 { 0x000FFFFF, 0xFFFFFFFF },
1286 { 0x000FFFFF, 0xFFFFFFFE }
1289 static const struct { bits32 high, low; } float64P2[ float64NumP2 ] = {
1290 { 0x00000000, 0x00000000 },
1291 { 0x00000000, 0x00000001 },
1292 { 0x00000000, 0x00000002 },
1293 { 0x00000000, 0x00000004 },
1294 { 0x00000000, 0x00000008 },
1295 { 0x00000000, 0x00000010 },
1296 { 0x00000000, 0x00000020 },
1297 { 0x00000000, 0x00000040 },
1298 { 0x00000000, 0x00000080 },
1299 { 0x00000000, 0x00000100 },
1300 { 0x00000000, 0x00000200 },
1301 { 0x00000000, 0x00000400 },
1302 { 0x00000000, 0x00000800 },
1303 { 0x00000000, 0x00001000 },
1304 { 0x00000000, 0x00002000 },
1305 { 0x00000000, 0x00004000 },
1306 { 0x00000000, 0x00008000 },
1307 { 0x00000000, 0x00010000 },
1308 { 0x00000000, 0x00020000 },
1309 { 0x00000000, 0x00040000 },
1310 { 0x00000000, 0x00080000 },
1311 { 0x00000000, 0x00100000 },
1312 { 0x00000000, 0x00200000 },
1313 { 0x00000000, 0x00400000 },
1314 { 0x00000000, 0x00800000 },
1315 { 0x00000000, 0x01000000 },
1316 { 0x00000000, 0x02000000 },
1317 { 0x00000000, 0x04000000 },
1318 { 0x00000000, 0x08000000 },
1319 { 0x00000000, 0x10000000 },
1320 { 0x00000000, 0x20000000 },
1321 { 0x00000000, 0x40000000 },
1322 { 0x00000000, 0x80000000 },
1323 { 0x00000001, 0x00000000 },
1324 { 0x00000002, 0x00000000 },
1325 { 0x00000004, 0x00000000 },
1326 { 0x00000008, 0x00000000 },
1327 { 0x00000010, 0x00000000 },
1328 { 0x00000020, 0x00000000 },
1329 { 0x00000040, 0x00000000 },
1330 { 0x00000080, 0x00000000 },
1331 { 0x00000100, 0x00000000 },
1332 { 0x00000200, 0x00000000 },
1333 { 0x00000400, 0x00000000 },
1334 { 0x00000800, 0x00000000 },
1335 { 0x00001000, 0x00000000 },
1336 { 0x00002000, 0x00000000 },
1337 { 0x00004000, 0x00000000 },
1338 { 0x00008000, 0x00000000 },
1339 { 0x00010000, 0x00000000 },
1340 { 0x00020000, 0x00000000 },
1341 { 0x00040000, 0x00000000 },
1342 { 0x00080000, 0x00000000 },
1343 { 0x000C0000, 0x00000000 },
1344 { 0x000E0000, 0x00000000 },
1345 { 0x000F0000, 0x00000000 },
1346 { 0x000F8000, 0x00000000 },
1347 { 0x000FC000, 0x00000000 },
1348 { 0x000FE000, 0x00000000 },
1349 { 0x000FF000, 0x00000000 },
1350 { 0x000FF800, 0x00000000 },
1351 { 0x000FFC00, 0x00000000 },
1352 { 0x000FFE00, 0x00000000 },
1353 { 0x000FFF00, 0x00000000 },
1354 { 0x000FFF80, 0x00000000 },
1355 { 0x000FFFC0, 0x00000000 },
1356 { 0x000FFFE0, 0x00000000 },
1357 { 0x000FFFF0, 0x00000000 },
1358 { 0x000FFFF8, 0x00000000 },
1359 { 0x000FFFFC, 0x00000000 },
1360 { 0x000FFFFE, 0x00000000 },
1361 { 0x000FFFFF, 0x00000000 },
1362 { 0x000FFFFF, 0x80000000 },
1363 { 0x000FFFFF, 0xC0000000 },
1364 { 0x000FFFFF, 0xE0000000 },
1365 { 0x000FFFFF, 0xF0000000 },
1366 { 0x000FFFFF, 0xF8000000 },
1367 { 0x000FFFFF, 0xFC000000 },
1368 { 0x000FFFFF, 0xFE000000 },
1369 { 0x000FFFFF, 0xFF000000 },
1370 { 0x000FFFFF, 0xFF800000 },
1371 { 0x000FFFFF, 0xFFC00000 },
1372 { 0x000FFFFF, 0xFFE00000 },
1373 { 0x000FFFFF, 0xFFF00000 },
1374 { 0x000FFFFF, 0xFFF80000 },
1375 { 0x000FFFFF, 0xFFFC0000 },
1376 { 0x000FFFFF, 0xFFFE0000 },
1377 { 0x000FFFFF, 0xFFFF0000 },
1378 { 0x000FFFFF, 0xFFFF8000 },
1379 { 0x000FFFFF, 0xFFFFC000 },
1380 { 0x000FFFFF, 0xFFFFE000 },
1381 { 0x000FFFFF, 0xFFFFF000 },
1382 { 0x000FFFFF, 0xFFFFF800 },
1383 { 0x000FFFFF, 0xFFFFFC00 },
1384 { 0x000FFFFF, 0xFFFFFE00 },
1385 { 0x000FFFFF, 0xFFFFFF00 },
1386 { 0x000FFFFF, 0xFFFFFF80 },
1387 { 0x000FFFFF, 0xFFFFFFC0 },
1388 { 0x000FFFFF, 0xFFFFFFE0 },
1389 { 0x000FFFFF, 0xFFFFFFF0 },
1390 { 0x000FFFFF, 0xFFFFFFF8 },
1391 { 0x000FFFFF, 0xFFFFFFFC },
1392 { 0x000FFFFF, 0xFFFFFFFE },
1393 { 0x000FFFFF, 0xFFFFFFFF },
1394 { 0x000FFFFF, 0xFFFFFFFD },
1395 { 0x000FFFFF, 0xFFFFFFFB },
1396 { 0x000FFFFF, 0xFFFFFFF7 },
1397 { 0x000FFFFF, 0xFFFFFFEF },
1398 { 0x000FFFFF, 0xFFFFFFDF },
1399 { 0x000FFFFF, 0xFFFFFFBF },
1400 { 0x000FFFFF, 0xFFFFFF7F },
1401 { 0x000FFFFF, 0xFFFFFEFF },
1402 { 0x000FFFFF, 0xFFFFFDFF },
1403 { 0x000FFFFF, 0xFFFFFBFF },
1404 { 0x000FFFFF, 0xFFFFF7FF },
1405 { 0x000FFFFF, 0xFFFFEFFF },
1406 { 0x000FFFFF, 0xFFFFDFFF },
1407 { 0x000FFFFF, 0xFFFFBFFF },
1408 { 0x000FFFFF, 0xFFFF7FFF },
1409 { 0x000FFFFF, 0xFFFEFFFF },
1410 { 0x000FFFFF, 0xFFFDFFFF },
1411 { 0x000FFFFF, 0xFFFBFFFF },
1412 { 0x000FFFFF, 0xFFF7FFFF },
1413 { 0x000FFFFF, 0xFFEFFFFF },
1414 { 0x000FFFFF, 0xFFDFFFFF },
1415 { 0x000FFFFF, 0xFFBFFFFF },
1416 { 0x000FFFFF, 0xFF7FFFFF },
1417 { 0x000FFFFF, 0xFEFFFFFF },
1418 { 0x000FFFFF, 0xFDFFFFFF },
1419 { 0x000FFFFF, 0xFBFFFFFF },
1420 { 0x000FFFFF, 0xF7FFFFFF },
1421 { 0x000FFFFF, 0xEFFFFFFF },
1422 { 0x000FFFFF, 0xDFFFFFFF },
1423 { 0x000FFFFF, 0xBFFFFFFF },
1424 { 0x000FFFFF, 0x7FFFFFFF },
1425 { 0x000FFFFE, 0xFFFFFFFF },
1426 { 0x000FFFFD, 0xFFFFFFFF },
1427 { 0x000FFFFB, 0xFFFFFFFF },
1428 { 0x000FFFF7, 0xFFFFFFFF },
1429 { 0x000FFFEF, 0xFFFFFFFF },
1430 { 0x000FFFDF, 0xFFFFFFFF },
1431 { 0x000FFFBF, 0xFFFFFFFF },
1432 { 0x000FFF7F, 0xFFFFFFFF },
1433 { 0x000FFEFF, 0xFFFFFFFF },
1434 { 0x000FFDFF, 0xFFFFFFFF },
1435 { 0x000FFBFF, 0xFFFFFFFF },
1436 { 0x000FF7FF, 0xFFFFFFFF },
1437 { 0x000FEFFF, 0xFFFFFFFF },
1438 { 0x000FDFFF, 0xFFFFFFFF },
1439 { 0x000FBFFF, 0xFFFFFFFF },
1440 { 0x000F7FFF, 0xFFFFFFFF },
1441 { 0x000EFFFF, 0xFFFFFFFF },
1442 { 0x000DFFFF, 0xFFFFFFFF },
1443 { 0x000BFFFF, 0xFFFFFFFF },
1444 { 0x0007FFFF, 0xFFFFFFFF },
1445 { 0x0003FFFF, 0xFFFFFFFF },
1446 { 0x0001FFFF, 0xFFFFFFFF },
1447 { 0x0000FFFF, 0xFFFFFFFF },
1448 { 0x00007FFF, 0xFFFFFFFF },
1449 { 0x00003FFF, 0xFFFFFFFF },
1450 { 0x00001FFF, 0xFFFFFFFF },
1451 { 0x00000FFF, 0xFFFFFFFF },
1452 { 0x000007FF, 0xFFFFFFFF },
1453 { 0x000003FF, 0xFFFFFFFF },
1454 { 0x000001FF, 0xFFFFFFFF },
1455 { 0x000000FF, 0xFFFFFFFF },
1456 { 0x0000007F, 0xFFFFFFFF },
1457 { 0x0000003F, 0xFFFFFFFF },
1458 { 0x0000001F, 0xFFFFFFFF },
1459 { 0x0000000F, 0xFFFFFFFF },
1460 { 0x00000007, 0xFFFFFFFF },
1461 { 0x00000003, 0xFFFFFFFF },
1462 { 0x00000001, 0xFFFFFFFF },
1463 { 0x00000000, 0xFFFFFFFF },
1464 { 0x00000000, 0x7FFFFFFF },
1465 { 0x00000000, 0x3FFFFFFF },
1466 { 0x00000000, 0x1FFFFFFF },
1467 { 0x00000000, 0x0FFFFFFF },
1468 { 0x00000000, 0x07FFFFFF },
1469 { 0x00000000, 0x03FFFFFF },
1470 { 0x00000000, 0x01FFFFFF },
1471 { 0x00000000, 0x00FFFFFF },
1472 { 0x00000000, 0x007FFFFF },
1473 { 0x00000000, 0x003FFFFF },
1474 { 0x00000000, 0x001FFFFF },
1475 { 0x00000000, 0x000FFFFF },
1476 { 0x00000000, 0x0007FFFF },
1477 { 0x00000000, 0x0003FFFF },
1478 { 0x00000000, 0x0001FFFF },
1479 { 0x00000000, 0x0000FFFF },
1480 { 0x00000000, 0x00007FFF },
1481 { 0x00000000, 0x00003FFF },
1482 { 0x00000000, 0x00001FFF },
1483 { 0x00000000, 0x00000FFF },
1484 { 0x00000000, 0x000007FF },
1485 { 0x00000000, 0x000003FF },
1486 { 0x00000000, 0x000001FF },
1487 { 0x00000000, 0x000000FF },
1488 { 0x00000000, 0x0000007F },
1489 { 0x00000000, 0x0000003F },
1490 { 0x00000000, 0x0000001F },
1491 { 0x00000000, 0x0000000F },
1492 { 0x00000000, 0x00000007 },
1493 { 0x00000000, 0x00000003 }
1496 static const uint32 float64NumQInP1 = float64NumQIn * float64NumP1;
1497 static const uint32 float64NumQOutP1 = float64NumQOut * float64NumP1;
1499 static float64 float64NextQInP1( sequenceT *sequencePtr )
1501 uint8 expNum, sigNum;
1502 float64 z;
1504 sigNum = sequencePtr->term1Num;
1505 expNum = sequencePtr->expNum;
1506 SETFLOAT64(
1508 float64QIn[ expNum ] | float64P1[ sigNum ].high,
1509 float64P1[ sigNum ].low
1511 ++sigNum;
1512 if ( float64NumP1 <= sigNum ) {
1513 sigNum = 0;
1514 ++expNum;
1515 if ( float64NumQIn <= expNum ) {
1516 expNum = 0;
1517 sequencePtr->done = TRUE;
1519 sequencePtr->expNum = expNum;
1521 sequencePtr->term1Num = sigNum;
1522 return z;
1526 static float64 float64NextQOutP1( sequenceT *sequencePtr )
1528 uint8 expNum, sigNum;
1529 float64 z;
1531 sigNum = sequencePtr->term1Num;
1532 expNum = sequencePtr->expNum;
1533 SETFLOAT64(
1535 float64QOut[ expNum ] | float64P1[ sigNum ].high,
1536 float64P1[ sigNum ].low
1538 ++sigNum;
1539 if ( float64NumP1 <= sigNum ) {
1540 sigNum = 0;
1541 ++expNum;
1542 if ( float64NumQOut <= expNum ) {
1543 expNum = 0;
1544 sequencePtr->done = TRUE;
1546 sequencePtr->expNum = expNum;
1548 sequencePtr->term1Num = sigNum;
1549 return z;
1553 static const uint32 float64NumQInP2 = float64NumQIn * float64NumP2;
1554 static const uint32 float64NumQOutP2 = float64NumQOut * float64NumP2;
1556 static float64 float64NextQInP2( sequenceT *sequencePtr )
1558 uint8 expNum, sigNum;
1559 float64 z;
1561 sigNum = sequencePtr->term1Num;
1562 expNum = sequencePtr->expNum;
1563 SETFLOAT64(
1565 float64QIn[ expNum ] | float64P2[ sigNum ].high,
1566 float64P2[ sigNum ].low
1568 ++sigNum;
1569 if ( float64NumP2 <= sigNum ) {
1570 sigNum = 0;
1571 ++expNum;
1572 if ( float64NumQIn <= expNum ) {
1573 expNum = 0;
1574 sequencePtr->done = TRUE;
1576 sequencePtr->expNum = expNum;
1578 sequencePtr->term1Num = sigNum;
1579 return z;
1583 static float64 float64NextQOutP2( sequenceT *sequencePtr )
1585 uint8 expNum, sigNum;
1586 float64 z;
1588 sigNum = sequencePtr->term1Num;
1589 expNum = sequencePtr->expNum;
1590 SETFLOAT64(
1592 float64QOut[ expNum ] | float64P2[ sigNum ].high,
1593 float64P2[ sigNum ].low
1595 ++sigNum;
1596 if ( float64NumP2 <= sigNum ) {
1597 sigNum = 0;
1598 ++expNum;
1599 if ( float64NumQOut <= expNum ) {
1600 expNum = 0;
1601 sequencePtr->done = TRUE;
1603 sequencePtr->expNum = expNum;
1605 sequencePtr->term1Num = sigNum;
1606 return z;
1610 static float64 float64RandomQOutP3( void )
1612 int8 sigNum1, sigNum2;
1613 uint32 sig1Low, sig2Low, zLow;
1614 float64 z;
1616 sigNum1 = randomUint8() % float64NumP2;
1617 sigNum2 = randomUint8() % float64NumP2;
1618 sig1Low = float64P2[ sigNum1 ].low;
1619 sig2Low = float64P2[ sigNum2 ].low;
1620 zLow = sig1Low + sig2Low;
1621 SETFLOAT64(
1623 float64QOut[ randomUint8() % float64NumQOut ]
1624 | ( ( float64P2[ sigNum1 ].high
1625 + float64P2[ sigNum2 ].high
1626 + ( zLow < sig1Low )
1628 & 0x000FFFFF
1630 zLow
1632 return z;
1636 static float64 float64RandomQOutPInf( void )
1638 float64 z;
1640 SETFLOAT64(
1642 float64QOut[ randomUint8() % float64NumQOut ]
1643 | ( randomUint32() & 0x000FFFFF ),
1644 randomUint32()
1646 return z;
1650 enum {
1651 float64NumQInfWeightMasks = 10
1654 static const uint32 float64QInfWeightMasks[ float64NumQInfWeightMasks ] = {
1655 0x7FF00000,
1656 0x7FF00000,
1657 0x3FF00000,
1658 0x1FF00000,
1659 0x0FF00000,
1660 0x07F00000,
1661 0x03F00000,
1662 0x01F00000,
1663 0x00F00000,
1664 0x00700000
1667 static const uint32 float64QInfWeightOffsets[ float64NumQInfWeightMasks ] = {
1668 0x00000000,
1669 0x00000000,
1670 0x20000000,
1671 0x30000000,
1672 0x38000000,
1673 0x3C000000,
1674 0x3E000000,
1675 0x3F000000,
1676 0x3F800000,
1677 0x3FC00000
1680 static float64 float64RandomQInfP3( void )
1682 int8 sigNum1, sigNum2;
1683 uint32 sig1Low, sig2Low, zLow;
1684 int8 weightMaskNum;
1685 float64 z;
1687 sigNum1 = randomUint8() % float64NumP2;
1688 sigNum2 = randomUint8() % float64NumP2;
1689 sig1Low = float64P2[ sigNum1 ].low;
1690 sig2Low = float64P2[ sigNum2 ].low;
1691 zLow = sig1Low + sig2Low;
1692 weightMaskNum = randomUint8() % float64NumQInfWeightMasks;
1693 SETFLOAT64(
1695 ( ( (uint32) ( randomUint8() & 1 ) )<<31 )
1696 | ( ( ( ( (uint32) ( randomUint16() & 0xFFF ) )<<20 )
1697 & float64QInfWeightMasks[ weightMaskNum ] )
1698 + float64QInfWeightOffsets[ weightMaskNum ]
1700 | ( ( float64P2[ sigNum1 ].high
1701 + float64P2[ sigNum2 ].high
1702 + ( zLow < sig1Low )
1704 & 0x000FFFFF
1706 zLow
1708 return z;
1712 static float64 float64RandomQInfPInf( void )
1714 int8 weightMaskNum;
1715 float64 z;
1717 weightMaskNum = randomUint8() % float64NumQInfWeightMasks;
1718 SETFLOAT64(
1720 ( ( (uint32) ( randomUint8() & 1 ) )<<31 )
1721 | ( ( ( ( (uint32) ( randomUint16() & 0xFFF ) )<<20 )
1722 & float64QInfWeightMasks[ weightMaskNum ] )
1723 + float64QInfWeightOffsets[ weightMaskNum ]
1725 | ( randomUint32() & 0x000FFFFF ),
1726 randomUint32()
1728 return z;
1732 static float64 float64Random( void )
1735 switch ( randomUint8() & 7 ) {
1736 case 0:
1737 case 1:
1738 case 2:
1739 return float64RandomQOutP3();
1740 case 3:
1741 return float64RandomQOutPInf();
1742 case 4:
1743 case 5:
1744 case 6:
1745 return float64RandomQInfP3();
1746 case 7:
1747 return float64RandomQInfPInf();
1749 abort();
1750 return 0;
1753 #ifdef FLOATX80
1755 enum {
1756 floatx80NumQIn = 22,
1757 floatx80NumQOut = 76,
1758 floatx80NumP1 = 4,
1759 floatx80NumP2 = 248
1762 static const uint16 floatx80QIn[ floatx80NumQIn ] = {
1763 0x0000, /* positive, subnormal */
1764 0x0001, /* positive, -16382 */
1765 0x3FBF, /* positive, -64 */
1766 0x3FFD, /* positive, -2 */
1767 0x3FFE, /* positive, -1 */
1768 0x3FFF, /* positive, 0 */
1769 0x4000, /* positive, 1 */
1770 0x4001, /* positive, 2 */
1771 0x403F, /* positive, 64 */
1772 0x7FFE, /* positive, 16383 */
1773 0x7FFF, /* positive, infinity or NaN */
1774 0x8000, /* negative, subnormal */
1775 0x8001, /* negative, -16382 */
1776 0xBFBF, /* negative, -64 */
1777 0xBFFD, /* negative, -2 */
1778 0xBFFE, /* negative, -1 */
1779 0xBFFF, /* negative, 0 */
1780 0xC000, /* negative, 1 */
1781 0xC001, /* negative, 2 */
1782 0xC03F, /* negative, 64 */
1783 0xFFFE, /* negative, 16383 */
1784 0xFFFF /* negative, infinity or NaN */
1787 static const uint16 floatx80QOut[ floatx80NumQOut ] = {
1788 0x0000, /* positive, subnormal */
1789 0x0001, /* positive, -16382 */
1790 0x0002, /* positive, -16381 */
1791 0x3BFE, /* positive, -1025 */
1792 0x3BFF, /* positive, -1024 */
1793 0x3C00, /* positive, -1023 */
1794 0x3C01, /* positive, -1022 */
1795 0x3F7E, /* positive, -129 */
1796 0x3F7F, /* positive, -128 */
1797 0x3F80, /* positive, -127 */
1798 0x3F81, /* positive, -126 */
1799 0x3FBF, /* positive, -64 */
1800 0x3FFB, /* positive, -4 */
1801 0x3FFC, /* positive, -3 */
1802 0x3FFD, /* positive, -2 */
1803 0x3FFE, /* positive, -1 */
1804 0x3FFF, /* positive, 0 */
1805 0x4000, /* positive, 1 */
1806 0x4001, /* positive, 2 */
1807 0x4002, /* positive, 3 */
1808 0x4003, /* positive, 4 */
1809 0x401C, /* positive, 29 */
1810 0x401D, /* positive, 30 */
1811 0x401E, /* positive, 31 */
1812 0x401F, /* positive, 32 */
1813 0x403C, /* positive, 61 */
1814 0x403D, /* positive, 62 */
1815 0x403E, /* positive, 63 */
1816 0x403F, /* positive, 64 */
1817 0x407E, /* positive, 127 */
1818 0x407F, /* positive, 128 */
1819 0x4080, /* positive, 129 */
1820 0x43FE, /* positive, 1023 */
1821 0x43FF, /* positive, 1024 */
1822 0x4400, /* positive, 1025 */
1823 0x7FFD, /* positive, 16382 */
1824 0x7FFE, /* positive, 16383 */
1825 0x7FFF, /* positive, infinity or NaN */
1826 0x8000, /* negative, subnormal */
1827 0x8001, /* negative, -16382 */
1828 0x8002, /* negative, -16381 */
1829 0xBBFE, /* negative, -1025 */
1830 0xBBFF, /* negative, -1024 */
1831 0xBC00, /* negative, -1023 */
1832 0xBC01, /* negative, -1022 */
1833 0xBF7E, /* negative, -129 */
1834 0xBF7F, /* negative, -128 */
1835 0xBF80, /* negative, -127 */
1836 0xBF81, /* negative, -126 */
1837 0xBFBF, /* negative, -64 */
1838 0xBFFB, /* negative, -4 */
1839 0xBFFC, /* negative, -3 */
1840 0xBFFD, /* negative, -2 */
1841 0xBFFE, /* negative, -1 */
1842 0xBFFF, /* negative, 0 */
1843 0xC000, /* negative, 1 */
1844 0xC001, /* negative, 2 */
1845 0xC002, /* negative, 3 */
1846 0xC003, /* negative, 4 */
1847 0xC01C, /* negative, 29 */
1848 0xC01D, /* negative, 30 */
1849 0xC01E, /* negative, 31 */
1850 0xC01F, /* negative, 32 */
1851 0xC03C, /* negative, 61 */
1852 0xC03D, /* negative, 62 */
1853 0xC03E, /* negative, 63 */
1854 0xC03F, /* negative, 64 */
1855 0xC07E, /* negative, 127 */
1856 0xC07F, /* negative, 128 */
1857 0xC080, /* negative, 129 */
1858 0xC3FE, /* negative, 1023 */
1859 0xC3FF, /* negative, 1024 */
1860 0xC400, /* negative, 1025 */
1861 0xFFFD, /* negative, 16382 */
1862 0xFFFE, /* negative, 16383 */
1863 0xFFFF /* negative, infinity or NaN */
1866 static const bits64 floatx80P1[ floatx80NumP1 ] = {
1867 LIT64( 0x0000000000000000 ),
1868 LIT64( 0x0000000000000001 ),
1869 LIT64( 0x7FFFFFFFFFFFFFFF ),
1870 LIT64( 0x7FFFFFFFFFFFFFFE )
1873 static const bits64 floatx80P2[ floatx80NumP2 ] = {
1874 LIT64( 0x0000000000000000 ),
1875 LIT64( 0x0000000000000001 ),
1876 LIT64( 0x0000000000000002 ),
1877 LIT64( 0x0000000000000004 ),
1878 LIT64( 0x0000000000000008 ),
1879 LIT64( 0x0000000000000010 ),
1880 LIT64( 0x0000000000000020 ),
1881 LIT64( 0x0000000000000040 ),
1882 LIT64( 0x0000000000000080 ),
1883 LIT64( 0x0000000000000100 ),
1884 LIT64( 0x0000000000000200 ),
1885 LIT64( 0x0000000000000400 ),
1886 LIT64( 0x0000000000000800 ),
1887 LIT64( 0x0000000000001000 ),
1888 LIT64( 0x0000000000002000 ),
1889 LIT64( 0x0000000000004000 ),
1890 LIT64( 0x0000000000008000 ),
1891 LIT64( 0x0000000000010000 ),
1892 LIT64( 0x0000000000020000 ),
1893 LIT64( 0x0000000000040000 ),
1894 LIT64( 0x0000000000080000 ),
1895 LIT64( 0x0000000000100000 ),
1896 LIT64( 0x0000000000200000 ),
1897 LIT64( 0x0000000000400000 ),
1898 LIT64( 0x0000000000800000 ),
1899 LIT64( 0x0000000001000000 ),
1900 LIT64( 0x0000000002000000 ),
1901 LIT64( 0x0000000004000000 ),
1902 LIT64( 0x0000000008000000 ),
1903 LIT64( 0x0000000010000000 ),
1904 LIT64( 0x0000000020000000 ),
1905 LIT64( 0x0000000040000000 ),
1906 LIT64( 0x0000000080000000 ),
1907 LIT64( 0x0000000100000000 ),
1908 LIT64( 0x0000000200000000 ),
1909 LIT64( 0x0000000400000000 ),
1910 LIT64( 0x0000000800000000 ),
1911 LIT64( 0x0000001000000000 ),
1912 LIT64( 0x0000002000000000 ),
1913 LIT64( 0x0000004000000000 ),
1914 LIT64( 0x0000008000000000 ),
1915 LIT64( 0x0000010000000000 ),
1916 LIT64( 0x0000020000000000 ),
1917 LIT64( 0x0000040000000000 ),
1918 LIT64( 0x0000080000000000 ),
1919 LIT64( 0x0000100000000000 ),
1920 LIT64( 0x0000200000000000 ),
1921 LIT64( 0x0000400000000000 ),
1922 LIT64( 0x0000800000000000 ),
1923 LIT64( 0x0001000000000000 ),
1924 LIT64( 0x0002000000000000 ),
1925 LIT64( 0x0004000000000000 ),
1926 LIT64( 0x0008000000000000 ),
1927 LIT64( 0x0010000000000000 ),
1928 LIT64( 0x0020000000000000 ),
1929 LIT64( 0x0040000000000000 ),
1930 LIT64( 0x0080000000000000 ),
1931 LIT64( 0x0100000000000000 ),
1932 LIT64( 0x0200000000000000 ),
1933 LIT64( 0x0400000000000000 ),
1934 LIT64( 0x0800000000000000 ),
1935 LIT64( 0x1000000000000000 ),
1936 LIT64( 0x2000000000000000 ),
1937 LIT64( 0x4000000000000000 ),
1938 LIT64( 0x6000000000000000 ),
1939 LIT64( 0x7000000000000000 ),
1940 LIT64( 0x7800000000000000 ),
1941 LIT64( 0x7C00000000000000 ),
1942 LIT64( 0x7E00000000000000 ),
1943 LIT64( 0x7F00000000000000 ),
1944 LIT64( 0x7F80000000000000 ),
1945 LIT64( 0x7FC0000000000000 ),
1946 LIT64( 0x7FE0000000000000 ),
1947 LIT64( 0x7FF0000000000000 ),
1948 LIT64( 0x7FF8000000000000 ),
1949 LIT64( 0x7FFC000000000000 ),
1950 LIT64( 0x7FFE000000000000 ),
1951 LIT64( 0x7FFF000000000000 ),
1952 LIT64( 0x7FFF800000000000 ),
1953 LIT64( 0x7FFFC00000000000 ),
1954 LIT64( 0x7FFFE00000000000 ),
1955 LIT64( 0x7FFFF00000000000 ),
1956 LIT64( 0x7FFFF80000000000 ),
1957 LIT64( 0x7FFFFC0000000000 ),
1958 LIT64( 0x7FFFFE0000000000 ),
1959 LIT64( 0x7FFFFF0000000000 ),
1960 LIT64( 0x7FFFFF8000000000 ),
1961 LIT64( 0x7FFFFFC000000000 ),
1962 LIT64( 0x7FFFFFE000000000 ),
1963 LIT64( 0x7FFFFFF000000000 ),
1964 LIT64( 0x7FFFFFF800000000 ),
1965 LIT64( 0x7FFFFFFC00000000 ),
1966 LIT64( 0x7FFFFFFE00000000 ),
1967 LIT64( 0x7FFFFFFF00000000 ),
1968 LIT64( 0x7FFFFFFF80000000 ),
1969 LIT64( 0x7FFFFFFFC0000000 ),
1970 LIT64( 0x7FFFFFFFE0000000 ),
1971 LIT64( 0x7FFFFFFFF0000000 ),
1972 LIT64( 0x7FFFFFFFF8000000 ),
1973 LIT64( 0x7FFFFFFFFC000000 ),
1974 LIT64( 0x7FFFFFFFFE000000 ),
1975 LIT64( 0x7FFFFFFFFF000000 ),
1976 LIT64( 0x7FFFFFFFFF800000 ),
1977 LIT64( 0x7FFFFFFFFFC00000 ),
1978 LIT64( 0x7FFFFFFFFFE00000 ),
1979 LIT64( 0x7FFFFFFFFFF00000 ),
1980 LIT64( 0x7FFFFFFFFFF80000 ),
1981 LIT64( 0x7FFFFFFFFFFC0000 ),
1982 LIT64( 0x7FFFFFFFFFFE0000 ),
1983 LIT64( 0x7FFFFFFFFFFF0000 ),
1984 LIT64( 0x7FFFFFFFFFFF8000 ),
1985 LIT64( 0x7FFFFFFFFFFFC000 ),
1986 LIT64( 0x7FFFFFFFFFFFE000 ),
1987 LIT64( 0x7FFFFFFFFFFFF000 ),
1988 LIT64( 0x7FFFFFFFFFFFF800 ),
1989 LIT64( 0x7FFFFFFFFFFFFC00 ),
1990 LIT64( 0x7FFFFFFFFFFFFE00 ),
1991 LIT64( 0x7FFFFFFFFFFFFF00 ),
1992 LIT64( 0x7FFFFFFFFFFFFF80 ),
1993 LIT64( 0x7FFFFFFFFFFFFFC0 ),
1994 LIT64( 0x7FFFFFFFFFFFFFE0 ),
1995 LIT64( 0x7FFFFFFFFFFFFFF0 ),
1996 LIT64( 0x7FFFFFFFFFFFFFF8 ),
1997 LIT64( 0x7FFFFFFFFFFFFFFC ),
1998 LIT64( 0x7FFFFFFFFFFFFFFE ),
1999 LIT64( 0x7FFFFFFFFFFFFFFF ),
2000 LIT64( 0x7FFFFFFFFFFFFFFD ),
2001 LIT64( 0x7FFFFFFFFFFFFFFB ),
2002 LIT64( 0x7FFFFFFFFFFFFFF7 ),
2003 LIT64( 0x7FFFFFFFFFFFFFEF ),
2004 LIT64( 0x7FFFFFFFFFFFFFDF ),
2005 LIT64( 0x7FFFFFFFFFFFFFBF ),
2006 LIT64( 0x7FFFFFFFFFFFFF7F ),
2007 LIT64( 0x7FFFFFFFFFFFFEFF ),
2008 LIT64( 0x7FFFFFFFFFFFFDFF ),
2009 LIT64( 0x7FFFFFFFFFFFFBFF ),
2010 LIT64( 0x7FFFFFFFFFFFF7FF ),
2011 LIT64( 0x7FFFFFFFFFFFEFFF ),
2012 LIT64( 0x7FFFFFFFFFFFDFFF ),
2013 LIT64( 0x7FFFFFFFFFFFBFFF ),
2014 LIT64( 0x7FFFFFFFFFFF7FFF ),
2015 LIT64( 0x7FFFFFFFFFFEFFFF ),
2016 LIT64( 0x7FFFFFFFFFFDFFFF ),
2017 LIT64( 0x7FFFFFFFFFFBFFFF ),
2018 LIT64( 0x7FFFFFFFFFF7FFFF ),
2019 LIT64( 0x7FFFFFFFFFEFFFFF ),
2020 LIT64( 0x7FFFFFFFFFDFFFFF ),
2021 LIT64( 0x7FFFFFFFFFBFFFFF ),
2022 LIT64( 0x7FFFFFFFFF7FFFFF ),
2023 LIT64( 0x7FFFFFFFFEFFFFFF ),
2024 LIT64( 0x7FFFFFFFFDFFFFFF ),
2025 LIT64( 0x7FFFFFFFFBFFFFFF ),
2026 LIT64( 0x7FFFFFFFF7FFFFFF ),
2027 LIT64( 0x7FFFFFFFEFFFFFFF ),
2028 LIT64( 0x7FFFFFFFDFFFFFFF ),
2029 LIT64( 0x7FFFFFFFBFFFFFFF ),
2030 LIT64( 0x7FFFFFFF7FFFFFFF ),
2031 LIT64( 0x7FFFFFFEFFFFFFFF ),
2032 LIT64( 0x7FFFFFFDFFFFFFFF ),
2033 LIT64( 0x7FFFFFFBFFFFFFFF ),
2034 LIT64( 0x7FFFFFF7FFFFFFFF ),
2035 LIT64( 0x7FFFFFEFFFFFFFFF ),
2036 LIT64( 0x7FFFFFDFFFFFFFFF ),
2037 LIT64( 0x7FFFFFBFFFFFFFFF ),
2038 LIT64( 0x7FFFFF7FFFFFFFFF ),
2039 LIT64( 0x7FFFFEFFFFFFFFFF ),
2040 LIT64( 0x7FFFFDFFFFFFFFFF ),
2041 LIT64( 0x7FFFFBFFFFFFFFFF ),
2042 LIT64( 0x7FFFF7FFFFFFFFFF ),
2043 LIT64( 0x7FFFEFFFFFFFFFFF ),
2044 LIT64( 0x7FFFDFFFFFFFFFFF ),
2045 LIT64( 0x7FFFBFFFFFFFFFFF ),
2046 LIT64( 0x7FFF7FFFFFFFFFFF ),
2047 LIT64( 0x7FFEFFFFFFFFFFFF ),
2048 LIT64( 0x7FFDFFFFFFFFFFFF ),
2049 LIT64( 0x7FFBFFFFFFFFFFFF ),
2050 LIT64( 0x7FF7FFFFFFFFFFFF ),
2051 LIT64( 0x7FEFFFFFFFFFFFFF ),
2052 LIT64( 0x7FDFFFFFFFFFFFFF ),
2053 LIT64( 0x7FBFFFFFFFFFFFFF ),
2054 LIT64( 0x7F7FFFFFFFFFFFFF ),
2055 LIT64( 0x7EFFFFFFFFFFFFFF ),
2056 LIT64( 0x7DFFFFFFFFFFFFFF ),
2057 LIT64( 0x7BFFFFFFFFFFFFFF ),
2058 LIT64( 0x77FFFFFFFFFFFFFF ),
2059 LIT64( 0x6FFFFFFFFFFFFFFF ),
2060 LIT64( 0x5FFFFFFFFFFFFFFF ),
2061 LIT64( 0x3FFFFFFFFFFFFFFF ),
2062 LIT64( 0x1FFFFFFFFFFFFFFF ),
2063 LIT64( 0x0FFFFFFFFFFFFFFF ),
2064 LIT64( 0x07FFFFFFFFFFFFFF ),
2065 LIT64( 0x03FFFFFFFFFFFFFF ),
2066 LIT64( 0x01FFFFFFFFFFFFFF ),
2067 LIT64( 0x00FFFFFFFFFFFFFF ),
2068 LIT64( 0x007FFFFFFFFFFFFF ),
2069 LIT64( 0x003FFFFFFFFFFFFF ),
2070 LIT64( 0x001FFFFFFFFFFFFF ),
2071 LIT64( 0x000FFFFFFFFFFFFF ),
2072 LIT64( 0x0007FFFFFFFFFFFF ),
2073 LIT64( 0x0003FFFFFFFFFFFF ),
2074 LIT64( 0x0001FFFFFFFFFFFF ),
2075 LIT64( 0x0000FFFFFFFFFFFF ),
2076 LIT64( 0x00007FFFFFFFFFFF ),
2077 LIT64( 0x00003FFFFFFFFFFF ),
2078 LIT64( 0x00001FFFFFFFFFFF ),
2079 LIT64( 0x00000FFFFFFFFFFF ),
2080 LIT64( 0x000007FFFFFFFFFF ),
2081 LIT64( 0x000003FFFFFFFFFF ),
2082 LIT64( 0x000001FFFFFFFFFF ),
2083 LIT64( 0x000000FFFFFFFFFF ),
2084 LIT64( 0x0000007FFFFFFFFF ),
2085 LIT64( 0x0000003FFFFFFFFF ),
2086 LIT64( 0x0000001FFFFFFFFF ),
2087 LIT64( 0x0000000FFFFFFFFF ),
2088 LIT64( 0x00000007FFFFFFFF ),
2089 LIT64( 0x00000003FFFFFFFF ),
2090 LIT64( 0x00000001FFFFFFFF ),
2091 LIT64( 0x00000000FFFFFFFF ),
2092 LIT64( 0x000000007FFFFFFF ),
2093 LIT64( 0x000000003FFFFFFF ),
2094 LIT64( 0x000000001FFFFFFF ),
2095 LIT64( 0x000000000FFFFFFF ),
2096 LIT64( 0x0000000007FFFFFF ),
2097 LIT64( 0x0000000003FFFFFF ),
2098 LIT64( 0x0000000001FFFFFF ),
2099 LIT64( 0x0000000000FFFFFF ),
2100 LIT64( 0x00000000007FFFFF ),
2101 LIT64( 0x00000000003FFFFF ),
2102 LIT64( 0x00000000001FFFFF ),
2103 LIT64( 0x00000000000FFFFF ),
2104 LIT64( 0x000000000007FFFF ),
2105 LIT64( 0x000000000003FFFF ),
2106 LIT64( 0x000000000001FFFF ),
2107 LIT64( 0x000000000000FFFF ),
2108 LIT64( 0x0000000000007FFF ),
2109 LIT64( 0x0000000000003FFF ),
2110 LIT64( 0x0000000000001FFF ),
2111 LIT64( 0x0000000000000FFF ),
2112 LIT64( 0x00000000000007FF ),
2113 LIT64( 0x00000000000003FF ),
2114 LIT64( 0x00000000000001FF ),
2115 LIT64( 0x00000000000000FF ),
2116 LIT64( 0x000000000000007F ),
2117 LIT64( 0x000000000000003F ),
2118 LIT64( 0x000000000000001F ),
2119 LIT64( 0x000000000000000F ),
2120 LIT64( 0x0000000000000007 ),
2121 LIT64( 0x0000000000000003 )
2124 static const uint32 floatx80NumQInP1 = floatx80NumQIn * floatx80NumP1;
2125 static const uint32 floatx80NumQOutP1 = floatx80NumQOut * floatx80NumP1;
2127 static floatx80 floatx80NextQInP1( sequenceT *sequencePtr )
2129 int16 expNum, sigNum;
2130 floatx80 z;
2132 sigNum = sequencePtr->term1Num;
2133 expNum = sequencePtr->expNum;
2134 z.low = floatx80P1[ sigNum ];
2135 z.high = floatx80QIn[ expNum ];
2136 if ( z.high & 0x7FFF ) z.low |= LIT64( 0x8000000000000000 );
2137 ++sigNum;
2138 if ( floatx80NumP1 <= sigNum ) {
2139 sigNum = 0;
2140 ++expNum;
2141 if ( floatx80NumQIn <= expNum ) {
2142 expNum = 0;
2143 sequencePtr->done = TRUE;
2145 sequencePtr->expNum = expNum;
2147 sequencePtr->term1Num = sigNum;
2148 return z;
2152 static floatx80 floatx80NextQOutP1( sequenceT *sequencePtr )
2154 int16 expNum, sigNum;
2155 floatx80 z;
2157 sigNum = sequencePtr->term1Num;
2158 expNum = sequencePtr->expNum;
2159 z.low = floatx80P1[ sigNum ];
2160 z.high = floatx80QOut[ expNum ];
2161 if ( z.high & 0x7FFF ) z.low |= LIT64( 0x8000000000000000 );
2162 ++sigNum;
2163 if ( floatx80NumP1 <= sigNum ) {
2164 sigNum = 0;
2165 ++expNum;
2166 if ( floatx80NumQOut <= expNum ) {
2167 expNum = 0;
2168 sequencePtr->done = TRUE;
2170 sequencePtr->expNum = expNum;
2172 sequencePtr->term1Num = sigNum;
2173 return z;
2177 static const uint32 floatx80NumQInP2 = floatx80NumQIn * floatx80NumP2;
2178 static const uint32 floatx80NumQOutP2 = floatx80NumQOut * floatx80NumP2;
2180 static floatx80 floatx80NextQInP2( sequenceT *sequencePtr )
2182 int16 expNum, sigNum;
2183 floatx80 z;
2185 sigNum = sequencePtr->term1Num;
2186 expNum = sequencePtr->expNum;
2187 z.low = floatx80P2[ sigNum ];
2188 z.high = floatx80QIn[ expNum ];
2189 if ( z.high & 0x7FFF ) z.low |= LIT64( 0x8000000000000000 );
2190 ++sigNum;
2191 if ( floatx80NumP2 <= sigNum ) {
2192 sigNum = 0;
2193 ++expNum;
2194 if ( floatx80NumQIn <= expNum ) {
2195 expNum = 0;
2196 sequencePtr->done = TRUE;
2198 sequencePtr->expNum = expNum;
2200 sequencePtr->term1Num = sigNum;
2201 return z;
2205 static floatx80 floatx80NextQOutP2( sequenceT *sequencePtr )
2207 int16 expNum, sigNum;
2208 floatx80 z;
2210 sigNum = sequencePtr->term1Num;
2211 expNum = sequencePtr->expNum;
2212 z.low = floatx80P2[ sigNum ];
2213 z.high = floatx80QOut[ expNum ];
2214 if ( z.high & 0x7FFF ) z.low |= LIT64( 0x8000000000000000 );
2215 ++sigNum;
2216 if ( floatx80NumP2 <= sigNum ) {
2217 sigNum = 0;
2218 ++expNum;
2219 if ( floatx80NumQOut <= expNum ) {
2220 expNum = 0;
2221 sequencePtr->done = TRUE;
2223 sequencePtr->expNum = expNum;
2225 sequencePtr->term1Num = sigNum;
2226 return z;
2230 static floatx80 floatx80RandomQOutP3( void )
2232 floatx80 z;
2234 z.low =
2235 ( floatx80P2[ randomUint8() % floatx80NumP2 ]
2236 + floatx80P2[ randomUint8() % floatx80NumP2 ] )
2237 & LIT64( 0x7FFFFFFFFFFFFFFF );
2238 z.high = floatx80QOut[ randomUint8() % floatx80NumQOut ];
2239 if ( z.high & 0x7FFF ) z.low |= LIT64( 0x8000000000000000 );
2240 return z;
2244 static floatx80 floatx80RandomQOutPInf( void )
2246 floatx80 z;
2248 z.low = randomUint64() & LIT64( 0x7FFFFFFFFFFFFFFF );
2249 z.high = floatx80QOut[ randomUint8() % floatx80NumQOut ];
2250 if ( z.high & 0x7FFF ) z.low |= LIT64( 0x8000000000000000 );
2251 return z;
2255 enum {
2256 floatx80NumQInfWeightMasks = 14
2259 static const uint16 floatx80QInfWeightMasks[ floatx80NumQInfWeightMasks ] = {
2260 0x7FFF,
2261 0x7FFF,
2262 0x3FFF,
2263 0x1FFF,
2264 0x07FF,
2265 0x07FF,
2266 0x03FF,
2267 0x01FF,
2268 0x00FF,
2269 0x007F,
2270 0x003F,
2271 0x001F,
2272 0x000F,
2273 0x0007
2276 static const uint16 floatx80QInfWeightOffsets[ floatx80NumQInfWeightMasks ] = {
2277 0x0000,
2278 0x0000,
2279 0x2000,
2280 0x3000,
2281 0x3800,
2282 0x3C00,
2283 0x3E00,
2284 0x3F00,
2285 0x3F80,
2286 0x3FC0,
2287 0x3FE0,
2288 0x3FF0,
2289 0x3FF8,
2290 0x3FFC
2293 static floatx80 floatx80RandomQInfP3( void )
2295 int8 weightMaskNum;
2296 floatx80 z;
2298 z.low =
2299 ( floatx80P2[ randomUint8() % floatx80NumP2 ]
2300 + floatx80P2[ randomUint8() % floatx80NumP2 ] )
2301 & LIT64( 0x7FFFFFFFFFFFFFFF );
2302 weightMaskNum = randomUint8() % floatx80NumQInfWeightMasks;
2303 z.high =
2304 randomUint16() & (floatx80QInfWeightMasks[ weightMaskNum ]
2305 + floatx80QInfWeightOffsets[ weightMaskNum ]);
2306 if ( z.high ) z.low |= LIT64( 0x8000000000000000 );
2307 z.high |= ( (uint16) ( randomUint8() & 1 ) )<<15;
2308 return z;
2312 static floatx80 floatx80RandomQInfPInf( void )
2314 int8 weightMaskNum;
2315 floatx80 z;
2317 z.low = randomUint64() & LIT64( 0x7FFFFFFFFFFFFFFF );
2318 weightMaskNum = randomUint8() % floatx80NumQInfWeightMasks;
2319 z.high =
2320 randomUint16() & (floatx80QInfWeightMasks[ weightMaskNum ]
2321 + floatx80QInfWeightOffsets[ weightMaskNum ]);
2322 if ( z.high ) z.low |= LIT64( 0x8000000000000000 );
2323 z.high |= ( (uint16) ( randomUint8() & 1 ) )<<15;
2324 return z;
2328 static floatx80 floatx80Random( void )
2331 switch ( randomUint8() & 7 ) {
2332 case 0:
2333 case 1:
2334 case 2:
2335 return floatx80RandomQOutP3();
2336 case 3:
2337 return floatx80RandomQOutPInf();
2338 case 4:
2339 case 5:
2340 case 6:
2341 return floatx80RandomQInfP3();
2342 case 7:
2343 break;
2345 return floatx80RandomQInfPInf();
2348 #endif
2350 #ifdef FLOAT128
2352 enum {
2353 float128NumQIn = 22,
2354 float128NumQOut = 78,
2355 float128NumP1 = 4,
2356 float128NumP2 = 443
2359 static const uint64 float128QIn[ float128NumQIn ] = {
2360 LIT64( 0x0000000000000000 ), /* positive, subnormal */
2361 LIT64( 0x0001000000000000 ), /* positive, -16382 */
2362 LIT64( 0x3F8E000000000000 ), /* positive, -113 */
2363 LIT64( 0x3FFD000000000000 ), /* positive, -2 */
2364 LIT64( 0x3FFE000000000000 ), /* positive, -1 */
2365 LIT64( 0x3FFF000000000000 ), /* positive, 0 */
2366 LIT64( 0x4000000000000000 ), /* positive, 1 */
2367 LIT64( 0x4001000000000000 ), /* positive, 2 */
2368 LIT64( 0x4070000000000000 ), /* positive, 113 */
2369 LIT64( 0x7FFE000000000000 ), /* positive, 16383 */
2370 LIT64( 0x7FFF000000000000 ), /* positive, infinity or NaN */
2371 LIT64( 0x8000000000000000 ), /* negative, subnormal */
2372 LIT64( 0x8001000000000000 ), /* negative, -16382 */
2373 LIT64( 0xBF8E000000000000 ), /* negative, -113 */
2374 LIT64( 0xBFFD000000000000 ), /* negative, -2 */
2375 LIT64( 0xBFFE000000000000 ), /* negative, -1 */
2376 LIT64( 0xBFFF000000000000 ), /* negative, 0 */
2377 LIT64( 0xC000000000000000 ), /* negative, 1 */
2378 LIT64( 0xC001000000000000 ), /* negative, 2 */
2379 LIT64( 0xC070000000000000 ), /* negative, 113 */
2380 LIT64( 0xFFFE000000000000 ), /* negative, 16383 */
2381 LIT64( 0xFFFF000000000000 ) /* negative, infinity or NaN */
2384 static const uint64 float128QOut[ float128NumQOut ] = {
2385 LIT64( 0x0000000000000000 ), /* positive, subnormal */
2386 LIT64( 0x0001000000000000 ), /* positive, -16382 */
2387 LIT64( 0x0002000000000000 ), /* positive, -16381 */
2388 LIT64( 0x3BFE000000000000 ), /* positive, -1025 */
2389 LIT64( 0x3BFF000000000000 ), /* positive, -1024 */
2390 LIT64( 0x3C00000000000000 ), /* positive, -1023 */
2391 LIT64( 0x3C01000000000000 ), /* positive, -1022 */
2392 LIT64( 0x3F7E000000000000 ), /* positive, -129 */
2393 LIT64( 0x3F7F000000000000 ), /* positive, -128 */
2394 LIT64( 0x3F80000000000000 ), /* positive, -127 */
2395 LIT64( 0x3F81000000000000 ), /* positive, -126 */
2396 LIT64( 0x3F8E000000000000 ), /* positive, -113 */
2397 LIT64( 0x3FFB000000000000 ), /* positive, -4 */
2398 LIT64( 0x3FFC000000000000 ), /* positive, -3 */
2399 LIT64( 0x3FFD000000000000 ), /* positive, -2 */
2400 LIT64( 0x3FFE000000000000 ), /* positive, -1 */
2401 LIT64( 0x3FFF000000000000 ), /* positive, 0 */
2402 LIT64( 0x4000000000000000 ), /* positive, 1 */
2403 LIT64( 0x4001000000000000 ), /* positive, 2 */
2404 LIT64( 0x4002000000000000 ), /* positive, 3 */
2405 LIT64( 0x4003000000000000 ), /* positive, 4 */
2406 LIT64( 0x401C000000000000 ), /* positive, 29 */
2407 LIT64( 0x401D000000000000 ), /* positive, 30 */
2408 LIT64( 0x401E000000000000 ), /* positive, 31 */
2409 LIT64( 0x401F000000000000 ), /* positive, 32 */
2410 LIT64( 0x403C000000000000 ), /* positive, 61 */
2411 LIT64( 0x403D000000000000 ), /* positive, 62 */
2412 LIT64( 0x403E000000000000 ), /* positive, 63 */
2413 LIT64( 0x403F000000000000 ), /* positive, 64 */
2414 LIT64( 0x4070000000000000 ), /* positive, 113 */
2415 LIT64( 0x407E000000000000 ), /* positive, 127 */
2416 LIT64( 0x407F000000000000 ), /* positive, 128 */
2417 LIT64( 0x4080000000000000 ), /* positive, 129 */
2418 LIT64( 0x43FE000000000000 ), /* positive, 1023 */
2419 LIT64( 0x43FF000000000000 ), /* positive, 1024 */
2420 LIT64( 0x4400000000000000 ), /* positive, 1025 */
2421 LIT64( 0x7FFD000000000000 ), /* positive, 16382 */
2422 LIT64( 0x7FFE000000000000 ), /* positive, 16383 */
2423 LIT64( 0x7FFF000000000000 ), /* positive, infinity or NaN */
2424 LIT64( 0x8000000000000000 ), /* negative, subnormal */
2425 LIT64( 0x8001000000000000 ), /* negative, -16382 */
2426 LIT64( 0x8002000000000000 ), /* negative, -16381 */
2427 LIT64( 0xBBFE000000000000 ), /* negative, -1025 */
2428 LIT64( 0xBBFF000000000000 ), /* negative, -1024 */
2429 LIT64( 0xBC00000000000000 ), /* negative, -1023 */
2430 LIT64( 0xBC01000000000000 ), /* negative, -1022 */
2431 LIT64( 0xBF7E000000000000 ), /* negative, -129 */
2432 LIT64( 0xBF7F000000000000 ), /* negative, -128 */
2433 LIT64( 0xBF80000000000000 ), /* negative, -127 */
2434 LIT64( 0xBF81000000000000 ), /* negative, -126 */
2435 LIT64( 0xBF8E000000000000 ), /* negative, -113 */
2436 LIT64( 0xBFFB000000000000 ), /* negative, -4 */
2437 LIT64( 0xBFFC000000000000 ), /* negative, -3 */
2438 LIT64( 0xBFFD000000000000 ), /* negative, -2 */
2439 LIT64( 0xBFFE000000000000 ), /* negative, -1 */
2440 LIT64( 0xBFFF000000000000 ), /* negative, 0 */
2441 LIT64( 0xC000000000000000 ), /* negative, 1 */
2442 LIT64( 0xC001000000000000 ), /* negative, 2 */
2443 LIT64( 0xC002000000000000 ), /* negative, 3 */
2444 LIT64( 0xC003000000000000 ), /* negative, 4 */
2445 LIT64( 0xC01C000000000000 ), /* negative, 29 */
2446 LIT64( 0xC01D000000000000 ), /* negative, 30 */
2447 LIT64( 0xC01E000000000000 ), /* negative, 31 */
2448 LIT64( 0xC01F000000000000 ), /* negative, 32 */
2449 LIT64( 0xC03C000000000000 ), /* negative, 61 */
2450 LIT64( 0xC03D000000000000 ), /* negative, 62 */
2451 LIT64( 0xC03E000000000000 ), /* negative, 63 */
2452 LIT64( 0xC03F000000000000 ), /* negative, 64 */
2453 LIT64( 0xC070000000000000 ), /* negative, 113 */
2454 LIT64( 0xC07E000000000000 ), /* negative, 127 */
2455 LIT64( 0xC07F000000000000 ), /* negative, 128 */
2456 LIT64( 0xC080000000000000 ), /* negative, 129 */
2457 LIT64( 0xC3FE000000000000 ), /* negative, 1023 */
2458 LIT64( 0xC3FF000000000000 ), /* negative, 1024 */
2459 LIT64( 0xC400000000000000 ), /* negative, 1025 */
2460 LIT64( 0xFFFD000000000000 ), /* negative, 16382 */
2461 LIT64( 0xFFFE000000000000 ), /* negative, 16383 */
2462 LIT64( 0xFFFF000000000000 ) /* negative, infinity or NaN */
2465 static const struct { bits64 high, low; } float128P1[ float128NumP1 ] = {
2466 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000000 ) },
2467 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000001 ) },
2468 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2469 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFE ) }
2472 static const struct { bits64 high, low; } float128P2[ float128NumP2 ] = {
2473 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000000 ) },
2474 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000001 ) },
2475 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000002 ) },
2476 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000004 ) },
2477 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000008 ) },
2478 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000010 ) },
2479 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000020 ) },
2480 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000040 ) },
2481 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000080 ) },
2482 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000100 ) },
2483 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000200 ) },
2484 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000400 ) },
2485 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000800 ) },
2486 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000001000 ) },
2487 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000002000 ) },
2488 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000004000 ) },
2489 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000008000 ) },
2490 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000010000 ) },
2491 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000020000 ) },
2492 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000040000 ) },
2493 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000080000 ) },
2494 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000100000 ) },
2495 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000200000 ) },
2496 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000400000 ) },
2497 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000800000 ) },
2498 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000001000000 ) },
2499 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000002000000 ) },
2500 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000004000000 ) },
2501 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000008000000 ) },
2502 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000010000000 ) },
2503 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000020000000 ) },
2504 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000040000000 ) },
2505 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000080000000 ) },
2506 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000100000000 ) },
2507 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000200000000 ) },
2508 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000400000000 ) },
2509 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000800000000 ) },
2510 { LIT64( 0x0000000000000000 ), LIT64( 0x0000001000000000 ) },
2511 { LIT64( 0x0000000000000000 ), LIT64( 0x0000002000000000 ) },
2512 { LIT64( 0x0000000000000000 ), LIT64( 0x0000004000000000 ) },
2513 { LIT64( 0x0000000000000000 ), LIT64( 0x0000008000000000 ) },
2514 { LIT64( 0x0000000000000000 ), LIT64( 0x0000010000000000 ) },
2515 { LIT64( 0x0000000000000000 ), LIT64( 0x0000020000000000 ) },
2516 { LIT64( 0x0000000000000000 ), LIT64( 0x0000040000000000 ) },
2517 { LIT64( 0x0000000000000000 ), LIT64( 0x0000080000000000 ) },
2518 { LIT64( 0x0000000000000000 ), LIT64( 0x0000100000000000 ) },
2519 { LIT64( 0x0000000000000000 ), LIT64( 0x0000200000000000 ) },
2520 { LIT64( 0x0000000000000000 ), LIT64( 0x0000400000000000 ) },
2521 { LIT64( 0x0000000000000000 ), LIT64( 0x0000800000000000 ) },
2522 { LIT64( 0x0000000000000000 ), LIT64( 0x0001000000000000 ) },
2523 { LIT64( 0x0000000000000000 ), LIT64( 0x0002000000000000 ) },
2524 { LIT64( 0x0000000000000000 ), LIT64( 0x0004000000000000 ) },
2525 { LIT64( 0x0000000000000000 ), LIT64( 0x0008000000000000 ) },
2526 { LIT64( 0x0000000000000000 ), LIT64( 0x0010000000000000 ) },
2527 { LIT64( 0x0000000000000000 ), LIT64( 0x0020000000000000 ) },
2528 { LIT64( 0x0000000000000000 ), LIT64( 0x0040000000000000 ) },
2529 { LIT64( 0x0000000000000000 ), LIT64( 0x0080000000000000 ) },
2530 { LIT64( 0x0000000000000000 ), LIT64( 0x0100000000000000 ) },
2531 { LIT64( 0x0000000000000000 ), LIT64( 0x0200000000000000 ) },
2532 { LIT64( 0x0000000000000000 ), LIT64( 0x0400000000000000 ) },
2533 { LIT64( 0x0000000000000000 ), LIT64( 0x0800000000000000 ) },
2534 { LIT64( 0x0000000000000000 ), LIT64( 0x1000000000000000 ) },
2535 { LIT64( 0x0000000000000000 ), LIT64( 0x2000000000000000 ) },
2536 { LIT64( 0x0000000000000000 ), LIT64( 0x4000000000000000 ) },
2537 { LIT64( 0x0000000000000000 ), LIT64( 0x8000000000000000 ) },
2538 { LIT64( 0x0000000000000001 ), LIT64( 0x0000000000000000 ) },
2539 { LIT64( 0x0000000000000002 ), LIT64( 0x0000000000000000 ) },
2540 { LIT64( 0x0000000000000004 ), LIT64( 0x0000000000000000 ) },
2541 { LIT64( 0x0000000000000008 ), LIT64( 0x0000000000000000 ) },
2542 { LIT64( 0x0000000000000010 ), LIT64( 0x0000000000000000 ) },
2543 { LIT64( 0x0000000000000020 ), LIT64( 0x0000000000000000 ) },
2544 { LIT64( 0x0000000000000040 ), LIT64( 0x0000000000000000 ) },
2545 { LIT64( 0x0000000000000080 ), LIT64( 0x0000000000000000 ) },
2546 { LIT64( 0x0000000000000100 ), LIT64( 0x0000000000000000 ) },
2547 { LIT64( 0x0000000000000200 ), LIT64( 0x0000000000000000 ) },
2548 { LIT64( 0x0000000000000400 ), LIT64( 0x0000000000000000 ) },
2549 { LIT64( 0x0000000000000800 ), LIT64( 0x0000000000000000 ) },
2550 { LIT64( 0x0000000000001000 ), LIT64( 0x0000000000000000 ) },
2551 { LIT64( 0x0000000000002000 ), LIT64( 0x0000000000000000 ) },
2552 { LIT64( 0x0000000000004000 ), LIT64( 0x0000000000000000 ) },
2553 { LIT64( 0x0000000000008000 ), LIT64( 0x0000000000000000 ) },
2554 { LIT64( 0x0000000000010000 ), LIT64( 0x0000000000000000 ) },
2555 { LIT64( 0x0000000000020000 ), LIT64( 0x0000000000000000 ) },
2556 { LIT64( 0x0000000000040000 ), LIT64( 0x0000000000000000 ) },
2557 { LIT64( 0x0000000000080000 ), LIT64( 0x0000000000000000 ) },
2558 { LIT64( 0x0000000000100000 ), LIT64( 0x0000000000000000 ) },
2559 { LIT64( 0x0000000000200000 ), LIT64( 0x0000000000000000 ) },
2560 { LIT64( 0x0000000000400000 ), LIT64( 0x0000000000000000 ) },
2561 { LIT64( 0x0000000000800000 ), LIT64( 0x0000000000000000 ) },
2562 { LIT64( 0x0000000001000000 ), LIT64( 0x0000000000000000 ) },
2563 { LIT64( 0x0000000002000000 ), LIT64( 0x0000000000000000 ) },
2564 { LIT64( 0x0000000004000000 ), LIT64( 0x0000000000000000 ) },
2565 { LIT64( 0x0000000008000000 ), LIT64( 0x0000000000000000 ) },
2566 { LIT64( 0x0000000010000000 ), LIT64( 0x0000000000000000 ) },
2567 { LIT64( 0x0000000020000000 ), LIT64( 0x0000000000000000 ) },
2568 { LIT64( 0x0000000040000000 ), LIT64( 0x0000000000000000 ) },
2569 { LIT64( 0x0000000080000000 ), LIT64( 0x0000000000000000 ) },
2570 { LIT64( 0x0000000100000000 ), LIT64( 0x0000000000000000 ) },
2571 { LIT64( 0x0000000200000000 ), LIT64( 0x0000000000000000 ) },
2572 { LIT64( 0x0000000400000000 ), LIT64( 0x0000000000000000 ) },
2573 { LIT64( 0x0000000800000000 ), LIT64( 0x0000000000000000 ) },
2574 { LIT64( 0x0000001000000000 ), LIT64( 0x0000000000000000 ) },
2575 { LIT64( 0x0000002000000000 ), LIT64( 0x0000000000000000 ) },
2576 { LIT64( 0x0000004000000000 ), LIT64( 0x0000000000000000 ) },
2577 { LIT64( 0x0000008000000000 ), LIT64( 0x0000000000000000 ) },
2578 { LIT64( 0x0000010000000000 ), LIT64( 0x0000000000000000 ) },
2579 { LIT64( 0x0000020000000000 ), LIT64( 0x0000000000000000 ) },
2580 { LIT64( 0x0000040000000000 ), LIT64( 0x0000000000000000 ) },
2581 { LIT64( 0x0000080000000000 ), LIT64( 0x0000000000000000 ) },
2582 { LIT64( 0x0000100000000000 ), LIT64( 0x0000000000000000 ) },
2583 { LIT64( 0x0000200000000000 ), LIT64( 0x0000000000000000 ) },
2584 { LIT64( 0x0000400000000000 ), LIT64( 0x0000000000000000 ) },
2585 { LIT64( 0x0000800000000000 ), LIT64( 0x0000000000000000 ) },
2586 { LIT64( 0x0000C00000000000 ), LIT64( 0x0000000000000000 ) },
2587 { LIT64( 0x0000E00000000000 ), LIT64( 0x0000000000000000 ) },
2588 { LIT64( 0x0000F00000000000 ), LIT64( 0x0000000000000000 ) },
2589 { LIT64( 0x0000F80000000000 ), LIT64( 0x0000000000000000 ) },
2590 { LIT64( 0x0000FC0000000000 ), LIT64( 0x0000000000000000 ) },
2591 { LIT64( 0x0000FE0000000000 ), LIT64( 0x0000000000000000 ) },
2592 { LIT64( 0x0000FF0000000000 ), LIT64( 0x0000000000000000 ) },
2593 { LIT64( 0x0000FF8000000000 ), LIT64( 0x0000000000000000 ) },
2594 { LIT64( 0x0000FFC000000000 ), LIT64( 0x0000000000000000 ) },
2595 { LIT64( 0x0000FFE000000000 ), LIT64( 0x0000000000000000 ) },
2596 { LIT64( 0x0000FFF000000000 ), LIT64( 0x0000000000000000 ) },
2597 { LIT64( 0x0000FFF800000000 ), LIT64( 0x0000000000000000 ) },
2598 { LIT64( 0x0000FFFC00000000 ), LIT64( 0x0000000000000000 ) },
2599 { LIT64( 0x0000FFFE00000000 ), LIT64( 0x0000000000000000 ) },
2600 { LIT64( 0x0000FFFF00000000 ), LIT64( 0x0000000000000000 ) },
2601 { LIT64( 0x0000FFFF80000000 ), LIT64( 0x0000000000000000 ) },
2602 { LIT64( 0x0000FFFFC0000000 ), LIT64( 0x0000000000000000 ) },
2603 { LIT64( 0x0000FFFFE0000000 ), LIT64( 0x0000000000000000 ) },
2604 { LIT64( 0x0000FFFFF0000000 ), LIT64( 0x0000000000000000 ) },
2605 { LIT64( 0x0000FFFFF8000000 ), LIT64( 0x0000000000000000 ) },
2606 { LIT64( 0x0000FFFFFC000000 ), LIT64( 0x0000000000000000 ) },
2607 { LIT64( 0x0000FFFFFE000000 ), LIT64( 0x0000000000000000 ) },
2608 { LIT64( 0x0000FFFFFF000000 ), LIT64( 0x0000000000000000 ) },
2609 { LIT64( 0x0000FFFFFF800000 ), LIT64( 0x0000000000000000 ) },
2610 { LIT64( 0x0000FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
2611 { LIT64( 0x0000FFFFFFE00000 ), LIT64( 0x0000000000000000 ) },
2612 { LIT64( 0x0000FFFFFFF00000 ), LIT64( 0x0000000000000000 ) },
2613 { LIT64( 0x0000FFFFFFF80000 ), LIT64( 0x0000000000000000 ) },
2614 { LIT64( 0x0000FFFFFFFC0000 ), LIT64( 0x0000000000000000 ) },
2615 { LIT64( 0x0000FFFFFFFE0000 ), LIT64( 0x0000000000000000 ) },
2616 { LIT64( 0x0000FFFFFFFF0000 ), LIT64( 0x0000000000000000 ) },
2617 { LIT64( 0x0000FFFFFFFF8000 ), LIT64( 0x0000000000000000 ) },
2618 { LIT64( 0x0000FFFFFFFFC000 ), LIT64( 0x0000000000000000 ) },
2619 { LIT64( 0x0000FFFFFFFFE000 ), LIT64( 0x0000000000000000 ) },
2620 { LIT64( 0x0000FFFFFFFFF000 ), LIT64( 0x0000000000000000 ) },
2621 { LIT64( 0x0000FFFFFFFFF800 ), LIT64( 0x0000000000000000 ) },
2622 { LIT64( 0x0000FFFFFFFFFC00 ), LIT64( 0x0000000000000000 ) },
2623 { LIT64( 0x0000FFFFFFFFFE00 ), LIT64( 0x0000000000000000 ) },
2624 { LIT64( 0x0000FFFFFFFFFF00 ), LIT64( 0x0000000000000000 ) },
2625 { LIT64( 0x0000FFFFFFFFFF80 ), LIT64( 0x0000000000000000 ) },
2626 { LIT64( 0x0000FFFFFFFFFFC0 ), LIT64( 0x0000000000000000 ) },
2627 { LIT64( 0x0000FFFFFFFFFFE0 ), LIT64( 0x0000000000000000 ) },
2628 { LIT64( 0x0000FFFFFFFFFFF0 ), LIT64( 0x0000000000000000 ) },
2629 { LIT64( 0x0000FFFFFFFFFFF8 ), LIT64( 0x0000000000000000 ) },
2630 { LIT64( 0x0000FFFFFFFFFFFC ), LIT64( 0x0000000000000000 ) },
2631 { LIT64( 0x0000FFFFFFFFFFFE ), LIT64( 0x0000000000000000 ) },
2632 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0x0000000000000000 ) },
2633 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0x8000000000000000 ) },
2634 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xC000000000000000 ) },
2635 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xE000000000000000 ) },
2636 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xF000000000000000 ) },
2637 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xF800000000000000 ) },
2638 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFC00000000000000 ) },
2639 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFE00000000000000 ) },
2640 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFF00000000000000 ) },
2641 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFF80000000000000 ) },
2642 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFC0000000000000 ) },
2643 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFE0000000000000 ) },
2644 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFF0000000000000 ) },
2645 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFF8000000000000 ) },
2646 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
2647 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFE000000000000 ) },
2648 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFF000000000000 ) },
2649 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFF800000000000 ) },
2650 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFC00000000000 ) },
2651 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFE00000000000 ) },
2652 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFF00000000000 ) },
2653 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFF80000000000 ) },
2654 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFC0000000000 ) },
2655 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFE0000000000 ) },
2656 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFF0000000000 ) },
2657 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFF8000000000 ) },
2658 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFC000000000 ) },
2659 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFE000000000 ) },
2660 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFF000000000 ) },
2661 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFF800000000 ) },
2662 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFC00000000 ) },
2663 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFE00000000 ) },
2664 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFF00000000 ) },
2665 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFF80000000 ) },
2666 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFC0000000 ) },
2667 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFE0000000 ) },
2668 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
2669 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFF8000000 ) },
2670 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFC000000 ) },
2671 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFE000000 ) },
2672 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFF000000 ) },
2673 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFF800000 ) },
2674 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFC00000 ) },
2675 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFE00000 ) },
2676 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFF00000 ) },
2677 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFF80000 ) },
2678 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFC0000 ) },
2679 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFE0000 ) },
2680 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFF0000 ) },
2681 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFF8000 ) },
2682 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFC000 ) },
2683 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFE000 ) },
2684 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFF000 ) },
2685 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFF800 ) },
2686 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFC00 ) },
2687 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFE00 ) },
2688 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFF00 ) },
2689 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFF80 ) },
2690 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFC0 ) },
2691 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFE0 ) },
2692 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFF0 ) },
2693 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFF8 ) },
2694 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFC ) },
2695 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFE ) },
2696 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2697 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFD ) },
2698 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFB ) },
2699 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFF7 ) },
2700 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFEF ) },
2701 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFDF ) },
2702 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFBF ) },
2703 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFF7F ) },
2704 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFEFF ) },
2705 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFDFF ) },
2706 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFF ) },
2707 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFF7FF ) },
2708 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
2709 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFDFFF ) },
2710 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFBFFF ) },
2711 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFF7FFF ) },
2712 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFEFFFF ) },
2713 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFDFFFF ) },
2714 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFBFFFF ) },
2715 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
2716 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFEFFFFF ) },
2717 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFDFFFFF ) },
2718 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFBFFFFF ) },
2719 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFF7FFFFF ) },
2720 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFEFFFFFF ) },
2721 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFDFFFFFF ) },
2722 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFBFFFFFF ) },
2723 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFF7FFFFFF ) },
2724 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
2725 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFDFFFFFFF ) },
2726 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFFBFFFFFFF ) },
2727 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFF7FFFFFFF ) },
2728 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFFFF ) },
2729 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFDFFFFFFFF ) },
2730 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFFBFFFFFFFF ) },
2731 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFF7FFFFFFFF ) },
2732 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFEFFFFFFFFF ) },
2733 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFDFFFFFFFFF ) },
2734 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFFBFFFFFFFFF ) },
2735 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFF7FFFFFFFFF ) },
2736 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFEFFFFFFFFFF ) },
2737 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFDFFFFFFFFFF ) },
2738 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFFBFFFFFFFFFF ) },
2739 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFF7FFFFFFFFFF ) },
2740 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFEFFFFFFFFFFF ) },
2741 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFDFFFFFFFFFFF ) },
2742 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFFBFFFFFFFFFFF ) },
2743 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFF7FFFFFFFFFFF ) },
2744 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFEFFFFFFFFFFFF ) },
2745 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFDFFFFFFFFFFFF ) },
2746 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFFBFFFFFFFFFFFF ) },
2747 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFF7FFFFFFFFFFFF ) },
2748 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFEFFFFFFFFFFFFF ) },
2749 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFDFFFFFFFFFFFFF ) },
2750 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFFBFFFFFFFFFFFFF ) },
2751 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFF7FFFFFFFFFFFFF ) },
2752 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFEFFFFFFFFFFFFFF ) },
2753 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFDFFFFFFFFFFFFFF ) },
2754 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xFBFFFFFFFFFFFFFF ) },
2755 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xF7FFFFFFFFFFFFFF ) },
2756 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xEFFFFFFFFFFFFFFF ) },
2757 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xDFFFFFFFFFFFFFFF ) },
2758 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0xBFFFFFFFFFFFFFFF ) },
2759 { LIT64( 0x0000FFFFFFFFFFFF ), LIT64( 0x7FFFFFFFFFFFFFFF ) },
2760 { LIT64( 0x0000FFFFFFFFFFFD ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2761 { LIT64( 0x0000FFFFFFFFFFFB ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2762 { LIT64( 0x0000FFFFFFFFFFF7 ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2763 { LIT64( 0x0000FFFFFFFFFFEF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2764 { LIT64( 0x0000FFFFFFFFFFDF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2765 { LIT64( 0x0000FFFFFFFFFFBF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2766 { LIT64( 0x0000FFFFFFFFFF7F ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2767 { LIT64( 0x0000FFFFFFFFFEFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2768 { LIT64( 0x0000FFFFFFFFFDFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2769 { LIT64( 0x0000FFFFFFFFFBFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2770 { LIT64( 0x0000FFFFFFFFF7FF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2771 { LIT64( 0x0000FFFFFFFFEFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2772 { LIT64( 0x0000FFFFFFFFDFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2773 { LIT64( 0x0000FFFFFFFFBFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2774 { LIT64( 0x0000FFFFFFFF7FFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2775 { LIT64( 0x0000FFFFFFFEFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2776 { LIT64( 0x0000FFFFFFFDFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2777 { LIT64( 0x0000FFFFFFFBFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2778 { LIT64( 0x0000FFFFFFF7FFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2779 { LIT64( 0x0000FFFFFFEFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2780 { LIT64( 0x0000FFFFFFDFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2781 { LIT64( 0x0000FFFFFFBFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2782 { LIT64( 0x0000FFFFFF7FFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2783 { LIT64( 0x0000FFFFFEFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2784 { LIT64( 0x0000FFFFFDFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2785 { LIT64( 0x0000FFFFFBFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2786 { LIT64( 0x0000FFFFF7FFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2787 { LIT64( 0x0000FFFFEFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2788 { LIT64( 0x0000FFFFDFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2789 { LIT64( 0x0000FFFFBFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2790 { LIT64( 0x0000FFFF7FFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2791 { LIT64( 0x0000FFFEFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2792 { LIT64( 0x0000FFFDFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2793 { LIT64( 0x0000FFFBFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2794 { LIT64( 0x0000FFF7FFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2795 { LIT64( 0x0000FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2796 { LIT64( 0x0000FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2797 { LIT64( 0x0000FFBFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2798 { LIT64( 0x0000FF7FFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2799 { LIT64( 0x0000FEFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2800 { LIT64( 0x0000FDFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2801 { LIT64( 0x0000FBFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2802 { LIT64( 0x0000F7FFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2803 { LIT64( 0x0000EFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2804 { LIT64( 0x0000DFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2805 { LIT64( 0x0000BFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2806 { LIT64( 0x00007FFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2807 { LIT64( 0x00003FFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2808 { LIT64( 0x00001FFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2809 { LIT64( 0x00000FFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2810 { LIT64( 0x000007FFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2811 { LIT64( 0x000003FFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2812 { LIT64( 0x000001FFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2813 { LIT64( 0x000000FFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2814 { LIT64( 0x0000007FFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2815 { LIT64( 0x0000003FFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2816 { LIT64( 0x0000001FFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2817 { LIT64( 0x0000000FFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2818 { LIT64( 0x00000007FFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2819 { LIT64( 0x00000003FFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2820 { LIT64( 0x00000001FFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2821 { LIT64( 0x00000000FFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2822 { LIT64( 0x000000007FFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2823 { LIT64( 0x000000003FFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2824 { LIT64( 0x000000001FFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2825 { LIT64( 0x000000000FFFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2826 { LIT64( 0x0000000007FFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2827 { LIT64( 0x0000000003FFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2828 { LIT64( 0x0000000001FFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2829 { LIT64( 0x0000000000FFFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2830 { LIT64( 0x00000000007FFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2831 { LIT64( 0x00000000003FFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2832 { LIT64( 0x00000000001FFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2833 { LIT64( 0x00000000000FFFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2834 { LIT64( 0x000000000007FFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2835 { LIT64( 0x000000000003FFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2836 { LIT64( 0x000000000001FFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2837 { LIT64( 0x000000000000FFFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2838 { LIT64( 0x0000000000007FFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2839 { LIT64( 0x0000000000003FFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2840 { LIT64( 0x0000000000001FFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2841 { LIT64( 0x0000000000000FFF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2842 { LIT64( 0x00000000000007FF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2843 { LIT64( 0x00000000000003FF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2844 { LIT64( 0x00000000000001FF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2845 { LIT64( 0x00000000000000FF ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2846 { LIT64( 0x000000000000007F ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2847 { LIT64( 0x000000000000003F ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2848 { LIT64( 0x000000000000001F ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2849 { LIT64( 0x000000000000000F ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2850 { LIT64( 0x0000000000000007 ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2851 { LIT64( 0x0000000000000003 ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2852 { LIT64( 0x0000000000000001 ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2853 { LIT64( 0x0000000000000000 ), LIT64( 0xFFFFFFFFFFFFFFFF ) },
2854 { LIT64( 0x0000000000000000 ), LIT64( 0x7FFFFFFFFFFFFFFF ) },
2855 { LIT64( 0x0000000000000000 ), LIT64( 0x3FFFFFFFFFFFFFFF ) },
2856 { LIT64( 0x0000000000000000 ), LIT64( 0x1FFFFFFFFFFFFFFF ) },
2857 { LIT64( 0x0000000000000000 ), LIT64( 0x0FFFFFFFFFFFFFFF ) },
2858 { LIT64( 0x0000000000000000 ), LIT64( 0x07FFFFFFFFFFFFFF ) },
2859 { LIT64( 0x0000000000000000 ), LIT64( 0x03FFFFFFFFFFFFFF ) },
2860 { LIT64( 0x0000000000000000 ), LIT64( 0x01FFFFFFFFFFFFFF ) },
2861 { LIT64( 0x0000000000000000 ), LIT64( 0x00FFFFFFFFFFFFFF ) },
2862 { LIT64( 0x0000000000000000 ), LIT64( 0x007FFFFFFFFFFFFF ) },
2863 { LIT64( 0x0000000000000000 ), LIT64( 0x003FFFFFFFFFFFFF ) },
2864 { LIT64( 0x0000000000000000 ), LIT64( 0x001FFFFFFFFFFFFF ) },
2865 { LIT64( 0x0000000000000000 ), LIT64( 0x000FFFFFFFFFFFFF ) },
2866 { LIT64( 0x0000000000000000 ), LIT64( 0x0007FFFFFFFFFFFF ) },
2867 { LIT64( 0x0000000000000000 ), LIT64( 0x0003FFFFFFFFFFFF ) },
2868 { LIT64( 0x0000000000000000 ), LIT64( 0x0001FFFFFFFFFFFF ) },
2869 { LIT64( 0x0000000000000000 ), LIT64( 0x0000FFFFFFFFFFFF ) },
2870 { LIT64( 0x0000000000000000 ), LIT64( 0x00007FFFFFFFFFFF ) },
2871 { LIT64( 0x0000000000000000 ), LIT64( 0x00003FFFFFFFFFFF ) },
2872 { LIT64( 0x0000000000000000 ), LIT64( 0x00001FFFFFFFFFFF ) },
2873 { LIT64( 0x0000000000000000 ), LIT64( 0x00000FFFFFFFFFFF ) },
2874 { LIT64( 0x0000000000000000 ), LIT64( 0x000007FFFFFFFFFF ) },
2875 { LIT64( 0x0000000000000000 ), LIT64( 0x000003FFFFFFFFFF ) },
2876 { LIT64( 0x0000000000000000 ), LIT64( 0x000001FFFFFFFFFF ) },
2877 { LIT64( 0x0000000000000000 ), LIT64( 0x000000FFFFFFFFFF ) },
2878 { LIT64( 0x0000000000000000 ), LIT64( 0x0000007FFFFFFFFF ) },
2879 { LIT64( 0x0000000000000000 ), LIT64( 0x0000003FFFFFFFFF ) },
2880 { LIT64( 0x0000000000000000 ), LIT64( 0x0000001FFFFFFFFF ) },
2881 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000FFFFFFFFF ) },
2882 { LIT64( 0x0000000000000000 ), LIT64( 0x00000007FFFFFFFF ) },
2883 { LIT64( 0x0000000000000000 ), LIT64( 0x00000003FFFFFFFF ) },
2884 { LIT64( 0x0000000000000000 ), LIT64( 0x00000001FFFFFFFF ) },
2885 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000FFFFFFFF ) },
2886 { LIT64( 0x0000000000000000 ), LIT64( 0x000000007FFFFFFF ) },
2887 { LIT64( 0x0000000000000000 ), LIT64( 0x000000003FFFFFFF ) },
2888 { LIT64( 0x0000000000000000 ), LIT64( 0x000000001FFFFFFF ) },
2889 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000FFFFFFF ) },
2890 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000007FFFFFF ) },
2891 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000003FFFFFF ) },
2892 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000001FFFFFF ) },
2893 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000FFFFFF ) },
2894 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000007FFFFF ) },
2895 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000003FFFFF ) },
2896 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000001FFFFF ) },
2897 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000000FFFFF ) },
2898 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000007FFFF ) },
2899 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000003FFFF ) },
2900 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000001FFFF ) },
2901 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000000FFFF ) },
2902 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000007FFF ) },
2903 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000003FFF ) },
2904 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000001FFF ) },
2905 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000FFF ) },
2906 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000000007FF ) },
2907 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000000003FF ) },
2908 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000000001FF ) },
2909 { LIT64( 0x0000000000000000 ), LIT64( 0x00000000000000FF ) },
2910 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000000007F ) },
2911 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000000003F ) },
2912 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000000001F ) },
2913 { LIT64( 0x0000000000000000 ), LIT64( 0x000000000000000F ) },
2914 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000007 ) },
2915 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000003 ) }
2918 static const uint32 float128NumQInP1 = float128NumQIn * float128NumP1;
2919 static const uint32 float128NumQOutP1 = float128NumQOut * float128NumP1;
2921 static float128 float128NextQInP1( sequenceT *sequencePtr )
2923 int16 expNum, sigNum;
2924 float128 z;
2926 sigNum = sequencePtr->term1Num;
2927 expNum = sequencePtr->expNum;
2928 z.low = float128P1[ sigNum ].low;
2929 z.high = float128QIn[ expNum ] | float128P1[ sigNum ].high;
2930 ++sigNum;
2931 if ( float128NumP1 <= sigNum ) {
2932 sigNum = 0;
2933 ++expNum;
2934 if ( float128NumQIn <= expNum ) {
2935 expNum = 0;
2936 sequencePtr->done = TRUE;
2938 sequencePtr->expNum = expNum;
2940 sequencePtr->term1Num = sigNum;
2941 return z;
2945 static float128 float128NextQOutP1( sequenceT *sequencePtr )
2947 int16 expNum, sigNum;
2948 float128 z;
2950 sigNum = sequencePtr->term1Num;
2951 expNum = sequencePtr->expNum;
2952 z.low = float128P1[ sigNum ].low;
2953 z.high = float128QOut[ expNum ] | float128P1[ sigNum ].high;
2954 ++sigNum;
2955 if ( float128NumP1 <= sigNum ) {
2956 sigNum = 0;
2957 ++expNum;
2958 if ( float128NumQOut <= expNum ) {
2959 expNum = 0;
2960 sequencePtr->done = TRUE;
2962 sequencePtr->expNum = expNum;
2964 sequencePtr->term1Num = sigNum;
2965 return z;
2969 static const uint32 float128NumQInP2 = float128NumQIn * float128NumP2;
2970 static const uint32 float128NumQOutP2 = float128NumQOut * float128NumP2;
2972 static float128 float128NextQInP2( sequenceT *sequencePtr )
2974 int16 expNum, sigNum;
2975 float128 z;
2977 sigNum = sequencePtr->term1Num;
2978 expNum = sequencePtr->expNum;
2979 z.low = float128P2[ sigNum ].low;
2980 z.high = float128QIn[ expNum ] | float128P2[ sigNum ].high;
2981 ++sigNum;
2982 if ( float128NumP2 <= sigNum ) {
2983 sigNum = 0;
2984 ++expNum;
2985 if ( float128NumQIn <= expNum ) {
2986 expNum = 0;
2987 sequencePtr->done = TRUE;
2989 sequencePtr->expNum = expNum;
2991 sequencePtr->term1Num = sigNum;
2992 return z;
2996 static float128 float128NextQOutP2( sequenceT *sequencePtr )
2998 int16 expNum, sigNum;
2999 float128 z;
3001 sigNum = sequencePtr->term1Num;
3002 expNum = sequencePtr->expNum;
3003 z.low = float128P2[ sigNum ].low;
3004 z.high = float128QOut[ expNum ] | float128P2[ sigNum ].high;
3005 ++sigNum;
3006 if ( float128NumP2 <= sigNum ) {
3007 sigNum = 0;
3008 ++expNum;
3009 if ( float128NumQOut <= expNum ) {
3010 expNum = 0;
3011 sequencePtr->done = TRUE;
3013 sequencePtr->expNum = expNum;
3015 sequencePtr->term1Num = sigNum;
3016 return z;
3020 static float128 float128RandomQOutP3( void )
3022 int16 sigNum1, sigNum2;
3023 uint64 sig1Low, sig2Low;
3024 float128 z;
3026 sigNum1 = randomUint8() % float128NumP2;
3027 sigNum2 = randomUint8() % float128NumP2;
3028 sig1Low = float128P2[ sigNum1 ].low;
3029 sig2Low = float128P2[ sigNum2 ].low;
3030 z.low = sig1Low + sig2Low;
3031 z.high =
3032 float128QOut[ randomUint8() % float128NumQOut ]
3033 | ( ( float128P2[ sigNum1 ].high
3034 + float128P2[ sigNum2 ].high
3035 + ( z.low < sig1Low )
3037 & LIT64( 0x0000FFFFFFFFFFFF )
3039 return z;
3043 static float128 float128RandomQOutPInf( void )
3045 float128 z;
3047 z.low = randomUint64();
3048 z.high =
3049 float128QOut[ randomUint8() % float128NumQOut ]
3050 | ( randomUint64() & LIT64( 0x0000FFFFFFFFFFFF ) );
3051 return z;
3055 enum {
3056 float128NumQInfWeightMasks = 14
3059 static const uint64 float128QInfWeightMasks[ float128NumQInfWeightMasks ] = {
3060 LIT64( 0x7FFF000000000000 ),
3061 LIT64( 0x7FFF000000000000 ),
3062 LIT64( 0x3FFF000000000000 ),
3063 LIT64( 0x1FFF000000000000 ),
3064 LIT64( 0x07FF000000000000 ),
3065 LIT64( 0x07FF000000000000 ),
3066 LIT64( 0x03FF000000000000 ),
3067 LIT64( 0x01FF000000000000 ),
3068 LIT64( 0x00FF000000000000 ),
3069 LIT64( 0x007F000000000000 ),
3070 LIT64( 0x003F000000000000 ),
3071 LIT64( 0x001F000000000000 ),
3072 LIT64( 0x000F000000000000 ),
3073 LIT64( 0x0007000000000000 )
3076 static const uint64 float128QInfWeightOffsets[ float128NumQInfWeightMasks ] = {
3077 LIT64( 0x0000000000000000 ),
3078 LIT64( 0x0000000000000000 ),
3079 LIT64( 0x2000000000000000 ),
3080 LIT64( 0x3000000000000000 ),
3081 LIT64( 0x3800000000000000 ),
3082 LIT64( 0x3C00000000000000 ),
3083 LIT64( 0x3E00000000000000 ),
3084 LIT64( 0x3F00000000000000 ),
3085 LIT64( 0x3F80000000000000 ),
3086 LIT64( 0x3FC0000000000000 ),
3087 LIT64( 0x3FE0000000000000 ),
3088 LIT64( 0x3FF0000000000000 ),
3089 LIT64( 0x3FF8000000000000 ),
3090 LIT64( 0x3FFC000000000000 )
3093 static float128 float128RandomQInfP3( void )
3095 int16 sigNum1, sigNum2;
3096 uint64 sig1Low, sig2Low;
3097 int8 weightMaskNum;
3098 float128 z;
3100 sigNum1 = randomUint8() % float128NumP2;
3101 sigNum2 = randomUint8() % float128NumP2;
3102 sig1Low = float128P2[ sigNum1 ].low;
3103 sig2Low = float128P2[ sigNum2 ].low;
3104 z.low = sig1Low + sig2Low;
3105 weightMaskNum = randomUint8() % float128NumQInfWeightMasks;
3106 z.high =
3107 ( ( (uint64) ( randomUint8() & 1 ) )<<63 )
3108 | ( ( ( ( (uint64) randomUint16() )<<48 )
3109 & float128QInfWeightMasks[ weightMaskNum ] )
3110 + float128QInfWeightOffsets[ weightMaskNum ]
3112 | ( ( float128P2[ sigNum1 ].high
3113 + float128P2[ sigNum2 ].high
3114 + ( z.low < sig1Low )
3116 & LIT64( 0x0000FFFFFFFFFFFF )
3118 return z;
3122 static float128 float128RandomQInfPInf( void )
3124 int8 weightMaskNum;
3125 float128 z;
3127 weightMaskNum = randomUint8() % float128NumQInfWeightMasks;
3128 z.low = randomUint64();
3129 z.high =
3130 ( ( (uint64) ( randomUint8() & 1 ) )<<63 )
3131 | ( ( ( ( (uint64) randomUint16() )<<48 )
3132 & float128QInfWeightMasks[ weightMaskNum ] )
3133 + float128QInfWeightOffsets[ weightMaskNum ]
3135 | ( randomUint64() & LIT64( 0x0000FFFFFFFFFFFF ) );
3136 return z;
3140 static float128 float128Random( void )
3143 switch ( randomUint8() & 7 ) {
3144 case 0:
3145 case 1:
3146 case 2:
3147 return float128RandomQOutP3();
3148 case 3:
3149 return float128RandomQOutPInf();
3150 case 4:
3151 case 5:
3152 case 6:
3153 return float128RandomQInfP3();
3154 case 7:
3155 return float128RandomQInfPInf();
3160 #endif
3162 static int8 level = 0;
3164 void testCases_setLevel( int8 levelIn )
3167 if ( ( levelIn < 1 ) || ( 2 < levelIn ) ) {
3168 fail( "Invalid testing level: %d", levelIn );
3170 level = levelIn;
3174 static int8 sequenceType;
3175 static sequenceT sequenceA, sequenceB;
3176 static int8 subcase;
3178 uint32 testCases_total;
3179 flag testCases_done;
3181 static float32 current_a_float32;
3182 static float32 current_b_float32;
3183 static float64 current_a_float64;
3184 static float64 current_b_float64;
3185 #ifdef FLOATX80
3186 static floatx80 current_a_floatx80;
3187 static floatx80 current_b_floatx80;
3188 #endif
3189 #ifdef FLOAT128
3190 static float128 current_a_float128;
3191 static float128 current_b_float128;
3192 #endif
3194 void testCases_initSequence( int8 sequenceTypeIn )
3197 sequenceType = sequenceTypeIn;
3198 sequenceA.term2Num = 0;
3199 sequenceA.term1Num = 0;
3200 sequenceA.expNum = 0;
3201 sequenceA.done = FALSE;
3202 sequenceB.term2Num = 0;
3203 sequenceB.term1Num = 0;
3204 sequenceB.expNum = 0;
3205 sequenceB.done = FALSE;
3206 subcase = 0;
3207 switch ( level ) {
3208 case 1:
3209 switch ( sequenceTypeIn ) {
3210 case testCases_sequence_a_int32:
3211 testCases_total = 3 * int32NumP1;
3212 break;
3213 #ifdef BITS64
3214 case testCases_sequence_a_int64:
3215 testCases_total = 3 * int64NumP1;
3216 break;
3217 #endif
3218 case testCases_sequence_a_float32:
3219 testCases_total = 3 * float32NumQOutP1;
3220 break;
3221 case testCases_sequence_ab_float32:
3222 testCases_total = 6 * float32NumQInP1 * float32NumQInP1;
3223 current_a_float32 = float32NextQInP1( &sequenceA );
3224 break;
3225 case testCases_sequence_a_float64:
3226 testCases_total = 3 * float64NumQOutP1;
3227 break;
3228 case testCases_sequence_ab_float64:
3229 testCases_total = 6 * float64NumQInP1 * float64NumQInP1;
3230 current_a_float64 = float64NextQInP1( &sequenceA );
3231 break;
3232 #ifdef FLOATX80
3233 case testCases_sequence_a_floatx80:
3234 testCases_total = 3 * floatx80NumQOutP1;
3235 break;
3236 case testCases_sequence_ab_floatx80:
3237 testCases_total = 6 * floatx80NumQInP1 * floatx80NumQInP1;
3238 current_a_floatx80 = floatx80NextQInP1( &sequenceA );
3239 break;
3240 #endif
3241 #ifdef FLOAT128
3242 case testCases_sequence_a_float128:
3243 testCases_total = 3 * float128NumQOutP1;
3244 break;
3245 case testCases_sequence_ab_float128:
3246 testCases_total = 6 * float128NumQInP1 * float128NumQInP1;
3247 current_a_float128 = float128NextQInP1( &sequenceA );
3248 break;
3249 #endif
3251 break;
3252 case 2:
3253 switch ( sequenceTypeIn ) {
3254 case testCases_sequence_a_int32:
3255 testCases_total = 2 * int32NumP2;
3256 break;
3257 #ifdef BITS64
3258 case testCases_sequence_a_int64:
3259 testCases_total = 2 * int64NumP2;
3260 break;
3261 #endif
3262 case testCases_sequence_a_float32:
3263 testCases_total = 2 * float32NumQOutP2;
3264 break;
3265 case testCases_sequence_ab_float32:
3266 testCases_total = 2 * float32NumQInP2 * float32NumQInP2;
3267 current_a_float32 = float32NextQInP2( &sequenceA );
3268 break;
3269 case testCases_sequence_a_float64:
3270 testCases_total = 2 * float64NumQOutP2;
3271 break;
3272 case testCases_sequence_ab_float64:
3273 testCases_total = 2 * float64NumQInP2 * float64NumQInP2;
3274 current_a_float64 = float64NextQInP2( &sequenceA );
3275 break;
3276 #ifdef FLOATX80
3277 case testCases_sequence_a_floatx80:
3278 testCases_total = 2 * floatx80NumQOutP2;
3279 break;
3280 case testCases_sequence_ab_floatx80:
3281 testCases_total = 2 * floatx80NumQInP2 * floatx80NumQInP2;
3282 current_a_floatx80 = floatx80NextQInP2( &sequenceA );
3283 break;
3284 #endif
3285 #ifdef FLOAT128
3286 case testCases_sequence_a_float128:
3287 testCases_total = 2 * float128NumQOutP2;
3288 break;
3289 case testCases_sequence_ab_float128:
3290 testCases_total = 2 * float128NumQInP2 * float128NumQInP2;
3291 current_a_float128 = float128NextQInP2( &sequenceA );
3292 break;
3293 #endif
3295 break;
3297 testCases_done = FALSE;
3301 int32 testCases_a_int32;
3302 #ifdef BITS64
3303 int64 testCases_a_int64;
3304 #endif
3305 float32 testCases_a_float32;
3306 float32 testCases_b_float32;
3307 float64 testCases_a_float64;
3308 float64 testCases_b_float64;
3309 #ifdef FLOATX80
3310 floatx80 testCases_a_floatx80;
3311 floatx80 testCases_b_floatx80;
3312 #endif
3313 #ifdef FLOAT128
3314 float128 testCases_a_float128;
3315 float128 testCases_b_float128;
3316 #endif
3318 void testCases_next( void )
3321 switch ( level ) {
3322 case 1:
3323 switch ( sequenceType ) {
3324 case testCases_sequence_a_int32:
3325 switch ( subcase ) {
3326 case 0:
3327 testCases_a_int32 = int32RandomP3();
3328 break;
3329 case 1:
3330 testCases_a_int32 = int32RandomPInf();
3331 break;
3332 case 2:
3333 testCases_a_int32 = int32NextP1( &sequenceA );
3334 testCases_done = sequenceA.done;
3335 subcase = -1;
3336 break;
3338 ++subcase;
3339 break;
3340 #ifdef BITS64
3341 case testCases_sequence_a_int64:
3342 switch ( subcase ) {
3343 case 0:
3344 testCases_a_int64 = int64RandomP3();
3345 break;
3346 case 1:
3347 testCases_a_int64 = int64RandomPInf();
3348 break;
3349 case 2:
3350 testCases_a_int64 = int64NextP1( &sequenceA );
3351 testCases_done = sequenceA.done;
3352 subcase = -1;
3353 break;
3355 ++subcase;
3356 break;
3357 #endif
3358 case testCases_sequence_a_float32:
3359 switch ( subcase ) {
3360 case 0:
3361 case 1:
3362 testCases_a_float32 = float32Random();
3363 break;
3364 case 2:
3365 testCases_a_float32 = float32NextQOutP1( &sequenceA );
3366 testCases_done = sequenceA.done;
3367 subcase = -1;
3368 break;
3370 ++subcase;
3371 break;
3372 case testCases_sequence_ab_float32:
3373 switch ( subcase ) {
3374 case 0:
3375 if ( sequenceB.done ) {
3376 sequenceB.done = FALSE;
3377 current_a_float32 = float32NextQInP1( &sequenceA );
3379 current_b_float32 = float32NextQInP1( &sequenceB );
3380 case 2:
3381 case 4:
3382 testCases_a_float32 = float32Random();
3383 testCases_b_float32 = float32Random();
3384 break;
3385 case 1:
3386 testCases_a_float32 = current_a_float32;
3387 testCases_b_float32 = float32Random();
3388 break;
3389 case 3:
3390 testCases_a_float32 = float32Random();
3391 testCases_b_float32 = current_b_float32;
3392 break;
3393 case 5:
3394 testCases_a_float32 = current_a_float32;
3395 testCases_b_float32 = current_b_float32;
3396 testCases_done = sequenceA.done & sequenceB.done;
3397 subcase = -1;
3398 break;
3400 ++subcase;
3401 break;
3402 case testCases_sequence_a_float64:
3403 switch ( subcase ) {
3404 case 0:
3405 case 1:
3406 testCases_a_float64 = float64Random();
3407 break;
3408 case 2:
3409 testCases_a_float64 = float64NextQOutP1( &sequenceA );
3410 testCases_done = sequenceA.done;
3411 subcase = -1;
3412 break;
3414 ++subcase;
3415 break;
3416 case testCases_sequence_ab_float64:
3417 switch ( subcase ) {
3418 case 0:
3419 if ( sequenceB.done ) {
3420 sequenceB.done = FALSE;
3421 current_a_float64 = float64NextQInP1( &sequenceA );
3423 current_b_float64 = float64NextQInP1( &sequenceB );
3424 case 2:
3425 case 4:
3426 testCases_a_float64 = float64Random();
3427 testCases_b_float64 = float64Random();
3428 break;
3429 case 1:
3430 testCases_a_float64 = current_a_float64;
3431 testCases_b_float64 = float64Random();
3432 break;
3433 case 3:
3434 testCases_a_float64 = float64Random();
3435 testCases_b_float64 = current_b_float64;
3436 break;
3437 case 5:
3438 testCases_a_float64 = current_a_float64;
3439 testCases_b_float64 = current_b_float64;
3440 testCases_done = sequenceA.done & sequenceB.done;
3441 subcase = -1;
3442 break;
3444 ++subcase;
3445 break;
3446 #ifdef FLOATX80
3447 case testCases_sequence_a_floatx80:
3448 switch ( subcase ) {
3449 case 0:
3450 case 1:
3451 testCases_a_floatx80 = floatx80Random();
3452 break;
3453 case 2:
3454 testCases_a_floatx80 = floatx80NextQOutP1( &sequenceA );
3455 testCases_done = sequenceA.done;
3456 subcase = -1;
3457 break;
3459 ++subcase;
3460 break;
3461 case testCases_sequence_ab_floatx80:
3462 switch ( subcase ) {
3463 case 0:
3464 if ( sequenceB.done ) {
3465 sequenceB.done = FALSE;
3466 current_a_floatx80 = floatx80NextQInP1( &sequenceA );
3468 current_b_floatx80 = floatx80NextQInP1( &sequenceB );
3469 case 2:
3470 case 4:
3471 testCases_a_floatx80 = floatx80Random();
3472 testCases_b_floatx80 = floatx80Random();
3473 break;
3474 case 1:
3475 testCases_a_floatx80 = current_a_floatx80;
3476 testCases_b_floatx80 = floatx80Random();
3477 break;
3478 case 3:
3479 testCases_a_floatx80 = floatx80Random();
3480 testCases_b_floatx80 = current_b_floatx80;
3481 break;
3482 case 5:
3483 testCases_a_floatx80 = current_a_floatx80;
3484 testCases_b_floatx80 = current_b_floatx80;
3485 testCases_done = sequenceA.done & sequenceB.done;
3486 subcase = -1;
3487 break;
3489 ++subcase;
3490 break;
3491 #endif
3492 #ifdef FLOAT128
3493 case testCases_sequence_a_float128:
3494 switch ( subcase ) {
3495 case 0:
3496 case 1:
3497 testCases_a_float128 = float128Random();
3498 break;
3499 case 2:
3500 testCases_a_float128 = float128NextQOutP1( &sequenceA );
3501 testCases_done = sequenceA.done;
3502 subcase = -1;
3503 break;
3505 ++subcase;
3506 break;
3507 case testCases_sequence_ab_float128:
3508 switch ( subcase ) {
3509 case 0:
3510 if ( sequenceB.done ) {
3511 sequenceB.done = FALSE;
3512 current_a_float128 = float128NextQInP1( &sequenceA );
3514 current_b_float128 = float128NextQInP1( &sequenceB );
3515 case 2:
3516 case 4:
3517 testCases_a_float128 = float128Random();
3518 testCases_b_float128 = float128Random();
3519 break;
3520 case 1:
3521 testCases_a_float128 = current_a_float128;
3522 testCases_b_float128 = float128Random();
3523 break;
3524 case 3:
3525 testCases_a_float128 = float128Random();
3526 testCases_b_float128 = current_b_float128;
3527 break;
3528 case 5:
3529 testCases_a_float128 = current_a_float128;
3530 testCases_b_float128 = current_b_float128;
3531 testCases_done = sequenceA.done & sequenceB.done;
3532 subcase = -1;
3533 break;
3535 ++subcase;
3536 break;
3537 #endif
3539 break;
3540 case 2:
3541 switch ( sequenceType ) {
3542 case testCases_sequence_a_int32:
3543 switch ( subcase ) {
3544 case 0:
3545 testCases_a_int32 = int32RandomP3();
3546 break;
3547 case 2:
3548 testCases_a_int32 = int32RandomPInf();
3549 break;
3550 case 3:
3551 subcase = -1;
3552 case 1:
3553 testCases_a_int32 = int32NextP2( &sequenceA );
3554 testCases_done = sequenceA.done;
3555 break;
3557 ++subcase;
3558 break;
3559 #ifdef BITS64
3560 case testCases_sequence_a_int64:
3561 switch ( subcase ) {
3562 case 0:
3563 testCases_a_int64 = int64RandomP3();
3564 break;
3565 case 2:
3566 testCases_a_int64 = int64RandomPInf();
3567 break;
3568 case 3:
3569 subcase = -1;
3570 case 1:
3571 testCases_a_int64 = int64NextP2( &sequenceA );
3572 testCases_done = sequenceA.done;
3573 break;
3575 ++subcase;
3576 break;
3577 #endif
3578 case testCases_sequence_a_float32:
3579 switch ( subcase ) {
3580 case 0:
3581 testCases_a_float32 = float32Random();
3582 break;
3583 case 1:
3584 testCases_a_float32 = float32NextQOutP2( &sequenceA );
3585 testCases_done = sequenceA.done;
3586 subcase = -1;
3587 break;
3589 ++subcase;
3590 break;
3591 case testCases_sequence_ab_float32:
3592 switch ( subcase ) {
3593 case 0:
3594 testCases_a_float32 = float32Random();
3595 testCases_b_float32 = float32Random();
3596 break;
3597 case 1:
3598 if ( sequenceB.done ) {
3599 sequenceB.done = FALSE;
3600 current_a_float32 = float32NextQInP2( &sequenceA );
3602 testCases_a_float32 = current_a_float32;
3603 testCases_b_float32 = float32NextQInP2( &sequenceB );
3604 testCases_done = sequenceA.done & sequenceB.done;
3605 subcase = -1;
3606 break;
3608 ++subcase;
3609 break;
3610 case testCases_sequence_a_float64:
3611 switch ( subcase ) {
3612 case 0:
3613 testCases_a_float64 = float64Random();
3614 break;
3615 case 1:
3616 testCases_a_float64 = float64NextQOutP2( &sequenceA );
3617 testCases_done = sequenceA.done;
3618 subcase = -1;
3619 break;
3621 ++subcase;
3622 break;
3623 case testCases_sequence_ab_float64:
3624 switch ( subcase ) {
3625 case 0:
3626 testCases_a_float64 = float64Random();
3627 testCases_b_float64 = float64Random();
3628 break;
3629 case 1:
3630 if ( sequenceB.done ) {
3631 sequenceB.done = FALSE;
3632 current_a_float64 = float64NextQInP2( &sequenceA );
3634 testCases_a_float64 = current_a_float64;
3635 testCases_b_float64 = float64NextQInP2( &sequenceB );
3636 testCases_done = sequenceA.done & sequenceB.done;
3637 subcase = -1;
3638 break;
3640 ++subcase;
3641 break;
3642 #ifdef FLOATX80
3643 case testCases_sequence_a_floatx80:
3644 switch ( subcase ) {
3645 case 0:
3646 testCases_a_floatx80 = floatx80Random();
3647 break;
3648 case 1:
3649 testCases_a_floatx80 = floatx80NextQOutP2( &sequenceA );
3650 testCases_done = sequenceA.done;
3651 subcase = -1;
3652 break;
3654 ++subcase;
3655 break;
3656 case testCases_sequence_ab_floatx80:
3657 switch ( subcase ) {
3658 case 0:
3659 testCases_a_floatx80 = floatx80Random();
3660 testCases_b_floatx80 = floatx80Random();
3661 break;
3662 case 1:
3663 if ( sequenceB.done ) {
3664 sequenceB.done = FALSE;
3665 current_a_floatx80 = floatx80NextQInP2( &sequenceA );
3667 testCases_a_floatx80 = current_a_floatx80;
3668 testCases_b_floatx80 = floatx80NextQInP2( &sequenceB );
3669 testCases_done = sequenceA.done & sequenceB.done;
3670 subcase = -1;
3671 break;
3673 ++subcase;
3674 break;
3675 #endif
3676 #ifdef FLOAT128
3677 case testCases_sequence_a_float128:
3678 switch ( subcase ) {
3679 case 0:
3680 testCases_a_float128 = float128Random();
3681 break;
3682 case 1:
3683 testCases_a_float128 = float128NextQOutP2( &sequenceA );
3684 testCases_done = sequenceA.done;
3685 subcase = -1;
3686 break;
3688 ++subcase;
3689 break;
3690 case testCases_sequence_ab_float128:
3691 switch ( subcase ) {
3692 case 0:
3693 testCases_a_float128 = float128Random();
3694 testCases_b_float128 = float128Random();
3695 break;
3696 case 1:
3697 if ( sequenceB.done ) {
3698 sequenceB.done = FALSE;
3699 current_a_float128 = float128NextQInP2( &sequenceA );
3701 testCases_a_float128 = current_a_float128;
3702 testCases_b_float128 = float128NextQInP2( &sequenceB );
3703 testCases_done = sequenceA.done & sequenceB.done;
3704 subcase = -1;
3705 break;
3707 ++subcase;
3708 break;
3709 #endif
3711 break;