EFPBox.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: package xeij;
14:
15: import java.lang.*;
16: import java.util.*;
17:
18: public class EFPBox {
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55: public static final boolean EPB_EXTRA_OPERATION = true;
56:
57:
58:
59: public static final int EPB_MODE_MC68881 = 1 << 1;
60: public static final int EPB_MODE_MC68882 = 1 << 2;
61: public static final int EPB_MODE_MC68060 = 1 << 6;
62: public static final int EPB_MODE_FULLSPEC = EPB_MODE_MC68881 | EPB_MODE_MC68882 | EPB_MODE_MC68060;
63: public static final int EPB_MODE_EXTENDED = 1 << 8;
64: public static final int EPB_MODE_TRIPLE = 1 << 9;
65: public int epbMode;
66:
67:
68:
69: public static final int P = 0 << 31;
70: public static final int M = 1 << 31;
71: public static final int Z = 1 << 30;
72: public static final int I = 1 << 29;
73: public static final int N = 1 << 28;
74:
75:
76:
77:
78: public static final int EPB_FPCR_BS = 1 << 15;
79: public static final int EPB_FPCR_SN = 1 << 14;
80: public static final int EPB_FPCR_OE = 1 << 13;
81: public static final int EPB_FPCR_OF = 1 << 12;
82: public static final int EPB_FPCR_UF = 1 << 11;
83: public static final int EPB_FPCR_DZ = 1 << 10;
84: public static final int EPB_FPCR_X2 = 1 << 9;
85: public static final int EPB_FPCR_X1 = 1 << 8;
86:
87: public static final int EPB_FPCR_PX = 0 << 6;
88: public static final int EPB_FPCR_PS = 1 << 6;
89: public static final int EPB_FPCR_PD = 2 << 6;
90:
91:
92: public static final int EPB_FPCR_RN = 0 << 4;
93: public static final int EPB_FPCR_RZ = 1 << 4;
94: public static final int EPB_FPCR_RM = 2 << 4;
95: public static final int EPB_FPCR_RP = 3 << 4;
96: public static final int EPB_FPCR_ALL = 0x0000fff0;
97: public int epbFpcr;
98:
99:
100:
101:
102:
103:
104: public static final int EPB_FPSR_M = 1 << 27;
105: public static final int EPB_FPSR_Z = 1 << 26;
106: public static final int EPB_FPSR_I = 1 << 25;
107: public static final int EPB_FPSR_N = 1 << 24;
108:
109: public static final int EPB_FPSR_S = 1 << 23;
110: public static final int EPB_FPSR_Q = 127 << 16;
111:
112: public static final int EPB_FPSR_BS = 1 << 15;
113: public static final int EPB_FPSR_SN = 1 << 14;
114: public static final int EPB_FPSR_OE = 1 << 13;
115: public static final int EPB_FPSR_OF = 1 << 12;
116: public static final int EPB_FPSR_UF = 1 << 11;
117: public static final int EPB_FPSR_DZ = 1 << 10;
118: public static final int EPB_FPSR_X2 = 1 << 9;
119: public static final int EPB_FPSR_X1 = 1 << 8;
120:
121: public static final int EPB_FPSR_AV = 1 << 7;
122: public static final int EPB_FPSR_AO = 1 << 6;
123: public static final int EPB_FPSR_AU = 1 << 5;
124: public static final int EPB_FPSR_AZ = 1 << 4;
125: public static final int EPB_FPSR_AX = 1 << 3;
126: public static final int EPB_FPSR_ALL = 0x0ffffff8;
127: public int epbFpsr;
128:
129:
130:
131: public int epbFpiar;
132:
133:
134:
135: public int epbQuotient;
136:
137:
138:
139: public static final int EPB_PREC_EXD = 0;
140: public static final int EPB_PREC_SGL = 1;
141: public static final int EPB_PREC_DBL = 2;
142: public static final int EPB_PREC_DBL3 = 3;
143:
144: public static final int EPB_PREC_TPL = 4;
145: public static final int EPB_PREC_XSG = 5;
146: public static final int EPB_PREC_EFP = 6;
147: public int epbRoundingPrec;
148:
149:
150:
151: public static final int EPB_MODE_RN = 0;
152: public static final int EPB_MODE_RZ = 1;
153: public static final int EPB_MODE_RM = 2;
154: public static final int EPB_MODE_RP = 3;
155: public int epbRoundingMode;
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172: public int epbExceptionOperandExponent;
173: public long epbExceptionOperandMantissa;
174: public int epbExceptionStatusWord;
175:
176:
177:
178:
179:
180: public int epbRoundingDepth;
181: public int epbRoundingOuterPrec;
182: public int epbRoundingOuterMode;
183:
184:
185:
186: public static final int EPB_SRC_TMP = 8;
187: public static final int EPB_DST_TMP = 9;
188: public static final int EPB_CONST_START = 10;
189: public EFP[] epbFPn;
190:
191:
192:
193: public static final HashMap<String,Integer> epbConstLongMap = new HashMap<String,Integer> ();
194: static {
195:
196: for (int i = 0; i < Disassembler.DIS_IOCS_NAME.length; i++) {
197: String name = Disassembler.DIS_IOCS_NAME[i];
198: if (name.length () > 0) {
199: epbConstLongMap.put (name.toLowerCase (), i);
200: }
201: }
202:
203: for (int i = 0; i < Disassembler.DIS_SXCALL_NAME.length; i++) {
204: String name = Disassembler.DIS_SXCALL_NAME[i];
205: if (name.length () > 0) {
206: epbConstLongMap.put (name.toLowerCase (), 0xa000 + i);
207: }
208: }
209:
210: for (int i = 0; i < Disassembler.DIS_FPACK_NAME.length; i++) {
211: String name = Disassembler.DIS_FPACK_NAME[i];
212: if (name.length () > 0) {
213: epbConstLongMap.put (name.toLowerCase (), 0xfe00 + i);
214: }
215: }
216:
217: for (int i = 0; i < Disassembler.DIS_DOS_NAME.length; i++) {
218: String name = Disassembler.DIS_DOS_NAME[i];
219: if (name.length () > 0) {
220: epbConstLongMap.put (name.toLowerCase (), 0xff00 + i);
221: }
222: }
223: }
224:
225:
226:
227: public EFPBox () {
228:
229: epbMode = EPB_MODE_EXTENDED | EPB_MODE_MC68882;
230:
231:
232: epbRandSeed = System.currentTimeMillis () & (1L << 48) - 1L;
233:
234: epbFPn = new EFPBox.EFP[EPB_CONST_START + 128];
235: for (int i = 0; i < epbFPn.length; i++) {
236: epbFPn[i] = new EFP ();
237: }
238:
239:
240:
241:
242:
243: epbFPn[EPB_CONST_START + 0x00].sete (PI);
244: epbSetROMSub ();
245: epbFPn[EPB_CONST_START + 0x0b].sete (LOG10_2);
246: epbFPn[EPB_CONST_START + 0x0c].sete (E);
247: epbFPn[EPB_CONST_START + 0x0d].sete (LOG2_E);
248: epbFPn[EPB_CONST_START + 0x0e].sete (LOG10_E);
249: epbFPn[EPB_CONST_START + 0x0f].set0 ();
250: epbFPn[EPB_CONST_START + 0x30].sete (LOG_2);
251: epbFPn[EPB_CONST_START + 0x31].sete (LOG_10);
252: epbFPn[EPB_CONST_START + 0x32].set1 ();
253: epbFPn[EPB_CONST_START + 0x33].sete (TEN);
254: epbFPn[EPB_CONST_START + 0x34].sete (TENXP1);
255: epbFPn[EPB_CONST_START + 0x35].sete (TENXP2);
256: epbFPn[EPB_CONST_START + 0x36].sete (TENXP3);
257: epbFPn[EPB_CONST_START + 0x37].sete (TENXP4);
258: epbFPn[EPB_CONST_START + 0x38].sete (TENXP5);
259: epbFPn[EPB_CONST_START + 0x39].sete (TENXP6);
260: epbFPn[EPB_CONST_START + 0x3a].sete (TENXP7);
261: epbFPn[EPB_CONST_START + 0x3b].sete (TENXP8);
262: epbFPn[EPB_CONST_START + 0x3c].sete (TENXP9);
263: epbFPn[EPB_CONST_START + 0x3d].sete (TENXP10);
264: epbFPn[EPB_CONST_START + 0x3e].sete (TENXP11);
265: epbFPn[EPB_CONST_START + 0x3f].sete (TENXP12);
266:
267: epbReset ();
268:
269: cirInit ();
270: }
271:
272:
273:
274: public final void epbSetROMSub () {
275: if ((epbMode & EPB_MODE_MC68882) != 0) {
276: epbFPn[EPB_CONST_START + 0x01].setx012 (0x40010000, 0xfe00068200000000L);
277: epbFPn[EPB_CONST_START + 0x02].setx012 (0x40010000, 0xffc0050380000000L);
278:
279: epbFPn[EPB_CONST_START + 0x03].setnan ();
280: epbFPn[EPB_CONST_START + 0x04].setx012 (0x00000000, 0xffffffffffffffffL);
281: epbFPn[EPB_CONST_START + 0x05].setx012 (0x3c000000, 0xfffffffffffff800L);
282: epbFPn[EPB_CONST_START + 0x06].setx012 (0x3f800000, 0xffffff0000000000L);
283:
284: epbFPn[EPB_CONST_START + 0x07].setnan ();
285:
286: epbFPn[EPB_CONST_START + 0x08].setnan ();
287: epbFPn[EPB_CONST_START + 0x09].setx012 (0x43f30000, 0xe000000000000000L);
288: epbFPn[EPB_CONST_START + 0x0a].setx012 (0x40720000, 0xc000000000000000L);
289: } else {
290: for (int offset = 0x01; offset <= 0x0a; offset++) {
291: epbFPn[EPB_CONST_START + offset].set0 ();
292: }
293: }
294: }
295:
296:
297:
298:
299: public void epbFmovecr (EFP x, int offset) {
300:
301: switch (offset) {
302: case 0x01:
303: if ((epbMode & EPB_MODE_MC68882) != 0) {
304: if (epbRoundingPrec == EPB_PREC_SGL) {
305: if (epbRoundingMode == EPB_MODE_RN ||
306: epbRoundingMode == EPB_MODE_RZ ||
307: epbRoundingMode == EPB_MODE_RM) {
308:
309: x.flg = P;
310: x.epp = 0x4001 - 0x3fff;
311: x.dvl = 0xfe00068000000000L;
312: x.cvl = 0L;
313: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_X2;
314: return;
315: }
316: }
317: }
318: break;
319: case 0x02:
320: if ((epbMode & EPB_MODE_MC68882) != 0) {
321: if (epbRoundingPrec == EPB_PREC_SGL) {
322: if (epbRoundingMode == EPB_MODE_RP) {
323:
324: x.flg = P;
325: x.epp = 0x4001 - 0x3fff;
326: x.dvl = 0xffc0058000000000L;
327: x.cvl = 0L;
328: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_X2;
329: return;
330: }
331: }
332: }
333: break;
334: case 0x03:
335: if ((epbMode & EPB_MODE_MC68882) != 0) {
336: if (epbRoundingPrec == EPB_PREC_SGL) {
337: if (epbRoundingMode == EPB_MODE_RN ||
338: epbRoundingMode == EPB_MODE_RP) {
339:
340: x.flg = P;
341: x.epp = 0x2000 - 0x3fff;
342: x.dvl = 0x8000000000000000L;
343: x.cvl = 0L;
344: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_I | EPB_FPSR_X2;
345: } else {
346:
347: x.flg = P;
348: x.epp = 0x2000 - 0x3fff;
349: x.dvl = 0x7fffff0000000000L;
350: x.cvl = 0L;
351: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_N | EPB_FPSR_X2;
352: }
353: } else {
354:
355: x.flg = P;
356: x.epp = 0x2000 - 0x3fff;
357: x.dvl = 0x7fffffff00000000L;
358: x.cvl = 0L;
359: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_N;
360: }
361: return;
362: }
363: break;
364: case 0x07:
365: if ((epbMode & EPB_MODE_MC68882) != 0) {
366: if (epbRoundingPrec == EPB_PREC_SGL) {
367: if (epbRoundingMode == EPB_MODE_RN ||
368: epbRoundingMode == EPB_MODE_RZ ||
369: epbRoundingMode == EPB_MODE_RM) {
370:
371: x.flg = P;
372: x.epp = 0x0001 - 0x3fff;
373: x.dvl = 0xf65d8d8000000000L;
374: x.cvl = 0L;
375: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_N | EPB_FPSR_X2;
376: } else {
377:
378: x.flg = P;
379: x.epp = 0x0001 - 0x3fff;
380: x.dvl = 0xf65d8e0000000000L;
381: x.cvl = 0L;
382: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_N | EPB_FPSR_X2;
383: }
384: } else {
385:
386: x.flg = P;
387: x.epp = 0x0001 - 0x3fff;
388: x.dvl = 0xf65d8d9c00000000L;
389: x.cvl = 0L;
390: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_N;
391: }
392: return;
393: }
394: break;
395: case 0x08:
396: if ((epbMode & EPB_MODE_MC68882) != 0) {
397:
398: x.flg = N;
399: x.epp = 0;
400: x.dvl = 0L;
401: x.cvl = 0L;
402: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_N;
403: return;
404: }
405: break;
406: case 0x0b:
407: if (epbRoundingPrec == EPB_PREC_EXD) {
408: if (epbRoundingMode == EPB_MODE_RN) {
409:
410: x.flg = P;
411: x.epp = 0x3ffd - 0x3fff;
412: x.dvl = 0x9a209a84fbcff798L;
413: x.cvl = 0L;
414: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_X2;
415: return;
416: }
417: }
418: break;
419: case 0x0c:
420: if (epbRoundingPrec == EPB_PREC_EXD) {
421: if (epbRoundingMode == EPB_MODE_RN) {
422:
423: x.flg = P;
424: x.epp = 0x4000 - 0x3fff;
425: x.dvl = 0xadf85458a2bb4a9aL;
426: x.cvl = 0L;
427: epbFpsr = epbFpsr & 0x00ff00ff | EPB_FPSR_X2;
428: return;
429: }
430: }
431: break;
432: case 0x0e:
433: if (epbRoundingPrec == EPB_PREC_EXD) {
434:
435: x.flg = P;
436: x.epp = 0x3ffd - 0x3fff;
437: x.dvl = 0xde5bd8a937287195L;
438: x.cvl = 0L;
439: epbFpsr = epbFpsr & 0x00ff00ff;
440: return;
441: }
442: break;
443: }
444:
445: x.sete (epbFPn[EPB_CONST_START + offset]);
446:
447: epbFpsr = epbFpsr & 0x00ff00ff | x.flg >>> 4;
448:
449: if (epbRoundingPrec == EPB_PREC_EXD) {
450: x.roundmanx (epbRoundingMode);
451: } else if (epbRoundingPrec == EPB_PREC_SGL) {
452: x.roundmanf (epbRoundingMode);
453: } else if (epbRoundingPrec == EPB_PREC_DBL ||
454: epbRoundingPrec == EPB_PREC_DBL3) {
455: x.roundmand (epbRoundingMode);
456: } else if (epbRoundingPrec == EPB_PREC_TPL) {
457: x.roundmany (epbRoundingMode);
458: }
459: }
460:
461:
462:
463: public void epbSetMC68881 () {
464: epbMode = epbMode & ~(EPB_MODE_MC68882 | EPB_MODE_MC68060) | EPB_MODE_MC68881;
465: epbSetROMSub ();
466: }
467:
468:
469:
470: public void epbSetMC68882 () {
471: epbMode = epbMode & ~(EPB_MODE_MC68881 | EPB_MODE_MC68060) | EPB_MODE_MC68882;
472: epbSetROMSub ();
473: }
474:
475:
476:
477: public void epbSetMC68060 () {
478: epbMode = epbMode & ~(EPB_MODE_MC68881 | EPB_MODE_MC68882) | EPB_MODE_MC68060;
479: epbSetROMSub ();
480: }
481:
482:
483:
484: public void epbSetFullSpec () {
485: epbMode |= EPB_MODE_FULLSPEC;
486: epbSetROMSub ();
487: }
488:
489:
490:
491: public boolean epbIsFullSpec () {
492: return (epbMode & EPB_MODE_FULLSPEC) == EPB_MODE_FULLSPEC;
493: }
494:
495:
496:
497: public void epbSetExtended () {
498: epbMode = epbMode & ~EPB_MODE_TRIPLE | EPB_MODE_EXTENDED;
499: }
500:
501:
502:
503: public void epbSetTriple () {
504: epbMode = epbMode & ~EPB_MODE_EXTENDED | EPB_MODE_TRIPLE;
505: }
506:
507:
508:
509: public boolean epbIsTriple () {
510: return (epbMode & EPB_MODE_TRIPLE) != 0;
511: }
512:
513:
514:
515: public final void epbReset () {
516:
517: for (int n = 0; n < 8; n++) {
518: epbFPn[n].setnan ();
519: }
520:
521: epbFpcr = 0;
522: epbFpsr = 0;
523: epbFpiar = 0;
524: epbQuotient = 0;
525: epbRoundingPrec = EPB_PREC_EFP;
526: epbRoundingMode = EPB_MODE_RN;
527: epbRoundingDepth = 0;
528: epbRoundingOuterPrec = EPB_PREC_EFP;
529: epbRoundingOuterMode = EPB_MODE_RN;
530:
531: epbExceptionOperandExponent = 0;
532: epbExceptionOperandMantissa = 0x0000000000000000L;
533: epbExceptionStatusWord = 0;
534:
535: cirReset ();
536: }
537:
538:
539:
540:
541:
542: public void epbSetRoundingPrec (int prec) {
543: epbRoundingPrec = prec == EPB_PREC_EXD && (epbMode & EPB_MODE_TRIPLE) != 0 ? EPB_PREC_TPL : prec;
544: }
545:
546:
547:
548:
549: public void epbSetRoundingMode (int mode) {
550: epbRoundingMode = mode;
551: }
552:
553:
554:
555:
556: public long epbRandSeed;
557:
558:
559:
560: public void epbRandStart (long n) {
561: epbRandSeed = (n ^ 25214903917L) & (1L << 48) - 1L;
562: }
563:
564:
565:
566: public long epbRand48 () {
567: return epbRandSeed = epbRandSeed * 25214903917L + 11L & (1L << 48) - 1L;
568: }
569:
570:
571:
572: public int epbRandInt () {
573: return (int) (epbRand48 () >>> 16);
574: }
575:
576:
577:
578: public long epbRandLong () {
579: return epbRand48 () >>> 16 << 32 | epbRand48 () >>> 16;
580: }
581:
582:
583:
584:
585: public static void epbMakeCmpTable () {
586: int[] fa = new int[] {
587: P | Z,
588: M | Z,
589: P | I,
590: M | I,
591: N,
592: P,
593: M,
594: };
595: double[] da = new double[] {
596: +0.0,
597: -0.0,
598: Double.POSITIVE_INFINITY,
599: Double.NEGATIVE_INFINITY,
600: Double.NaN,
601: +1.0,
602: -1.0,
603: };
604: String[] na = { "CMP", "COMPARE", "EQ", "GE", "GT", "LE", "LT", "NE" };
605: int[][] ba = new int[na.length][];
606: for (int j = 0; j < na.length; j++) {
607: ba[j] = new int[16];
608: }
609: for (int xi = 0; xi < fa.length; xi++) {
610: int xk = fa[xi] >>> 28;
611: double x = da[xi];
612: for (int yi = 0; yi < fa.length; yi++) {
613: int yk = fa[yi] >>> 28 - 1;
614: double y = da[yi];
615: ba[0][xk] |= (Double.isNaN (x) || Double.isNaN (y) || x == y ? 0 : x < y ? -1 : 1) << 30 >>> yk;
616: ba[1][xk] |= Double.compare (x, y) << 30 >>> yk;
617: ba[2][xk] |= (x == y ? -1 : 0) << 30 >>> yk;
618: ba[3][xk] |= (x >= y ? -1 : 0) << 30 >>> yk;
619: ba[4][xk] |= (x > y ? -1 : 0) << 30 >>> yk;
620: ba[5][xk] |= (x <= y ? -1 : 0) << 30 >>> yk;
621: ba[6][xk] |= (x < y ? -1 : 0) << 30 >>> yk;
622: ba[7][xk] |= (x != y ? -1 : 0) << 30 >>> yk;
623: }
624: }
625: for (int ni = 0; ni < na.length; ni++) {
626: System.out.print (" protected static final int[] EFP_" + na[ni] + "_TABLE = { ");
627: for (int xk = 0; xk < 16; xk++) {
628: System.out.print (ba[ni][xk]);
629: if (xk < 16 - 1) {
630: System.out.print (", ");
631: }
632: }
633: System.out.println (" };");
634: }
635: }
636:
637:
638:
639: public static final int[] EFP_CMP_TABLE = { 205538368, 0, 1077953600, 0, -872397824, 0, 0, 0, -859831104, 0, -859782976, 0, -872397824, 0, 0, 0 };
640: public static final int[] EFP_COMPARE_TABLE = { 1010844736, 1145062464, 1883259968, 0, -67091392, 0, 0, 0, -54524736, 0, -54476608, 0, -54508544, 0, 0, 0 };
641: public static final int[] EFP_EQ_TABLE = { -1073741824, 0, 201326592, 0, 12583104, 0, 0, 0, 49152, 0, 3072, 0, 12583104, 0, 0, 0 };
642: public static final int[] EFP_GE_TABLE = { -1061106496, 0, -859779904, 0, 12635328, 0, 0, 0, 52224, 0, 3072, 0, 12635328, 0, 0, 0 };
643: public static final int[] EFP_GT_TABLE = { 12635328, 0, -1061106496, 0, 52224, 0, 0, 0, 3072, 0, 0, 0, 52224, 0, 0, 0 };
644: public static final int[] EFP_LE_TABLE = { -872415232, 0, 201326592, 0, -859832128, 0, 0, 0, -859782976, 0, -859779904, 0, -859832128, 0, 0, 0 };
645: public static final int[] EFP_LT_TABLE = { 201326592, 0, 0, 0, -872415232, 0, 0, 0, -859832128, 0, -859782976, 0, -872415232, 0, 0, 0 };
646: public static final int[] EFP_NE_TABLE = { 1019268288, -54473536, -255800128, 0, -67056640, 0, 0, 0, -54522688, 0, -54476608, 0, -67056640, 0, 0, 0 };
647:
648:
649:
650:
651:
652: public final EFP ZERO = new EFP (P | Z, 0, 0L, 0L);
653: public final EFP NEGZERO = new EFP (M | Z, 0, 0L, 0L);
654: public final EFP INF = new EFP (P | I, 0, 0L, 0L);
655: public final EFP NEGINF = new EFP (M | I, 0, 0L, 0L);
656: public final EFP NAN = new EFP ( N, 0, 0L, 0L);
657:
658:
659:
660:
661: public final EFP EXDNOMAX = new EFP (P, 16383, 0xffffffffffffffffL, 0x0000000L << 36);
662: public final EFP EXDDEMIN = new EFP (P, -16446, 0x8000000000000000L, 0x0000000L << 36);
663: public final EFP NEGEXDDEMIN = new EFP (M, -16446, 0x8000000000000000L, 0x0000000L << 36);
664: public final EFP NEGEXDNOMAX = new EFP (M, 16383, 0xffffffffffffffffL, 0x0000000L << 36);
665: public final EFP SGLNOMAX = new EFP (P, 127, 0xffffff0000000000L, 0x0000000L << 36);
666: public final EFP SGLDEMIN = new EFP (P, -149, 0x8000000000000000L, 0x0000000L << 36);
667: public final EFP NEGSGLDEMIN = new EFP (M, -149, 0x8000000000000000L, 0x0000000L << 36);
668: public final EFP NEGSGLNOMAX = new EFP (M, 127, 0xffffff0000000000L, 0x0000000L << 36);
669: public final EFP DBLNOMAX = new EFP (P, 1023, 0xfffffffffffff800L, 0x0000000L << 36);
670: public final EFP DBLDEMIN = new EFP (P, -1074, 0x8000000000000000L, 0x0000000L << 36);
671: public final EFP NEGDBLDEMIN = new EFP (M, -1074, 0x8000000000000000L, 0x0000000L << 36);
672: public final EFP NEGDBLNOMAX = new EFP (M, 1023, 0xfffffffffffff800L, 0x0000000L << 36);
673: public final EFP TPLNOMAX = new EFP (P, 16383, 0xffffffffffffffffL, 0xffff000L << 36);
674: public final EFP TPLDEMIN = new EFP (P, -16462, 0x8000000000000000L, 0x0000000L << 36);
675: public final EFP NEGTPLDEMIN = new EFP (M, -16462, 0x8000000000000000L, 0x0000000L << 36);
676: public final EFP NEGTPLNOMAX = new EFP (M, 16383, 0xffffffffffffffffL, 0xffff000L << 36);
677: public final EFP XSGNOMAX = new EFP (P, 16383, 0xffffff0000000000L, 0x0000000L << 36);
678: public final EFP XSGDEMIN = new EFP (P, -16406, 0x8000000000000000L, 0x0000000L << 36);
679: public final EFP NEGXSGDEMIN = new EFP (M, -16406, 0x8000000000000000L, 0x0000000L << 36);
680: public final EFP NEGXSGNOMAX = new EFP (M, 16383, 0xffffff0000000000L, 0x0000000L << 36);
681: public final EFP EFPNOMAX = new EFP (P, 32767, 0xffffffffffffffffL, 0xfffffffL << 36);
682: public final EFP EFPDEMIN = new EFP (P, -32768, 0x8000000000000000L, 0x0000000L << 36);
683: public final EFP NEGEFPDEMIN = new EFP (M, -32768, 0x8000000000000000L, 0x0000000L << 36);
684: public final EFP NEGEFPNOMAX = new EFP (M, 32767, 0xffffffffffffffffL, 0xfffffffL << 36);
685:
686:
687:
688:
689:
690:
691:
692:
693:
694: public final EFP[] OVFL_RESULTS = new EFP[] {
695: INF,
696: NEGINF,
697: EXDNOMAX,
698: NEGEXDNOMAX,
699: EXDNOMAX,
700: NEGINF,
701: INF,
702: NEGEXDNOMAX,
703:
704: INF,
705: NEGINF,
706: SGLNOMAX,
707: NEGSGLNOMAX,
708: SGLNOMAX,
709: NEGINF,
710: INF,
711: NEGSGLNOMAX,
712:
713: INF,
714: NEGINF,
715: DBLNOMAX,
716: NEGDBLNOMAX,
717: DBLNOMAX,
718: NEGINF,
719: INF,
720: NEGDBLNOMAX,
721:
722: INF,
723: NEGINF,
724: DBLNOMAX,
725: NEGDBLNOMAX,
726: DBLNOMAX,
727: NEGINF,
728: INF,
729: NEGDBLNOMAX,
730:
731: INF,
732: NEGINF,
733: TPLNOMAX,
734: NEGTPLNOMAX,
735: TPLNOMAX,
736: NEGINF,
737: INF,
738: NEGTPLNOMAX,
739:
740: INF,
741: NEGINF,
742: EXDNOMAX,
743: NEGEXDNOMAX,
744: EXDNOMAX,
745: NEGINF,
746: INF,
747: NEGEXDNOMAX,
748:
749: INF,
750: NEGINF,
751: EFPNOMAX,
752: NEGEFPNOMAX,
753: EFPNOMAX,
754: NEGINF,
755: INF,
756: NEGEFPNOMAX,
757: };
758:
759:
760:
761:
762:
763:
764:
765:
766:
767: public final EFP[] UNFL_RESULTS = new EFP[] {
768: ZERO,
769: NEGZERO,
770: ZERO,
771: NEGZERO,
772: ZERO,
773: NEGEXDDEMIN,
774: EXDDEMIN,
775: NEGZERO,
776:
777: ZERO,
778: NEGZERO,
779: ZERO,
780: NEGZERO,
781: ZERO,
782: NEGSGLDEMIN,
783: SGLDEMIN,
784: NEGZERO,
785:
786: ZERO,
787: NEGZERO,
788: ZERO,
789: NEGZERO,
790: ZERO,
791: NEGDBLDEMIN,
792: DBLDEMIN,
793: NEGZERO,
794:
795: ZERO,
796: NEGZERO,
797: ZERO,
798: NEGZERO,
799: ZERO,
800: NEGDBLDEMIN,
801: DBLDEMIN,
802: NEGZERO,
803:
804: ZERO,
805: NEGZERO,
806: ZERO,
807: NEGZERO,
808: ZERO,
809: NEGTPLDEMIN,
810: TPLDEMIN,
811: NEGZERO,
812:
813: ZERO,
814: NEGZERO,
815: ZERO,
816: NEGZERO,
817: ZERO,
818: NEGXSGDEMIN,
819: XSGDEMIN,
820: NEGZERO,
821:
822: ZERO,
823: NEGZERO,
824: ZERO,
825: NEGZERO,
826: ZERO,
827: NEGEFPDEMIN,
828: EFPDEMIN,
829: NEGZERO,
830: };
831:
832:
833:
834:
835:
836: public final EFP[] NEXTDOWN_MINUSONE = {
837:
838: new EFP (M, 0, 0x8000000000000001L, 0x0000000L << 36),
839: new EFP (M, 0, 0x8000010000000000L, 0x0000000L << 36),
840: new EFP (M, 0, 0x8000000000000800L, 0x0000000L << 36),
841: new EFP (M, 0, 0x8000000000000800L, 0x0000000L << 36),
842: new EFP (M, 0, 0x8000000000000000L, 0x0001000L << 36),
843: new EFP (M, 0, 0x8000010000000000L, 0x0000000L << 36),
844: new EFP (M, 0, 0x8000000000000000L, 0x0000001L << 36),
845: };
846: public final EFP[] NEXTUP_MINUSONE = {
847:
848: new EFP (M, -1, 0xffffffffffffffffL, 0x0000000L << 36),
849: new EFP (M, -1, 0xffffff0000000000L, 0x0000000L << 36),
850: new EFP (M, -1, 0xfffffffffffff800L, 0x0000000L << 36),
851: new EFP (M, -1, 0xfffffffffffff800L, 0x0000000L << 36),
852: new EFP (M, -1, 0xffffffffffffffffL, 0xffff000L << 36),
853: new EFP (M, -1, 0xffffff0000000000L, 0x0000000L << 36),
854: new EFP (M, -1, 0xffffffffffffffffL, 0xfffffffL << 36),
855: };
856: public final EFP[] NEXTDOWN_PLUSONE = {
857:
858: new EFP (P, -1, 0xffffffffffffffffL, 0x0000000L << 36),
859: new EFP (P, -1, 0xffffff0000000000L, 0x0000000L << 36),
860: new EFP (P, -1, 0xfffffffffffff800L, 0x0000000L << 36),
861: new EFP (P, -1, 0xfffffffffffff800L, 0x0000000L << 36),
862: new EFP (P, -1, 0xffffffffffffffffL, 0xffff000L << 36),
863: new EFP (P, -1, 0xffffff0000000000L, 0x0000000L << 36),
864: new EFP (P, -1, 0xffffffffffffffffL, 0xfffffffL << 36),
865: };
866: public final EFP[] NEXTUP_PLUSONE = {
867:
868: new EFP (P, 0, 0x8000000000000001L, 0x0000000L << 36),
869: new EFP (P, 0, 0x8000010000000000L, 0x0000000L << 36),
870: new EFP (P, 0, 0x8000000000000800L, 0x0000000L << 36),
871: new EFP (P, 0, 0x8000000000000800L, 0x0000000L << 36),
872: new EFP (P, 0, 0x8000000000000000L, 0x0001000L << 36),
873: new EFP (P, 0, 0x8000010000000000L, 0x0000000L << 36),
874: new EFP (P, 0, 0x8000000000000000L, 0x0000001L << 36),
875: };
876:
877:
878:
879:
880: public final EFP NEGONE = new EFP (M, 0, 0x8000000000000000L, 0x0000000L << 36);
881: public final EFP ONE = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
882: public final EFP TWO = new EFP (P, 1, 0x8000000000000000L, 0x0000000L << 36);
883: public final EFP THREE = new EFP (P, 1, 0xc000000000000000L, 0x0000000L << 36);
884: public final EFP FOUR = new EFP (P, 2, 0x8000000000000000L, 0x0000000L << 36);
885: public final EFP FIVE = new EFP (P, 2, 0xa000000000000000L, 0x0000000L << 36);
886: public final EFP SIX = new EFP (P, 2, 0xc000000000000000L, 0x0000000L << 36);
887: public final EFP SEVEN = new EFP (P, 2, 0xe000000000000000L, 0x0000000L << 36);
888: public final EFP EIGHT = new EFP (P, 3, 0x8000000000000000L, 0x0000000L << 36);
889: public final EFP NINE = new EFP (P, 3, 0x9000000000000000L, 0x0000000L << 36);
890: public final EFP TEN = new EFP (P, 3, 0xa000000000000000L, 0x0000000L << 36);
891: public final EFP ELEVEN = new EFP (P, 3, 0xb000000000000000L, 0x0000000L << 36);
892: public final EFP TWELVE = new EFP (P, 3, 0xc000000000000000L, 0x0000000L << 36);
893: public final EFP THIRTEEN = new EFP (P, 3, 0xd000000000000000L, 0x0000000L << 36);
894: public final EFP FOURTEEN = new EFP (P, 3, 0xe000000000000000L, 0x0000000L << 36);
895: public final EFP FIFTEEN = new EFP (P, 3, 0xf000000000000000L, 0x0000000L << 36);
896: public final EFP SIXTEEN = new EFP (P, 4, 0x8000000000000000L, 0x0000000L << 36);
897: public final EFP[] EFP_DIGIT = {
898: ZERO,
899: ONE,
900: TWO,
901: THREE,
902: FOUR,
903: FIVE,
904: SIX,
905: SEVEN,
906: EIGHT,
907: NINE,
908: TEN,
909: ELEVEN,
910: TWELVE,
911: THIRTEEN,
912: FOURTEEN,
913: FIFTEEN,
914: SIXTEEN,
915: };
916:
917: public final EFP ONE_2 = new EFP (P, -1, 0x8000000000000000L, 0x0000000L << 36);
918: public final EFP ONE_3 = new EFP (P, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaabL << 36);
919: public final EFP TWO_3 = new EFP (P, -1, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaabL << 36);
920: public final EFP ONE_4 = new EFP (P, -2, 0x8000000000000000L, 0x0000000L << 36);
921: public final EFP THREE_4 = new EFP (P, -1, 0xc000000000000000L, 0x0000000L << 36);
922: public final EFP ONE_5 = new EFP (P, -3, 0xccccccccccccccccL, 0xccccccdL << 36);
923: public final EFP TWO_5 = new EFP (P, -2, 0xccccccccccccccccL, 0xccccccdL << 36);
924: public final EFP THREE_5 = new EFP (P, -1, 0x9999999999999999L, 0x999999aL << 36);
925: public final EFP FOUR_5 = new EFP (P, -1, 0xccccccccccccccccL, 0xccccccdL << 36);
926: public final EFP ONE_6 = new EFP (P, -3, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaabL << 36);
927: public final EFP FIVE_6 = new EFP (P, -1, 0xd555555555555555L, 0x5555555L << 36);
928: public final EFP ONE_10 = new EFP (P, -4, 0xccccccccccccccccL, 0xccccccdL << 36);
929:
930: public final EFP SQRT2 = new EFP (P, 0, 0xb504f333f9de6484L, 0x597d89bL << 36);
931: public final EFP SQRT2A = new EFP (P, -94, 0xdd52afa7c75bd82eL, 0xa24eea1L << 36);
932: public final EFP SQRT2_2 = new EFP (P, -1, 0xb504f333f9de6484L, 0x597d89bL << 36);
933: public final EFP SQRT2_2A = new EFP (P, -95, 0xdd52afa7c75bd82eL, 0xa24eea1L << 36);
934: public final EFP DECSQRT2 = new EFP (P, -2, 0xd413cccfe7799211L, 0x65f626dL << 36);
935: public final EFP DECSQRT2A = new EFP (M, -96, 0x8ab54160e2909f45L, 0x76c457bL << 36);
936: public final EFP INCSQRT2 = new EFP (P, 1, 0x9a827999fcef3242L, 0x2cbec4eL << 36);
937: public final EFP INCSQRT2A = new EFP (M, -92, 0xc8ab54160e2909f4L, 0x576c458L << 36);
938:
939: public final EFP PI = new EFP (P, 1, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
940: public final EFP PIA = new EFP (M, -92, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
941: public final EFP NEGPI = new EFP (M, 1, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
942: public final EFP NEGPIA = new EFP (P, -92, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
943: public final EFP PI2 = new EFP (P, 2, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
944: public final EFP PI2A = new EFP (M, -91, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
945: public final EFP PI_2 = new EFP (P, 0, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
946: public final EFP PI_2A = new EFP (M, -93, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
947: public final EFP NEGPI_2 = new EFP (M, 0, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
948: public final EFP NEGPI_2A = new EFP (P, -93, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
949: public final EFP PI3_2 = new EFP (P, 2, 0x96cbe3f9990e91a7L, 0x9394c9fL << 36);
950: public final EFP PI3_2A = new EFP (M, -91, 0xebeb5d4c6427c8afL, 0x330644dL << 36);
951: public final EFP PI_4 = new EFP (P, -1, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
952: public final EFP PI_4A = new EFP (M, -94, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
953: public final EFP NEGPI_4 = new EFP (M, -1, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
954: public final EFP NEGPI_4A = new EFP (P, -94, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
955: public final EFP PI3_4 = new EFP (P, 1, 0x96cbe3f9990e91a7L, 0x9394c9fL << 36);
956: public final EFP PI3_4A = new EFP (M, -92, 0xebeb5d4c6427c8afL, 0x330644dL << 36);
957: public final EFP NEGPI3_4 = new EFP (M, 1, 0x96cbe3f9990e91a7L, 0x9394c9fL << 36);
958: public final EFP NEGPI3_4A = new EFP (P, -92, 0xebeb5d4c6427c8afL, 0x330644dL << 36);
959: public final EFP PI_6 = new EFP (P, -1, 0x860a91c16b9b2c23L, 0x2dd9970L << 36);
960: public final EFP PI_6A = new EFP (P, -94, 0xf567ad116e158680L, 0xb633511L << 36);
961: public final EFP PI_8 = new EFP (P, -2, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
962: public final EFP PI_8A = new EFP (M, -95, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
963: public final EFP TO_RAD = new EFP (P, -6, 0x8efa351294e9c8aeL, 0x0ec5f67L << 36);
964: public final EFP TO_RADA = new EFP (M, -101, 0xb5bd1d937fa42885L, 0x7f250caL << 36);
965:
966: public final EFP ONE_2PI = new EFP (P, -3, 0xa2f9836e4e441529L, 0xfc2757dL << 36);
967: public final EFP ONE_2PIA = new EFP (P, -98, 0xfa9a6ee06db14accL, 0x9e21c82L << 36);
968: public final EFP ONE_PI = new EFP (P, -2, 0xa2f9836e4e441529L, 0xfc2757dL << 36);
969: public final EFP ONE_PIA = new EFP (P, -97, 0xfa9a6ee06db14accL, 0x9e21c82L << 36);
970: public final EFP TWO_PI = new EFP (P, -1, 0xa2f9836e4e441529L, 0xfc2757dL << 36);
971: public final EFP TWO_PIA = new EFP (P, -96, 0xfa9a6ee06db14accL, 0x9e21c82L << 36);
972: public final EFP FOUR_PI = new EFP (P, 0, 0xa2f9836e4e441529L, 0xfc2757dL << 36);
973: public final EFP FOUR_PIA = new EFP (P, -95, 0xfa9a6ee06db14accL, 0x9e21c82L << 36);
974: public final EFP TO_DEG = new EFP (P, 5, 0xe52ee0d31e0fbdc3L, 0x0a97538L << 36);
975: public final EFP TO_DEGA = new EFP (M, -91, 0xbf2da828cb7d5da0L, 0x8340fd2L << 36);
976:
977: public final EFP E = new EFP (P, 1, 0xadf85458a2bb4a9aL, 0xafdc562L << 36);
978: public final EFP EA = new EFP (P, -97, 0x9cf4f3c762e7160fL, 0x38b4da5L << 36);
979:
980: public final EFP LOG_2 = new EFP (P, -1, 0xb17217f7d1cf79abL, 0xc9e3b3aL << 36);
981: public final EFP LOG_2A = new EFP (M, -94, 0xff81a12a17e1979bL, 0x31ace94L << 36);
982: public final EFP LOG_2_2 = new EFP (P, -2, 0xb17217f7d1cf79abL, 0xc9e3b3aL << 36);
983: public final EFP LOG_2_2A = new EFP (M, -95, 0xff81a12a17e1979bL, 0x31ace94L << 36);
984: public final EFP LOG_10 = new EFP (P, 1, 0x935d8dddaaa8ac16L, 0xea56d63L << 36);
985: public final EFP LOG_10A = new EFP (M, -92, 0x8fa59ebae3ae0260L, 0xc4b440eL << 36);
986: public final EFP LOG2_E = new EFP (P, 0, 0xb8aa3b295c17f0bbL, 0xbe87fedL << 36);
987: public final EFP LOG2_EA = new EFP (P, -97, 0xd23a7d11d6aef551L, 0xbad2b4bL << 36);
988: public final EFP LOG2_10 = new EFP (P, 1, 0xd49a784bcd1b8afeL, 0x492bf70L << 36);
989: public final EFP LOG2_10A = new EFP (M, -95, 0xb25024b32693aa01L, 0xc84c52bL << 36);
990: public final EFP LOG10_2 = new EFP (P, -2, 0x9a209a84fbcff798L, 0x8f8959bL << 36);
991: public final EFP LOG10_2A = new EFP (M, -96, 0xfd20dba1f654b3ceL, 0xaf0b833L << 36);
992: public final EFP LOG10_E = new EFP (P, -2, 0xde5bd8a937287195L, 0x355baabL << 36);
993: public final EFP LOG10_EA = new EFP (M, -99, 0xa598479b823973fbL, 0x746cbc0L << 36);
994:
995: public final EFP TENXP1 = new EFP (P, 6, 0xc800000000000000L, 0x0000000L << 36);
996: public final EFP TENXP2 = new EFP (P, 13, 0x9c40000000000000L, 0x0000000L << 36);
997: public final EFP TENXP3 = new EFP (P, 26, 0xbebc200000000000L, 0x0000000L << 36);
998: public final EFP TENXP4 = new EFP (P, 53, 0x8e1bc9bf04000000L, 0x0000000L << 36);
999: public final EFP TENXP5 = new EFP (P, 106, 0x9dc5ada82b70b59dL, 0xf020000L << 36);
1000: public final EFP TENXP6 = new EFP (P, 212, 0xc2781f49ffcfa6d5L, 0x3cbf6b7L << 36);
1001: public final EFP TENXP7 = new EFP (P, 425, 0x93ba47c980e98cdfL, 0xc66f337L << 36);
1002: public final EFP TENXP8 = new EFP (P, 850, 0xaa7eebfb9df9de8dL, 0xddbb902L << 36);
1003: public final EFP TENXP9 = new EFP (P, 1700, 0xe319a0aea60e91c6L, 0xcc655c5L << 36);
1004: public final EFP TENXP10 = new EFP (P, 3401, 0xc976758681750c17L, 0x650d3d3L << 36);
1005: public final EFP TENXP11 = new EFP (P, 6803, 0x9e8b3b5dc53d5de4L, 0xa74d28dL << 36);
1006: public final EFP TENXP12 = new EFP (P, 13606, 0xc46052028a20979aL, 0xc94c154L << 36);
1007: public final EFP TENXP13 = new EFP (P, 27213, 0x96a3a1d17faf211aL, 0x0c7c289L << 36);
1008: public final EFP TENXP14 = new EFP (P, 54426, 0xb1485471f16603b5L, 0x6226e11L << 36);
1009: public final EFP[] EFP_TEN_POWER_P = {
1010: TEN,
1011: TENXP1,
1012: TENXP2,
1013: TENXP3,
1014: TENXP4,
1015: TENXP5,
1016: TENXP6,
1017: TENXP7,
1018: TENXP8,
1019: TENXP9,
1020: TENXP10,
1021: TENXP11,
1022: TENXP12,
1023: TENXP13,
1024: TENXP14,
1025: INF,
1026: };
1027:
1028: public final EFP TENXM1 = new EFP (P, -7, 0xa3d70a3d70a3d70aL, 0x3d70a3dL << 36);
1029: public final EFP TENXM2 = new EFP (P, -14, 0xd1b71758e219652bL, 0xd3c3611L << 36);
1030: public final EFP TENXM3 = new EFP (P, -27, 0xabcc77118461cefcL, 0xfdc20d3L << 36);
1031: public final EFP TENXM4 = new EFP (P, -54, 0xe69594bec44de15bL, 0x4c2ebe7L << 36);
1032: public final EFP TENXM5 = new EFP (P, -107, 0xcfb11ead453994baL, 0x67de18fL << 36);
1033: public final EFP TENXM6 = new EFP (P, -213, 0xa87fea27a539e9a5L, 0x3f2398dL << 36);
1034: public final EFP TENXM7 = new EFP (P, -426, 0xddd0467c64bce4a0L, 0xac7cb3fL << 36);
1035: public final EFP TENXM8 = new EFP (P, -851, 0xc0314325637a1939L, 0xfa91115L << 36);
1036: public final EFP TENXM9 = new EFP (P, -1701, 0x9049ee32db23d21cL, 0x7132d33L << 36);
1037: public final EFP TENXM10 = new EFP (P, -3402, 0xa2a682a5da57c0bdL, 0x87a6016L << 36);
1038: public final EFP TENXM11 = new EFP (P, -6804, 0xceae534f34362de4L, 0x492512dL << 36);
1039: public final EFP TENXM12 = new EFP (P, -13607, 0xa6dd04c8d2ce9fdeL, 0x2de3812L << 36);
1040: public final EFP TENXM13 = new EFP (P, -27214, 0xd986c20b686da869L, 0x5d1d4feL << 36);
1041: public final EFP TENXM14 = new EFP (P, -54427, 0xb8d5bbe70e108517L, 0x456e9e1L << 36);
1042: public final EFP[] EFP_TEN_POWER_M = {
1043: ONE_10,
1044: TENXM1,
1045: TENXM2,
1046: TENXM3,
1047: TENXM4,
1048: TENXM5,
1049: TENXM6,
1050: TENXM7,
1051: TENXM8,
1052: TENXM9,
1053: TENXM10,
1054: TENXM11,
1055: TENXM12,
1056: TENXM13,
1057: TENXM14,
1058: ZERO,
1059: };
1060:
1061:
1062:
1063:
1064: public final EFP ASIN_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1065: public final EFP ASIN_C3 = new EFP (P, -3, 0xaaaaaaaaaaaaaaaaL, 0xaa9f5a6L << 36);
1066: public final EFP ASIN_C5 = new EFP (P, -4, 0x999999999999999bL, 0x27bc1b8L << 36);
1067: public final EFP ASIN_C7 = new EFP (P, -5, 0xb6db6db6db6d9dfbL, 0x62327e8L << 36);
1068: public final EFP ASIN_C9 = new EFP (P, -6, 0xf8e38e38e465b639L, 0x780782eL << 36);
1069: public final EFP ASIN_C11 = new EFP (P, -6, 0xb745d17238e942a1L, 0xe80f5beL << 36);
1070: public final EFP ASIN_C13 = new EFP (P, -6, 0x8e2765c0b9aaa792L, 0xa93870aL << 36);
1071: public final EFP ASIN_C15 = new EFP (P, -7, 0xe4c6ca7a5689895bL, 0x0fdd729L << 36);
1072: public final EFP ASIN_C17 = new EFP (P, -7, 0xc0428d0d9769d446L, 0x583b42dL << 36);
1073:
1074:
1075:
1076:
1077:
1078: public final EFP ASINH_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1079: public final EFP ASINH_C3 = new EFP (M, -3, 0xaaaaaaaaaaaaaaaaL, 0xaaaa73cL << 36);
1080: public final EFP ASINH_C5 = new EFP (P, -4, 0x9999999999999999L, 0x98eba3eL << 36);
1081: public final EFP ASINH_C7 = new EFP (M, -5, 0xb6db6db6db6db6daL, 0x693062cL << 36);
1082: public final EFP ASINH_C9 = new EFP (P, -6, 0xf8e38e38e38e3802L, 0x877ce5fL << 36);
1083: public final EFP ASINH_C11 = new EFP (M, -6, 0xb745d1745d17072fL, 0x8f119f4L << 36);
1084: public final EFP ASINH_C13 = new EFP (P, -6, 0x8e27627627566903L, 0xdf845ccL << 36);
1085: public final EFP ASINH_C15 = new EFP (M, -7, 0xe4ccccccc9700e9eL, 0xe0b4a69L << 36);
1086: public final EFP ASINH_C17 = new EFP (P, -7, 0xbd43c3c369baae2eL, 0x0efcbb2L << 36);
1087: public final EFP ASINH_C19 = new EFP (M, -7, 0x9fef28648d7f5526L, 0x95df2b5L << 36);
1088: public final EFP ASINH_C21 = new EFP (P, -7, 0x89779e056ca4e338L, 0xd00497cL << 36);
1089: public final EFP ASINH_C23 = new EFP (M, -8, 0xef9dde222ea1963bL, 0xe27b426L << 36);
1090: public final EFP ASINH_C25 = new EFP (P, -8, 0xd342a867c46a40d7L, 0x608fa17L << 36);
1091: public final EFP ASINH_C27 = new EFP (M, -8, 0xbc1323a7fe6984a7L, 0x201509dL << 36);
1092: public final EFP ASINH_C29 = new EFP (P, -8, 0xa8c41a9477d0f87aL, 0x533f07cL << 36);
1093: public final EFP ASINH_C31 = new EFP (M, -8, 0x982f5aab1d57a757L, 0x87f7027L << 36);
1094: public final EFP ASINH_C33 = new EFP (P, -8, 0x88c1b2170947d07cL, 0x03ff2fcL << 36);
1095: public final EFP ASINH_C35 = new EFP (M, -9, 0xef58f638c3ca7cffL, 0x77a770cL << 36);
1096: public final EFP ASINH_C37 = new EFP (P, -9, 0xc1c49585f23563ecL, 0x9a83aedL << 36);
1097: public final EFP ASINH_C39 = new EFP (M, -9, 0x844314a5dc2c3362L, 0x37b5811L << 36);
1098: public final EFP ASINH_C41 = new EFP (P, -10, 0x824564bc0126d26dL, 0x0c5dd9fL << 36);
1099: public final EFP ASINH_C43 = new EFP (M, -12, 0x85dfcbe40f7ac39fL, 0xb82e7c3L << 36);
1100:
1101:
1102:
1103:
1104:
1105: public final EFP ATAN_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1106: public final EFP ATAN_C3 = new EFP (M, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaa510L << 36);
1107: public final EFP ATAN_C5 = new EFP (P, -3, 0xccccccccccccccccL, 0xcb75e59L << 36);
1108: public final EFP ATAN_C7 = new EFP (M, -3, 0x9249249249249247L, 0xef2e1e8L << 36);
1109: public final EFP ATAN_C9 = new EFP (P, -4, 0xe38e38e38e38e24dL, 0x0fb9b9aL << 36);
1110: public final EFP ATAN_C11 = new EFP (M, -4, 0xba2e8ba2e8b9c37fL, 0xd40106dL << 36);
1111: public final EFP ATAN_C13 = new EFP (P, -4, 0x9d89d89d89c01044L, 0xee8e878L << 36);
1112: public final EFP ATAN_C15 = new EFP (M, -4, 0x888888888479743eL, 0xd1a4c1cL << 36);
1113: public final EFP ATAN_C17 = new EFP (P, -5, 0xf0f0f0eff12a86f3L, 0x34f4f78L << 36);
1114: public final EFP ATAN_C19 = new EFP (M, -5, 0xd79435cd132b46adL, 0x026fbddL << 36);
1115: public final EFP ATAN_C21 = new EFP (P, -5, 0xc30c2f05b9b60e24L, 0x4f7cf62L << 36);
1116: public final EFP ATAN_C23 = new EFP (M, -5, 0xb216298497a81754L, 0x9c69988L << 36);
1117: public final EFP ATAN_C25 = new EFP (P, -5, 0xa3d5e99dc5d0a87cL, 0x531842aL << 36);
1118: public final EFP ATAN_C27 = new EFP (M, -5, 0x97aa006d0e00c9c7L, 0x30d6815L << 36);
1119: public final EFP ATAN_C29 = new EFP (P, -5, 0x8cf60e9e64655ffeL, 0x38ac19cL << 36);
1120: public final EFP ATAN_C31 = new EFP (M, -5, 0x82959208f1c7a2afL, 0xdae8a29L << 36);
1121: public final EFP ATAN_C33 = new EFP (P, -6, 0xeb2210cae680d538L, 0x15fff4fL << 36);
1122: public final EFP ATAN_C35 = new EFP (M, -6, 0xc010e629b0e973a6L, 0xe64c5d3L << 36);
1123: public final EFP ATAN_C37 = new EFP (P, -7, 0xf4fd1335dff0ecefL, 0x1237cb3L << 36);
1124: public final EFP ATAN_C39 = new EFP (M, -8, 0xae06e746e01494ddL, 0xc1bb093L << 36);
1125:
1126:
1127:
1128:
1129:
1130: public final EFP ATANH_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1131: public final EFP ATANH_C3 = new EFP (P, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaab40L << 36);
1132: public final EFP ATANH_C5 = new EFP (P, -3, 0xccccccccccccccccL, 0xcb39274L << 36);
1133: public final EFP ATANH_C7 = new EFP (P, -3, 0x9249249249249258L, 0xc166b48L << 36);
1134: public final EFP ATANH_C9 = new EFP (P, -4, 0xe38e38e38e38399dL, 0xe3605a0L << 36);
1135: public final EFP ATANH_C11 = new EFP (P, -4, 0xba2e8ba2eae60f89L, 0xa98ab82L << 36);
1136: public final EFP ATANH_C13 = new EFP (P, -4, 0x9d89d8991665e749L, 0xd36e921L << 36);
1137: public final EFP ATANH_C15 = new EFP (P, -4, 0x88888e4ace4d77aaL, 0xa2aa416L << 36);
1138: public final EFP ATANH_C17 = new EFP (P, -5, 0xf0e7cfa2bdbf9821L, 0x93bcd2aL << 36);
1139: public final EFP ATANH_C19 = new EFP (P, -5, 0xdb9f4d0dedd2896fL, 0x4b48c7fL << 36);
1140:
1141: public final EFP[] ATH_T = {
1142:
1143: new EFP (P, -3, 0xafb0ccc06219b7baL, 0x682764dL << 36),
1144: new EFP (P, -2, 0xf486f8adc4df1a3fL, 0x3373579L << 36),
1145: new EFP (P, -1, 0xb31638273cf89250L, 0x55f0c13L << 36),
1146: new EFP (P, -1, 0xd66b9a67d12abc57L, 0x98d2421L << 36),
1147: new EFP (P, -1, 0xea548bdf707c71a8L, 0x48f4c93L << 36),
1148: new EFP (P, -1, 0xf4ee4e9693348047L, 0xc360937L << 36),
1149: new EFP (P, -1, 0xfa67aba3bd4ef753L, 0x97d0d24L << 36),
1150: new EFP (P, -1, 0xfd2fe692fd3e80eaL, 0xf06feacL << 36),
1151: new EFP (P, -1, 0xfe96f56512becc96L, 0x5d9833cL << 36),
1152: new EFP (P, -1, 0xff4b3af63364e808L, 0x18a7859L << 36),
1153: new EFP (P, -1, 0xffa58d83926f2d61L, 0x373e4afL << 36),
1154: new EFP (P, -1, 0xffd2c2c2d8870e17L, 0xed05d07L << 36),
1155: new EFP (P, -1, 0xffe960618e30f4faL, 0x87ef4d9L << 36),
1156: new EFP (P, -1, 0xfff4aff0cb566033L, 0x22866e9L << 36),
1157: new EFP (P, -1, 0xfffa57e86632f050L, 0x0d74b69L << 36),
1158: new EFP (P, -1, 0xfffd2bf0332a7066L, 0xd4437adL << 36),
1159: new EFP (P, -1, 0xfffe95f71997573eL, 0xc3c2f8aL << 36),
1160: new EFP (P, -1, 0xffff4afb4ccbef81L, 0x0515247L << 36),
1161: new EFP (P, -1, 0xffffa57d9666003cL, 0xba71034L << 36),
1162: new EFP (P, -1, 0xffffd2bec733012dL, 0xe46d4faL << 36),
1163: new EFP (P, -1, 0xffffe95f629980b8L, 0xe320c19L << 36),
1164: new EFP (P, -1, 0xfffff4afb10cc060L, 0xafaddc0L << 36),
1165: new EFP (P, -1, 0xfffffa57d8766030L, 0xdf9aa0eL << 36),
1166: new EFP (P, -1, 0xfffffd2bec373018L, 0x80c5c71L << 36),
1167: new EFP (P, -1, 0xfffffe95f61a980cL, 0x4281f26L << 36),
1168: new EFP (P, -1, 0xffffff4afb0d0c06L, 0x2184db1L << 36),
1169: new EFP (P, -1, 0xffffffa57d867603L, 0x10cae9cL << 36),
1170: new EFP (P, -1, 0xffffffd2bec33701L, 0x8866846L << 36),
1171: new EFP (P, -1, 0xffffffe95f619a80L, 0xc433642L << 36),
1172: new EFP (P, -1, 0xfffffff4afb0cd00L, 0x6219b65L << 36),
1173: new EFP (P, -1, 0xfffffffa57d86670L, 0x310cdbbL << 36),
1174: new EFP (P, -1, 0xfffffffd2bec3334L, 0x18866dfL << 36),
1175: new EFP (P, -1, 0xfffffffe95f61999L, 0x0c4336fL << 36),
1176: new EFP (P, -1, 0xffffffff4afb0cccL, 0x46219b8L << 36),
1177: new EFP (P, -1, 0xffffffffa57d8666L, 0x1310cdcL << 36),
1178: new EFP (P, -1, 0xffffffffd2bec333L, 0x058866eL << 36),
1179: new EFP (P, -1, 0xffffffffe95f6199L, 0x81c4337L << 36),
1180: new EFP (P, -1, 0xfffffffff4afb0ccL, 0xc0a219bL << 36),
1181: new EFP (P, -1, 0xfffffffffa57d866L, 0x60410ceL << 36),
1182: new EFP (P, -1, 0xfffffffffd2bec33L, 0x301c867L << 36),
1183: new EFP (P, -1, 0xfffffffffe95f619L, 0x980d433L << 36),
1184: new EFP (P, -1, 0xffffffffff4afb0cL, 0xcc0661aL << 36),
1185: new EFP (P, -1, 0xffffffffffa57d86L, 0x660320dL << 36),
1186: new EFP (P, -1, 0xffffffffffd2bec3L, 0x33018c6L << 36),
1187: new EFP (P, -1, 0xffffffffffe95f61L, 0x9980c53L << 36),
1188: new EFP (P, -1, 0xfffffffffff4afb0L, 0xccc0626L << 36),
1189: new EFP (P, -1, 0xfffffffffffa57d8L, 0x6660312L << 36),
1190: new EFP (P, -1, 0xfffffffffffd2becL, 0x3330189L << 36),
1191: new EFP (P, -1, 0xfffffffffffe95f6L, 0x19980c4L << 36),
1192: new EFP (P, -1, 0xffffffffffff4afbL, 0x0ccc062L << 36),
1193: new EFP (P, -1, 0xffffffffffffa57dL, 0x8666031L << 36),
1194: new EFP (P, -1, 0xffffffffffffd2beL, 0xc333019L << 36),
1195: new EFP (P, -1, 0xffffffffffffe95fL, 0x619980cL << 36),
1196: new EFP (P, -1, 0xfffffffffffff4afL, 0xb0ccc06L << 36),
1197: new EFP (P, -1, 0xfffffffffffffa57L, 0xd866603L << 36),
1198: new EFP (P, -1, 0xfffffffffffffd2bL, 0xec33302L << 36),
1199: new EFP (P, -1, 0xfffffffffffffe95L, 0xf619981L << 36),
1200: new EFP (P, -1, 0xffffffffffffff4aL, 0xfb0ccc0L << 36),
1201: new EFP (P, -1, 0xffffffffffffffa5L, 0x7d86660L << 36),
1202: new EFP (P, -1, 0xffffffffffffffd2L, 0xbec3330L << 36),
1203: new EFP (P, -1, 0xffffffffffffffe9L, 0x5f61998L << 36),
1204: new EFP (P, -1, 0xfffffffffffffff4L, 0xafb0cccL << 36),
1205: new EFP (P, -1, 0xfffffffffffffffaL, 0x57d8666L << 36),
1206: new EFP (P, -1, 0xfffffffffffffffdL, 0x2bec333L << 36),
1207: new EFP (P, -1, 0xfffffffffffffffeL, 0x95f619aL << 36),
1208: new EFP (P, -1, 0xffffffffffffffffL, 0x4afb0cdL << 36),
1209: new EFP (P, -1, 0xffffffffffffffffL, 0xa57d866L << 36),
1210: new EFP (P, -1, 0xffffffffffffffffL, 0xd2bec33L << 36),
1211: new EFP (P, -1, 0xffffffffffffffffL, 0xe95f61aL << 36),
1212: new EFP (P, -1, 0xffffffffffffffffL, 0xf4afb0dL << 36),
1213: new EFP (P, -1, 0xffffffffffffffffL, 0xfa57d86L << 36),
1214: new EFP (P, -1, 0xffffffffffffffffL, 0xfd2bec3L << 36),
1215: new EFP (P, -1, 0xffffffffffffffffL, 0xfe95f62L << 36),
1216: new EFP (P, -1, 0xffffffffffffffffL, 0xff4afb1L << 36),
1217: new EFP (P, -1, 0xffffffffffffffffL, 0xffa57d8L << 36),
1218: new EFP (P, -1, 0xffffffffffffffffL, 0xffd2becL << 36),
1219: new EFP (P, -1, 0xffffffffffffffffL, 0xffe95f6L << 36),
1220: new EFP (P, -1, 0xffffffffffffffffL, 0xfff4afbL << 36),
1221: new EFP (P, -1, 0xffffffffffffffffL, 0xfffa57eL << 36),
1222: new EFP (P, -1, 0xffffffffffffffffL, 0xfffd2bfL << 36),
1223: new EFP (P, -1, 0xffffffffffffffffL, 0xfffe95fL << 36),
1224: new EFP (P, -1, 0xffffffffffffffffL, 0xffff4b0L << 36),
1225: new EFP (P, -1, 0xffffffffffffffffL, 0xffffa58L << 36),
1226: new EFP (P, -1, 0xffffffffffffffffL, 0xffffd2cL << 36),
1227: new EFP (P, -1, 0xffffffffffffffffL, 0xffffe96L << 36),
1228: new EFP (P, -1, 0xffffffffffffffffL, 0xfffff4bL << 36),
1229: new EFP (P, -1, 0xffffffffffffffffL, 0xfffffa5L << 36),
1230: new EFP (P, -1, 0xffffffffffffffffL, 0xfffffd3L << 36),
1231: new EFP (P, -1, 0xffffffffffffffffL, 0xfffffe9L << 36),
1232: new EFP (P, -1, 0xffffffffffffffffL, 0xffffff5L << 36),
1233: new EFP (P, -1, 0xffffffffffffffffL, 0xffffffaL << 36),
1234: new EFP (P, -1, 0xffffffffffffffffL, 0xffffffdL << 36),
1235: new EFP (P, -1, 0xffffffffffffffffL, 0xfffffffL << 36),
1236: };
1237:
1238: public final EFP ATH_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1239: public final EFP ATH_C3 = new EFP (P, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaaafaL << 36);
1240: public final EFP ATH_C5 = new EFP (P, -3, 0xccccccccccccccccL, 0xcc9635cL << 36);
1241: public final EFP ATH_C7 = new EFP (P, -3, 0x9249249249249249L, 0xb11c709L << 36);
1242: public final EFP ATH_C9 = new EFP (P, -4, 0xe38e38e38e38e1f4L, 0xa08ab7fL << 36);
1243: public final EFP ATH_C11 = new EFP (P, -4, 0xba2e8ba2e8bba550L, 0x957b4b0L << 36);
1244: public final EFP ATH_C13 = new EFP (P, -4, 0x9d89d89d88f3a6b4L, 0xb83ee9bL << 36);
1245: public final EFP ATH_C15 = new EFP (P, -4, 0x88888888e97610a0L, 0x018bbc5L << 36);
1246: public final EFP ATH_C17 = new EFP (P, -5, 0xf0f0f0b6e98b6c2fL, 0x176ec78L << 36);
1247: public final EFP ATH_C19 = new EFP (P, -5, 0xd79442422528c14bL, 0xdacdc08L << 36);
1248: public final EFP ATH_C21 = new EFP (P, -5, 0xc30a54423d395d6dL, 0xa2f5188L << 36);
1249: public final EFP ATH_C23 = new EFP (P, -5, 0xb247b3a940a7a020L, 0x5cb7483L << 36);
1250: public final EFP ATH_C25 = new EFP (P, -5, 0xa07d6fb3e1085165L, 0x68590abL << 36);
1251: public final EFP ATH_C27 = new EFP (P, -5, 0xb976c8a2f3029b2dL, 0xa0b471bL << 36);
1252:
1253:
1254:
1255:
1256:
1257: public final EFP COS_C0 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1258: public final EFP COS_C2 = new EFP (M, -2, 0xffffffffffffffffL, 0xffffff8L << 36);
1259: public final EFP COS_C4 = new EFP (P, -5, 0xaaaaaaaaaaaaaaaaL, 0xaaa9a56L << 36);
1260: public final EFP COS_C6 = new EFP (M, -10, 0xb60b60b60b60b60bL, 0x5d7bff4L << 36);
1261: public final EFP COS_C8 = new EFP (P, -16, 0xd00d00d00d00d002L, 0x8a46e65L << 36);
1262: public final EFP COS_C10 = new EFP (M, -22, 0x93f27dbbc4facfccL, 0xd7af990L << 36);
1263: public final EFP COS_C12 = new EFP (P, -29, 0x8f76c77fc6961076L, 0x0290d00L << 36);
1264: public final EFP COS_C14 = new EFP (M, -37, 0xc9cba54576804449L, 0x648c611L << 36);
1265: public final EFP COS_C16 = new EFP (P, -45, 0xd73f9e26754ce09dL, 0xec906ebL << 36);
1266: public final EFP COS_C18 = new EFP (M, -53, 0xb412768e7c3c3046L, 0x846cd1fL << 36);
1267: public final EFP COS_C20 = new EFP (P, -62, 0xf0dad505af592189L, 0x064973cL << 36);
1268:
1269:
1270: public final EFP SIN_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1271: public final EFP SIN_C3 = new EFP (M, -3, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaa8L << 36);
1272: public final EFP SIN_C5 = new EFP (P, -7, 0x8888888888888888L, 0x88880d0L << 36);
1273: public final EFP SIN_C7 = new EFP (M, -13, 0xd00d00d00d00d00cL, 0xfe77205L << 36);
1274: public final EFP SIN_C9 = new EFP (P, -19, 0xb8ef1d2ab6399c76L, 0xfe4484aL << 36);
1275: public final EFP SIN_C11 = new EFP (M, -26, 0xd7322b3faa27078eL, 0x1700055L << 36);
1276: public final EFP SIN_C13 = new EFP (P, -33, 0xb092309d433be4baL, 0xeb15e86L << 36);
1277: public final EFP SIN_C15 = new EFP (M, -41, 0xd73f9f392253780eL, 0x670f3ecL << 36);
1278: public final EFP SIN_C17 = new EFP (P, -49, 0xca963aa1cfea3bf8L, 0x08cec0aL << 36);
1279: public final EFP SIN_C19 = new EFP (M, -57, 0x97a3db8f70e5ae02L, 0x8f1dd1fL << 36);
1280: public final EFP SIN_C21 = new EFP (P, -66, 0xb791d94ca9fd98fdL, 0x74f2261L << 36);
1281:
1282:
1283:
1284:
1285:
1286: public final EFP COSH_C0 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1287: public final EFP COSH_C2 = new EFP (P, -1, 0x8000000000000000L, 0x0000000L << 36);
1288: public final EFP COSH_C4 = new EFP (P, -5, 0xaaaaaaaaaaaaaaaaL, 0xaaa9902L << 36);
1289: public final EFP COSH_C6 = new EFP (P, -10, 0xb60b60b60b60b60bL, 0xa75a997L << 36);
1290: public final EFP COSH_C8 = new EFP (P, -16, 0xd00d00d00d00beb4L, 0xa29cfbaL << 36);
1291: public final EFP COSH_C10 = new EFP (P, -22, 0x93f27dbbc74aee4dL, 0x312895cL << 36);
1292: public final EFP COSH_C12 = new EFP (P, -29, 0x8f76c72851473b51L, 0xdc04f2cL << 36);
1293: public final EFP COSH_C14 = new EFP (P, -37, 0xc9d919ab996aa4aeL, 0x80c913fL << 36);
1294:
1295:
1296:
1297:
1298: public final EFP[] EXP_P_I = {
1299:
1300: new EFP (P, 1, 0xadf85458a2bb4a9aL, 0xafdc562L << 36),
1301: new EFP (P, 2, 0xec7325c6a6ed6e61L, 0x9d1dd10L << 36),
1302: new EFP (P, 5, 0xda64817139d2c33cL, 0x6b69dffL << 36),
1303: new EFP (P, 11, 0xba4f53ea38636f85L, 0xf007042L << 36),
1304: new EFP (P, 23, 0x87975e8540010249L, 0x11f8b84L << 36),
1305: new EFP (P, 46, 0x8fa1fe625b3163ecL, 0x23c4201L << 36),
1306: new EFP (P, 92, 0xa12cc167acbe6902L, 0xe71eadaL << 36),
1307: new EFP (P, 184, 0xcaf2a62eea10bbfaL, 0x9fa6a91L << 36),
1308: new EFP (P, 369, 0xa0e3d440a5f5d071L, 0x919807cL << 36),
1309: new EFP (P, 738, 0xca3b2825d4297360L, 0x4e42b3eL << 36),
1310: new EFP (P, 1477, 0x9fc169073a8d0d13L, 0x21c376bL << 36),
1311: new EFP (P, 2954, 0xc763a52d0570da4eL, 0xe13cad2L << 36),
1312: new EFP (P, 5909, 0x9b4c119529dab99dL, 0xde62927L << 36),
1313: new EFP (P, 11818, 0xbc6a67ca24e9ba38L, 0x5a44770L << 36),
1314: new EFP (P, 23637, 0x8aac74ab03b22463L, 0x55451adL << 36),
1315: };
1316: public final EFP[] EXP_M_I = {
1317:
1318: new EFP (P, -2, 0xbc5ab1b16779be35L, 0x75bd8f0L << 36),
1319: new EFP (P, -3, 0x8a95551dfc0e5cfeL, 0xdbb7571L << 36),
1320: new EFP (P, -6, 0x960aadc109e7a3bfL, 0x4578099L << 36),
1321: new EFP (P, -12, 0xafe10820813d65dfL, 0xe6a33c0L << 36),
1322: new EFP (P, -24, 0xf1aaddd7742e56d3L, 0x2fb9f99L << 36),
1323: new EFP (P, -47, 0xe42327bb0b2340f1L, 0x4cd0092L << 36),
1324: new EFP (P, -93, 0xcb4ea3990f265d5fL, 0x9694038L << 36),
1325: new EFP (P, -185, 0xa175cf9cd7d85844L, 0x76b75a8L << 36),
1326: new EFP (P, -370, 0xcbaacab56a74dfdcL, 0xe09d13dL << 36),
1327: new EFP (P, -739, 0xa2084f6d90498ad1L, 0xc4658daL << 36),
1328: new EFP (P, -1478, 0xcd1d09977435cc77L, 0x7a9a998L << 36),
1329: new EFP (P, -2955, 0xa45784a7bcca7d6dL, 0xc205c90L << 36),
1330: new EFP (P, -5910, 0xd3007fc4b14655ddL, 0x1be84e5L << 36),
1331: new EFP (P, -11819, 0xade9d29e7bfeb08eL, 0x33a8236L << 36),
1332: new EFP (P, -23638, 0xec4bb8768ab8ab91L, 0x718a7e7L << 36),
1333: };
1334:
1335: public final EFP EXP_C0 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1336: public final EFP EXP_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000001L << 36);
1337: public final EFP EXP_C2 = new EFP (P, -1, 0x8000000000000000L, 0x0000000L << 36);
1338: public final EFP EXP_C3 = new EFP (P, -3, 0xaaaaaaaaaaaaaaaaL, 0xaa4e330L << 36);
1339: public final EFP EXP_C4 = new EFP (P, -5, 0xaaaaaaaaaaaaaaaaL, 0xaa6fd2eL << 36);
1340: public final EFP EXP_C5 = new EFP (P, -7, 0x8888888888888a8eL, 0x59cdd2cL << 36);
1341: public final EFP EXP_C6 = new EFP (P, -10, 0xb60b60b60b60b801L, 0x80edd29L << 36);
1342: public final EFP EXP_C7 = new EFP (P, -13, 0xd00d00cffa827bd9L, 0xd1653b8L << 36);
1343: public final EFP EXP_C8 = new EFP (P, -16, 0xd00d00cffddf45a5L, 0xbdc8fc1L << 36);
1344: public final EFP EXP_C9 = new EFP (P, -19, 0xb8ef6724028aa32dL, 0x54addf6L << 36);
1345: public final EFP EXP_C10 = new EFP (P, -22, 0x93f2b38858c23b84L, 0xa93e7c6L << 36);
1346:
1347: public final EFP[] EXP_P_T = {
1348:
1349: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
1350: new EFP (P, 0, 0x8204055aaef1c8bdL, 0x5c3259fL << 36),
1351: new EFP (P, 0, 0x84102b00893f64c7L, 0x05e841dL << 36),
1352: new EFP (P, 0, 0x862491b414f45e14L, 0x967f31fL << 36),
1353: new EFP (P, 0, 0x88415abbe9a76beaL, 0xd8d00cfL << 36),
1354: new EFP (P, 0, 0x8a66a7e4c4e6b22aL, 0xaf50ce3L << 36),
1355: new EFP (P, 0, 0x8c949b83a7066b44L, 0x9e8c66eL << 36),
1356: new EFP (P, 0, 0x8ecb5877f873c9e8L, 0xac7a4d3L << 36),
1357: new EFP (P, 0, 0x910b022db7ae67ceL, 0x76b441cL << 36),
1358: new EFP (P, 0, 0x9353bc9fb00b215aL, 0xeb98600L << 36),
1359: new EFP (P, 0, 0x95a5ac59b963ca80L, 0x9bb3e06L << 36),
1360: new EFP (P, 0, 0x9800f67b00d7b805L, 0xeae44b2L << 36),
1361: new EFP (P, 0, 0x9a65c0b85ac1a96aL, 0x7062466L << 36),
1362: new EFP (P, 0, 0x9cd4315e9e0832fbL, 0xa34f398L << 36),
1363: new EFP (P, 0, 0x9f4c6f5508ee5d51L, 0xbbdee02L << 36),
1364: new EFP (P, 0, 0xa1cea21faf8ac771L, 0xd268bc6L << 36),
1365: new EFP (P, 0, 0xa45af1e1f40c333bL, 0x3de1db5L << 36),
1366: new EFP (P, 0, 0xa6f1876108f3009dL, 0xa911f65L << 36),
1367: new EFP (P, 0, 0xa9928c067d67bb65L, 0x16cc14dL << 36),
1368: new EFP (P, 0, 0xac3e29e2d3d7813bL, 0x0e93c01L << 36),
1369: new EFP (P, 0, 0xaef48bb022ffa9daL, 0x899232aL << 36),
1370: new EFP (P, 0, 0xb1b5dcd4c192c269L, 0x39863eeL << 36),
1371: new EFP (P, 0, 0xb4824965fca1967eL, 0xd7cc083L << 36),
1372: new EFP (P, 0, 0xb759fe2ad8f3ada4L, 0xeb266efL << 36),
1373: new EFP (P, 0, 0xba3d289edf7b5311L, 0xa3c5b2dL << 36),
1374: new EFP (P, 0, 0xbd2bf6f4f511ef19L, 0xfdaedb7L << 36),
1375: new EFP (P, 0, 0xc026981a3daa2e5dL, 0x65cddb9L << 36),
1376: new EFP (P, 0, 0xc32d3bb90b262a0aL, 0xee10dd1L << 36),
1377: new EFP (P, 0, 0xc640123bd8007ee1L, 0x26da077L << 36),
1378: new EFP (P, 0, 0xc95f4cd04df7fdb9L, 0x9bfe7cfL << 36),
1379: new EFP (P, 0, 0xcc8b1d6a58ee609bL, 0x8c7b82aL << 36),
1380: new EFP (P, 0, 0xcfc3b6c7462b3282L, 0xc0bf5ecL << 36),
1381: new EFP (P, 0, 0xd3094c70f034de4bL, 0x96ff7d6L << 36),
1382: new EFP (P, 0, 0xd65c12c0f772a298L, 0xdbec9f1L << 36),
1383: new EFP (P, 0, 0xd9bc3ee407caf517L, 0x6670eb8L << 36),
1384: new EFP (P, 0, 0xdd2a06dd2b72af4bL, 0x7809cf2L << 36),
1385: new EFP (P, 0, 0xe0a5a1892b223221L, 0x955289eL << 36),
1386: new EFP (P, 0, 0xe42f46a1fbe683ddL, 0x1461033L << 36),
1387: new EFP (P, 0, 0xe7c72ec23ac545bfL, 0x66c74a2L << 36),
1388: new EFP (P, 0, 0xeb6d9368b66b3bf1L, 0xc77fd15L << 36),
1389: new EFP (P, 0, 0xef22aefc071e02e5L, 0x44bd839L << 36),
1390: new EFP (P, 0, 0xf2e6bcce352a7191L, 0x2542fa9L << 36),
1391: new EFP (P, 0, 0xf6b9f9206e0a0fc3L, 0xabd8e27L << 36),
1392: new EFP (P, 0, 0xfa9ca126c87af32bL, 0xb68e7a5L << 36),
1393: new EFP (P, 0, 0xfe8ef30c17c644e9L, 0x61db684L << 36),
1394: new EFP (P, 1, 0x814896fae739522fL, 0xd207331L << 36),
1395: new EFP (P, 1, 0x8351c903f850495fL, 0xf940cd1L << 36),
1396: new EFP (P, 1, 0x856330348b2806b5L, 0x6ded10fL << 36),
1397: new EFP (P, 1, 0x877ceda33ee7bdeaL, 0x61ab772L << 36),
1398: new EFP (P, 1, 0x899f22ec174a8c1aL, 0x3d1e65aL << 36),
1399: new EFP (P, 1, 0x8bc9f23296628075L, 0x3fa07acL << 36),
1400: new EFP (P, 1, 0x8dfd7e23ded395adL, 0xcd8bb99L << 36),
1401: new EFP (P, 1, 0x9039e9f8dea8bffcL, 0x88e9e18L << 36),
1402: new EFP (P, 1, 0x927f597882e5bd3aL, 0x5153fb8L << 36),
1403: new EFP (P, 1, 0x94cdf0f9f3f8e05cL, 0x238b7d8L << 36),
1404: new EFP (P, 1, 0x9725d566db309f9dL, 0x44caba1L << 36),
1405: new EFP (P, 1, 0x99872c3db1593ce1L, 0x10ffabeL << 36),
1406: new EFP (P, 1, 0x9bf21b9416a77258L, 0x29f648fL << 36),
1407: new EFP (P, 1, 0x9e66ca193415a245L, 0xd019082L << 36),
1408: new EFP (P, 1, 0xa0e55f1826599febL, 0x28fc34fL << 36),
1409: new EFP (P, 1, 0xa36e027a7299c128L, 0x96ff655L << 36),
1410: new EFP (P, 1, 0xa600dcca8508845aL, 0xa0a2a0dL << 36),
1411: new EFP (P, 1, 0xa89e1736398eb461L, 0xfd1d370L << 36),
1412: new EFP (P, 1, 0xab45db916eac95afL, 0x15018e6L << 36),
1413: };
1414: public final EFP[] EXP_M_T = {
1415:
1416: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
1417: new EFP (P, -1, 0xfc07f55ff77d2493L, 0xe885eebL << 36),
1418: new EFP (P, -1, 0xf81fab5445aebc8aL, 0x58055fdL << 36),
1419: new EFP (P, -1, 0xf446e357f67dfd8eL, 0x33bd6c8L << 36),
1420: new EFP (P, -1, 0xf07d5fde38151e72L, 0xf18ff03L << 36),
1421: new EFP (P, -1, 0xecc2e44e820d18c3L, 0xcc6f18aL << 36),
1422: new EFP (P, -1, 0xe9173500cbe0159aL, 0xa3084a2L << 36),
1423: new EFP (P, -1, 0xe57a1739d263ec94L, 0x8222e86L << 36),
1424: new EFP (P, -1, 0xe1eb51276c110c3cL, 0x3eb126aL << 36),
1425: new EFP (P, -1, 0xde6aa9dcebdb100bL, 0x56a61aaL << 36),
1426: new EFP (P, -1, 0xdaf7e94f9261313dL, 0x5fd7d71L << 36),
1427: new EFP (P, -1, 0xd792d8530d3da531L, 0x2b5abcbL << 36),
1428: new EFP (P, -1, 0xd43b4096043bde02L, 0xc9dd905L << 36),
1429: new EFP (P, -1, 0xd0f0ec9eb43e8078L, 0xe9af6bbL << 36),
1430: new EFP (P, -1, 0xcdb3a7c7979ebd5cL, 0x80489dbL << 36),
1431: new EFP (P, -1, 0xca833e3c1bcf93e9L, 0x0747d1aL << 36),
1432: new EFP (P, -1, 0xc75f7cf564105743L, 0x415cbcaL << 36),
1433: new EFP (P, -1, 0xc44831b718faa1d9L, 0xc29d8daL << 36),
1434: new EFP (P, -1, 0xc13d2b0c44b8af4aL, 0x68aa4e8L << 36),
1435: new EFP (P, -1, 0xbe3e38443bb1dfefL, 0x65597dbL << 36),
1436: new EFP (P, -1, 0xbb4b296f917bf09aL, 0x22fbaa2L << 36),
1437: new EFP (P, -1, 0xb863cf5d19e0354eL, 0x91dbb17L << 36),
1438: new EFP (P, -1, 0xb587fb96f5c4e712L, 0xa053452L << 36),
1439: new EFP (P, -1, 0xb2b7805fabcb5327L, 0xcdbad0eL << 36),
1440: new EFP (P, -1, 0xaff230af4c747553L, 0xd8db805L << 36),
1441: new EFP (P, -1, 0xad37e030a19e3f45L, 0x315a9f6L << 36),
1442: new EFP (P, -1, 0xaa88633e692c84abL, 0x9760affL << 36),
1443: new EFP (P, -1, 0xa7e38ee09ab13658L, 0x8e4fa89L << 36),
1444: new EFP (P, -1, 0xa54938c9b7e846b1L, 0x22756d1L << 36),
1445: new EFP (P, -1, 0xa2b9375427dc3ef5L, 0xfdb6013L << 36),
1446: new EFP (P, -1, 0xa033617f9c893772L, 0xb7f2709L << 36),
1447: new EFP (P, -1, 0x9db78eee82d48c8cL, 0x5e432e4L << 36),
1448: new EFP (P, -1, 0x9b4597e37cb04ff3L, 0xd675a35L << 36),
1449: new EFP (P, -1, 0x98dd553ee54217fdL, 0x5f7533bL << 36),
1450: new EFP (P, -1, 0x967ea07c5ee56f55L, 0x27376f0L << 36),
1451: new EFP (P, -1, 0x942953b06ae2c503L, 0xc6e249aL << 36),
1452: new EFP (P, -1, 0x91dd49860ab457feL, 0x49ecbc0L << 36),
1453: new EFP (P, -1, 0x8f9a5d3c6ab3325dL, 0xe98839bL << 36),
1454: new EFP (P, -1, 0x8d606aa49606deddL, 0x68c91a3L << 36),
1455: new EFP (P, -1, 0x8b2f4e1f33b31766L, 0x67ee085L << 36),
1456: new EFP (P, -1, 0x8906e49a4c9f3d59L, 0x58a5d18L << 36),
1457: new EFP (P, -1, 0x86e70b8f1a73fbd8L, 0x1858e19L << 36),
1458: new EFP (P, -1, 0x84cfa0ffdf2c01beL, 0x9229f8cL << 36),
1459: new EFP (P, -1, 0x82c08375c5354c26L, 0xfed9d9bL << 36),
1460: new EFP (P, -1, 0x80b991fec8010361L, 0x182aa18L << 36),
1461: new EFP (P, -2, 0xfd75585749c0e65aL, 0xe0e13c7L << 36),
1462: new EFP (P, -2, 0xf987641ba81c57c1L, 0x08b166eL << 36),
1463: new EFP (P, -2, 0xf5a9086b1385b9a8L, 0xb38238dL << 36),
1464: new EFP (P, -2, 0xf1da075f7e6bf297L, 0x7e1e9a0L << 36),
1465: new EFP (P, -2, 0xee1a240886d56f4fL, 0x1d073e3L << 36),
1466: new EFP (P, -2, 0xea692267a754ef29L, 0x4911dc3L << 36),
1467: new EFP (P, -2, 0xe6c6c76c771c2d60L, 0x96a4be2L << 36),
1468: new EFP (P, -2, 0xe332d8f0f8f06820L, 0xcd7f8e6L << 36),
1469: new EFP (P, -2, 0xdfad1db5f8c5b458L, 0x70f8209L << 36),
1470: new EFP (P, -2, 0xdc355d5f77c6f7b3L, 0x2d36b03L << 36),
1471: new EFP (P, -2, 0xd8cb6071269148f0L, 0x7444892L << 36),
1472: new EFP (P, -2, 0xd56ef04aed6a5a01L, 0x2a76dd4L << 36),
1473: new EFP (P, -2, 0xd21fd725823a6f09L, 0x0871f0bL << 36),
1474: new EFP (P, -2, 0xcedde00f0c13419aL, 0x4cddcf7L << 36),
1475: new EFP (P, -2, 0xcba8d6e7d40e0852L, 0x3c9f035L << 36),
1476: new EFP (P, -2, 0xc880885f034bb070L, 0x530b9f4L << 36),
1477: new EFP (P, -2, 0xc564c1ef6de32926L, 0x3b6f5ecL << 36),
1478: new EFP (P, -2, 0xc25551dc6a8a6f40L, 0xdc958f1L << 36),
1479: new EFP (P, -2, 0xbf52072eb6c7d377L, 0xd431325L << 36),
1480: };
1481:
1482:
1483:
1484: public final EFP[] EXP10_P_I = {
1485:
1486: new EFP (P, 3, 0xa000000000000000L, 0x0000000L << 36),
1487: new EFP (P, 6, 0xc800000000000000L, 0x0000000L << 36),
1488: new EFP (P, 13, 0x9c40000000000000L, 0x0000000L << 36),
1489: new EFP (P, 26, 0xbebc200000000000L, 0x0000000L << 36),
1490: new EFP (P, 53, 0x8e1bc9bf04000000L, 0x0000000L << 36),
1491: new EFP (P, 106, 0x9dc5ada82b70b59dL, 0xf020000L << 36),
1492: new EFP (P, 212, 0xc2781f49ffcfa6d5L, 0x3cbf6b7L << 36),
1493: new EFP (P, 425, 0x93ba47c980e98cdfL, 0xc66f337L << 36),
1494: new EFP (P, 850, 0xaa7eebfb9df9de8dL, 0xddbb902L << 36),
1495: new EFP (P, 1700, 0xe319a0aea60e91c6L, 0xcc655c5L << 36),
1496: new EFP (P, 3401, 0xc976758681750c17L, 0x650d3d3L << 36),
1497: new EFP (P, 6803, 0x9e8b3b5dc53d5de4L, 0xa74d28dL << 36),
1498: new EFP (P, 13606, 0xc46052028a20979aL, 0xc94c154L << 36),
1499: new EFP (P, 27213, 0x96a3a1d17faf211aL, 0x0c7c289L << 36),
1500: };
1501: public final EFP[] EXP10_M_I = {
1502:
1503: new EFP (P, -4, 0xccccccccccccccccL, 0xccccccdL << 36),
1504: new EFP (P, -7, 0xa3d70a3d70a3d70aL, 0x3d70a3dL << 36),
1505: new EFP (P, -14, 0xd1b71758e219652bL, 0xd3c3611L << 36),
1506: new EFP (P, -27, 0xabcc77118461cefcL, 0xfdc20d3L << 36),
1507: new EFP (P, -54, 0xe69594bec44de15bL, 0x4c2ebe7L << 36),
1508: new EFP (P, -107, 0xcfb11ead453994baL, 0x67de18fL << 36),
1509: new EFP (P, -213, 0xa87fea27a539e9a5L, 0x3f2398dL << 36),
1510: new EFP (P, -426, 0xddd0467c64bce4a0L, 0xac7cb3fL << 36),
1511: new EFP (P, -851, 0xc0314325637a1939L, 0xfa91115L << 36),
1512: new EFP (P, -1701, 0x9049ee32db23d21cL, 0x7132d33L << 36),
1513: new EFP (P, -3402, 0xa2a682a5da57c0bdL, 0x87a6016L << 36),
1514: new EFP (P, -6804, 0xceae534f34362de4L, 0x492512dL << 36),
1515: new EFP (P, -13607, 0xa6dd04c8d2ce9fdeL, 0x2de3812L << 36),
1516: new EFP (P, -27214, 0xd986c20b686da869L, 0x5d1d4feL << 36),
1517: };
1518:
1519: public final EFP EXP10_C0 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1520: public final EFP EXP10_C1 = new EFP (P, 1, 0x935d8dddaaa8ac16L, 0xea56d63L << 36);
1521: public final EFP EXP10_C2 = new EFP (P, 1, 0xa9a92639e753443aL, 0x80aa0a5L << 36);
1522: public final EFP EXP10_C3 = new EFP (P, 1, 0x82382c8ef1652304L, 0x6a4fce8L << 36);
1523: public final EFP EXP10_C4 = new EFP (P, 0, 0x95ebb04fecc62263L, 0x3516d57L << 36);
1524: public final EFP EXP10_C5 = new EFP (P, -1, 0x8a14ffe8ea6bb111L, 0x0f9d433L << 36);
1525: public final EFP EXP10_C6 = new EFP (P, -3, 0xd3f6b8423e47031dL, 0xb2e8d4cL << 36);
1526: public final EFP EXP10_C7 = new EFP (P, -4, 0x8b726fe199d4dd8aL, 0x0319896L << 36);
1527: public final EFP EXP10_C8 = new EFP (P, -6, 0xa08b582ea51b0457L, 0xa2bc993L << 36);
1528: public final EFP EXP10_C9 = new EFP (P, -8, 0xa44be22db201cf47L, 0x94dcaeaL << 36);
1529: public final EFP EXP10_C10 = new EFP (P, -10, 0x9753b9561c0a683fL, 0x0135acdL << 36);
1530: public final EFP EXP10_C11 = new EFP (P, -13, 0xfd69aac60b9f8924L, 0x6d6c8b2L << 36);
1531:
1532: public final EFP[] EXP10_P_T = {
1533:
1534: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
1535: new EFP (P, 0, 0x84b06346cc5e15f9L, 0x701148dL << 36),
1536: new EFP (P, 0, 0x898cbfd35533bb59L, 0x3c49e31L << 36),
1537: new EFP (P, 0, 0x8e96b208a3664881L, 0x0ec125aL << 36),
1538: new EFP (P, 0, 0x93cfe56520272d66L, 0x5aa4cf9L << 36),
1539: new EFP (P, 0, 0x993a151041524281L, 0xa5bb585L << 36),
1540: new EFP (P, 0, 0x9ed70c6d6669efa1L, 0xfe3df3cL << 36),
1541: new EFP (P, 0, 0xa4a8a7b416dcf6d2L, 0xcb3598fL << 36),
1542: new EFP (P, 0, 0xaab0d48dd40a21eeL, 0xe3993e6L << 36),
1543: new EFP (P, 0, 0xb0f192b9b34f3a68L, 0x955eb28L << 36),
1544: new EFP (P, 0, 0xb76cf4b5f65b3109L, 0xa96afc1L << 36),
1545: new EFP (P, 0, 0xbe25206fd9f7d185L, 0xaebfd1dL << 36),
1546: new EFP (P, 0, 0xc51c4ff9d58e742dL, 0x8b26b72L << 36),
1547: new EFP (P, 0, 0xcc54d24887cd8593L, 0x587bd74L << 36),
1548: new EFP (P, 0, 0xd3d10bf68f0b258cL, 0xf7a8720L << 36),
1549: new EFP (P, 0, 0xdb93780f8e4c4878L, 0xa97bdbaL << 36),
1550: new EFP (P, 0, 0xe39ea8e2a2387187L, 0xf37c989L << 36),
1551: new EFP (P, 0, 0xebf548dc8bb914d9L, 0x7f50e38L << 36),
1552: new EFP (P, 0, 0xf49a1b69d891c56dL, 0x960a16fL << 36),
1553: new EFP (P, 0, 0xfd8ffde154e45e46L, 0x6d275e3L << 36),
1554: new EFP (P, 1, 0x836cf43b89a99c01L, 0x4fdf0c0L << 36),
1555: new EFP (P, 1, 0x883d779c2e260ef2L, 0x8fcb8a1L << 36),
1556: new EFP (P, 1, 0x8d3b21886bfd0401L, 0xb2e86d9L << 36),
1557: new EFP (P, 1, 0x9267996ca4b54f44L, 0xfac62acL << 36),
1558: new EFP (P, 1, 0x97c496381a501b96L, 0x8f187f6L << 36),
1559: new EFP (P, 1, 0x9d53deee66493377L, 0x48d07c3L << 36),
1560: new EFP (P, 1, 0xa3174b3e44c3bf1cL, 0x5882b85L << 36),
1561: new EFP (P, 1, 0xa910c41de5dcba7fL, 0x26e2683L << 36),
1562: new EFP (P, 1, 0xaf42446cf8f10ddbL, 0xdeffc99L << 36),
1563: new EFP (P, 1, 0xb5add99ca78b05aeL, 0xb531acaL << 36),
1564: new EFP (P, 1, 0xbc55a45db7a285f3L, 0x2c86e23L << 36),
1565: new EFP (P, 1, 0xc33bd9550ee56612L, 0x36b705cL << 36),
1566: new EFP (P, 1, 0xca62c1d6d2da9490L, 0x2515e42L << 36),
1567: new EFP (P, 1, 0xd1ccbca863e3a684L, 0x9dcd927L << 36),
1568: new EFP (P, 1, 0xd97c3ec973660921L, 0xc624e27L << 36),
1569: new EFP (P, 1, 0xe173d44477bfebc8L, 0xc9e83d6L << 36),
1570: new EFP (P, 1, 0xe9b62106c31def2cL, 0x8c4b218L << 36),
1571: new EFP (P, 1, 0xf245e1c084ce80edL, 0x038ee92L << 36),
1572: new EFP (P, 1, 0xfb25ecccff4f619aL, 0x3e59575L << 36),
1573: new EFP (P, 2, 0x822c9991a00501dfL, 0x459ef69L << 36),
1574: new EFP (P, 2, 0x86f160a7d4429212L, 0x10e2195L << 36),
1575: new EFP (P, 2, 0x8be2e03b4ddf0e98L, 0x12bb325L << 36),
1576: new EFP (P, 2, 0x9102bbb052b20069L, 0x01f46c1L << 36),
1577: new EFP (P, 2, 0x9652a5c839e93b97L, 0xa26a9f7L << 36),
1578: new EFP (P, 2, 0x9bd461318075e327L, 0xba8d5a6L << 36),
1579: new EFP (P, 2, 0xa189c11d24a8aa65L, 0x85c7857L << 36),
1580: new EFP (P, 2, 0xa774a9d97a7cc699L, 0x267ff04L << 36),
1581: new EFP (P, 2, 0xad971172abe13529L, 0x4e7987eL << 36),
1582: new EFP (P, 2, 0xb3f300591a312caeL, 0x82ddc80L << 36),
1583: new EFP (P, 2, 0xba8a920dd7ff6294L, 0x8fdbe3cL << 36),
1584: new EFP (P, 2, 0xc15ff5d5745ce801L, 0xf9cbdb1L << 36),
1585: new EFP (P, 2, 0xc8756f7152dc6b33L, 0xd916f2aL << 36),
1586: new EFP (P, 2, 0xcfcd57dfcdbe57f5L, 0x06243dfL << 36),
1587: new EFP (P, 2, 0xd76a1e2361f25a79L, 0x376f47eL << 36),
1588: new EFP (P, 2, 0xdf4e481126efea96L, 0x226ac46L << 36),
1589: new EFP (P, 2, 0xe77c7326d6d287faL, 0x80d6746L << 36),
1590: new EFP (P, 2, 0xeff75568ada7ffc1L, 0x9a2a3e9L << 36),
1591: new EFP (P, 2, 0xf8c1be4769784541L, 0xfbc290fL << 36),
1592: new EFP (P, 3, 0x80ef4bc75b9ffbd5L, 0x0910ec4L << 36),
1593: new EFP (P, 3, 0x85a8732e2df0c035L, 0xb3cb958L << 36),
1594: new EFP (P, 3, 0x8a8de610357adc41L, 0x4850544L << 36),
1595: new EFP (P, 3, 0x8fa143d3703294f4L, 0x841b5f8L << 36),
1596: new EFP (P, 3, 0x94e43b157a67a6c0L, 0x97fe98cL << 36),
1597: new EFP (P, 3, 0x9a588a3a43ff4e3cL, 0x381b0ceL << 36),
1598: };
1599: public final EFP[] EXP10_M_T = {
1600:
1601: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
1602: new EFP (P, -1, 0xf6f4105d39987d2dL, 0x2691ae4L << 36),
1603: new EFP (P, -1, 0xee39f8225d72a467L, 0x59975acL << 36),
1604: new EFP (P, -1, 0xe5ced2ebe6b754baL, 0x6cf898cL << 36),
1605: new EFP (P, -1, 0xddafd68055916068L, 0x73b3b9fL << 36),
1606: new EFP (P, -1, 0xd5da51e37cb466bcL, 0x52df55aL << 36),
1607: new EFP (P, -1, 0xce4bac722c332c88L, 0x0e8179fL << 36),
1608: new EFP (P, -1, 0xc7016505edf9d101L, 0x963540cL << 36),
1609: new EFP (P, -1, 0xbff911208aeccc9aL, 0xe1bb654L << 36),
1610: new EFP (P, -1, 0xb9305c1f12420662L, 0x00ab904L << 36),
1611: new EFP (P, -1, 0xb2a506741f265544L, 0xe85569fL << 36),
1612: new EFP (P, -1, 0xac54e4e91b284860L, 0xf925d32L << 36),
1613: new EFP (P, -1, 0xa63ddfe63e31dff7L, 0x381cfe5L << 36),
1614: new EFP (P, -1, 0xa05df2c10f16bc29L, 0x7a78c22L << 36),
1615: new EFP (P, -1, 0x9ab32b1129e3ecceL, 0x616fe27L << 36),
1616: new EFP (P, -1, 0x953ba80b1332b543L, 0xa649830L << 36),
1617: new EFP (P, -1, 0x8ff599e0e1c0f08bL, 0x9be4a00L << 36),
1618: new EFP (P, -1, 0x8adf41288980f754L, 0x3ec79ffL << 36),
1619: new EFP (P, -1, 0x85f6ee4795309ee0L, 0xeb998d0L << 36),
1620: new EFP (P, -1, 0x813b00e41d53bb84L, 0x6b06046L << 36),
1621: new EFP (P, -2, 0xf953ceb59a56383fL, 0x90e22a4L << 36),
1622: new EFP (P, -2, 0xf0843c738fdb928cL, 0x3710ff2L << 36),
1623: new EFP (P, -2, 0xe8045f80845000a8L, 0x0320aceL << 36),
1624: new EFP (P, -2, 0xdfd166c54964e426L, 0x845eb6eL << 36),
1625: new EFP (P, -2, 0xd7e89aa6206a8350L, 0x1b035bbL << 36),
1626: new EFP (P, -2, 0xd0475c1c333b3632L, 0x08fe574L << 36),
1627: new EFP (P, -2, 0xc8eb23d732a5e7aeL, 0x9847791L << 36),
1628: new EFP (P, -2, 0xc1d18166d0a533f0L, 0xcfa5875L << 36),
1629: new EFP (P, -2, 0xbaf81a6bcf4b25bdL, 0x3d08e7aL << 36),
1630: new EFP (P, -2, 0xb45ca9d05fccbca0L, 0xa186978L << 36),
1631: new EFP (P, -2, 0xadfcff078f84d41bL, 0x04ea4ecL << 36),
1632: new EFP (P, -2, 0xa7d6fd53831c8536L, 0xe4a4753L << 36),
1633: new EFP (P, -2, 0xa1e89b12424876d9L, 0xb744b68L << 36),
1634: new EFP (P, -2, 0x9c2fe110d8b784dbL, 0x5ef8d17L << 36),
1635: new EFP (P, -2, 0x96aae9e492e86b28L, 0xf06be83L << 36),
1636: new EFP (P, -2, 0x9157e14a1fa26af2L, 0x2a8e23bL << 36),
1637: new EFP (P, -2, 0x8c35038a60c0d7e3L, 0x18cca14L << 36),
1638: new EFP (P, -2, 0x87409ce4b7e3c865L, 0xb8b5203L << 36),
1639: new EFP (P, -2, 0x827908fe9d6965b0L, 0x46cef9dL << 36),
1640: new EFP (P, -3, 0xfbb964b0a3a85258L, 0x7480c6bL << 36),
1641: new EFP (P, -3, 0xf2d4238cf6e6928aL, 0x7e8d989L << 36),
1642: new EFP (P, -3, 0xea3f5be107887ed4L, 0xc470446L << 36),
1643: new EFP (P, -3, 0xe1f835a7132e6ccfL, 0x84a715cL << 36),
1644: new EFP (P, -3, 0xd9fbf2937d09b184L, 0x1945a9bL << 36),
1645: new EFP (P, -3, 0xd247ed2c0f75c668L, 0x7fcb466L << 36),
1646: new EFP (P, -3, 0xcad997e7771d1838L, 0x5752b1cL << 36),
1647: new EFP (P, -3, 0xc3ae7c54ad416abeL, 0x11a1abfL << 36),
1648: new EFP (P, -3, 0xbcc43a4a0960dd7aL, 0xcc40b60L << 36),
1649: new EFP (P, -3, 0xb618871bb4f9f46cL, 0xc2ca13aL << 36),
1650: new EFP (P, -3, 0xafa92cd93ea36d2dL, 0x5463162L << 36),
1651: new EFP (P, -3, 0xa97409920c08ead7L, 0x2c86c19L << 36),
1652: new EFP (P, -3, 0xa3770ea06ca46adcL, 0x46c9790L << 36),
1653: new EFP (P, -3, 0x9db03ffb113ec357L, 0xa2855f5L << 36),
1654: new EFP (P, -3, 0x981db38cae5fdad1L, 0x589974aL << 36),
1655: new EFP (P, -3, 0x92bd909191e28da1L, 0x5455967L << 36),
1656: new EFP (P, -3, 0x8d8e0efaf5d8fb86L, 0xdde55baL << 36),
1657: new EFP (P, -3, 0x888d76d7dcd4e7f2L, 0x4fadcb8L << 36),
1658: new EFP (P, -3, 0x83ba1fc3457d9242L, 0x3c2ae0cL << 36),
1659: new EFP (P, -4, 0xfe24e0af0a431903L, 0x30631faL << 36),
1660: new EFP (P, -4, 0xf529bb4d35506a69L, 0x092bc07L << 36),
1661: new EFP (P, -4, 0xec7fd56e99d848a3L, 0xc43ae5bL << 36),
1662: new EFP (P, -4, 0xe424500dd23d40ceL, 0x7e01d5dL << 36),
1663: new EFP (P, -4, 0xdc14661eeeb92bc1L, 0xfa0fd1cL << 36),
1664: new EFP (P, -4, 0xd44d6ba47a302328L, 0xb34edaeL << 36),
1665: };
1666:
1667:
1668:
1669:
1670: public final EFP EXP2P_C0 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1671: public final EFP EXP2P_C1 = new EFP (P, -1, 0xb17217f7d1cf79abL, 0xc9e3289L << 36);
1672: public final EFP EXP2P_C2 = new EFP (P, -3, 0xf5fdeffc162c7543L, 0x87306ceL << 36);
1673: public final EFP EXP2P_C3 = new EFP (P, -5, 0xe35846b82505fbc4L, 0xf77c6dfL << 36);
1674: public final EFP EXP2P_C4 = new EFP (P, -7, 0x9d955b7dd276b5acL, 0xbf41024L << 36);
1675: public final EFP EXP2P_C5 = new EFP (P, -10, 0xaec3ff3c41fa05ceL, 0xd0dbae7L << 36);
1676: public final EFP EXP2P_C6 = new EFP (P, -13, 0xa18489b6bbee153cL, 0x79516f1L << 36);
1677: public final EFP EXP2P_C7 = new EFP (P, -17, 0xffe516c43da39259L, 0x7cbaceaL << 36);
1678: public final EFP EXP2P_C8 = new EFP (P, -20, 0xb256aa5495805ceeL, 0xb4df34eL << 36);
1679:
1680:
1681: public final EFP EXP2M_C0 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1682: public final EFP EXP2M_C1 = new EFP (P, -1, 0xb17217f7d1cf79abL, 0xc9e32a0L << 36);
1683: public final EFP EXP2M_C2 = new EFP (P, -3, 0xf5fdeffc162c7543L, 0x6a5f7f6L << 36);
1684: public final EFP EXP2M_C3 = new EFP (P, -5, 0xe35846b82505fbc6L, 0x6a8d50cL << 36);
1685: public final EFP EXP2M_C4 = new EFP (P, -7, 0x9d955b7dd270c42fL, 0x60d628cL << 36);
1686: public final EFP EXP2M_C5 = new EFP (P, -10, 0xaec3ff3c422238b3L, 0x26278f5L << 36);
1687: public final EFP EXP2M_C6 = new EFP (P, -13, 0xa184894230721e7bL, 0x5e05decL << 36);
1688: public final EFP EXP2M_C7 = new EFP (P, -17, 0xffe518860467684dL, 0x1c0262cL << 36);
1689: public final EFP EXP2M_C8 = new EFP (P, -20, 0xb06adfb7eea07e61L, 0xba36904L << 36);
1690:
1691: public final EFP[] EXP2P_T = {
1692:
1693: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
1694: new EFP (P, 0, 0x8164d1f3bc030773L, 0x7be5652L << 36),
1695: new EFP (P, 0, 0x82cd8698ac2ba1d7L, 0x3e2a476L << 36),
1696: new EFP (P, 0, 0x843a28c3acde4046L, 0x1af92edL << 36),
1697: new EFP (P, 0, 0x85aac367cc487b14L, 0xc5c95b9L << 36),
1698: new EFP (P, 0, 0x871f61969e8d1010L, 0x3a1727cL << 36),
1699: new EFP (P, 0, 0x88980e8092da8527L, 0x5df8d77L << 36),
1700: new EFP (P, 0, 0x8a14d575496efd9aL, 0x080ca1eL << 36),
1701: new EFP (P, 0, 0x8b95c1e3ea8bd6e6L, 0xfbe4628L << 36),
1702: new EFP (P, 0, 0x8d1adf5b7e5ba9e5L, 0xb4c7b49L << 36),
1703: new EFP (P, 0, 0x8ea4398b45cd53c0L, 0x2dc0145L << 36),
1704: new EFP (P, 0, 0x9031dc431466b1dcL, 0x775814bL << 36),
1705: new EFP (P, 0, 0x91c3d373ab11c336L, 0x0fd6d8eL << 36),
1706: new EFP (P, 0, 0x935a2b2f13e6e92bL, 0xd339941L << 36),
1707: new EFP (P, 0, 0x94f4efa8fef70961L, 0x2e8afadL << 36),
1708: new EFP (P, 0, 0x96942d3720185a00L, 0x48ea9b7L << 36),
1709: new EFP (P, 0, 0x9837f0518db8a96fL, 0x46ad232L << 36),
1710: new EFP (P, 0, 0x99e0459320b7fa64L, 0xe43086dL << 36),
1711: new EFP (P, 0, 0x9b8d39b9d54e5538L, 0xa2a817aL << 36),
1712: new EFP (P, 0, 0x9d3ed9a72cffb750L, 0xde494cfL << 36),
1713: new EFP (P, 0, 0x9ef5326091a111adL, 0xa0911f1L << 36),
1714: new EFP (P, 0, 0xa0b0510fb9714fc2L, 0x192dc7aL << 36),
1715: new EFP (P, 0, 0xa27043030c496818L, 0x9b7a04fL << 36),
1716: new EFP (P, 0, 0xa43515ae09e6809eL, 0x0d1db48L << 36),
1717: new EFP (P, 0, 0xa5fed6a9b15138eaL, 0x1cbd7f6L << 36),
1718: new EFP (P, 0, 0xa7cd93b4e9653569L, 0x9ec5b4dL << 36),
1719: new EFP (P, 0, 0xa9a15ab4ea7c0ef8L, 0x541e24fL << 36),
1720: new EFP (P, 0, 0xab7a39b5a93ed337L, 0x658023bL << 36),
1721: new EFP (P, 0, 0xad583eea42a14ac6L, 0x4980a8dL << 36),
1722: new EFP (P, 0, 0xaf3b78ad690a4374L, 0xdf26102L << 36),
1723: new EFP (P, 0, 0xb123f581d2ac258fL, 0x87d037fL << 36),
1724: new EFP (P, 0, 0xb311c412a9112489L, 0x3ecf14eL << 36),
1725: new EFP (P, 0, 0xb504f333f9de6484L, 0x597d89bL << 36),
1726: new EFP (P, 0, 0xb6fd91e328d17791L, 0x07165f1L << 36),
1727: new EFP (P, 0, 0xb8fbaf4762fb9ee9L, 0x1b87978L << 36),
1728: new EFP (P, 0, 0xbaff5ab2133e45fbL, 0x74d519dL << 36),
1729: new EFP (P, 0, 0xbd08a39f580c36beL, 0xa8811fbL << 36),
1730: new EFP (P, 0, 0xbf1799b67a731082L, 0xe815d0bL << 36),
1731: new EFP (P, 0, 0xc12c4cca66709456L, 0x7c457d6L << 36),
1732: new EFP (P, 0, 0xc346ccda24976407L, 0x20ec856L << 36),
1733: new EFP (P, 0, 0xc5672a115506daddL, 0x3e2ad0dL << 36),
1734: new EFP (P, 0, 0xc78d74c8abb9b15cL, 0xc13a2e4L << 36),
1735: new EFP (P, 0, 0xc9b9bd866e2f27a2L, 0x80e1f93L << 36),
1736: new EFP (P, 0, 0xcbec14fef2727c5cL, 0xf4907c9L << 36),
1737: new EFP (P, 0, 0xce248c151f8480e3L, 0xe235839L << 36),
1738: new EFP (P, 0, 0xd06333daef2b2594L, 0xd6d45c6L << 36),
1739: new EFP (P, 0, 0xd2a81d91f12ae45aL, 0x12248e5L << 36),
1740: new EFP (P, 0, 0xd4f35aabcfedfa1fL, 0x5921df0L << 36),
1741: new EFP (P, 0, 0xd744fccad69d6af4L, 0x39a68bcL << 36),
1742: new EFP (P, 0, 0xd99d15c278afd7b5L, 0xfe873dfL << 36),
1743: new EFP (P, 0, 0xdbfbb797daf23755L, 0x3d840d6L << 36),
1744: new EFP (P, 0, 0xde60f4825e0e9123L, 0xdd07a2eL << 36),
1745: new EFP (P, 0, 0xe0ccdeec2a94e111L, 0x0658950L << 36),
1746: new EFP (P, 0, 0xe33f8972be8a5a51L, 0x09bfe90L << 36),
1747: new EFP (P, 0, 0xe5b906e77c8348a8L, 0x1e5e8f5L << 36),
1748: new EFP (P, 0, 0xe8396a503c4bdc68L, 0x791790dL << 36),
1749: new EFP (P, 0, 0xeac0c6e7dd24392eL, 0xd02d75bL << 36),
1750: new EFP (P, 0, 0xed4f301ed9942b84L, 0x600d2dbL << 36),
1751: new EFP (P, 0, 0xefe4b99bdcdaf5cbL, 0x46561cfL << 36),
1752: new EFP (P, 0, 0xf281773c59ffb139L, 0xe8980aaL << 36),
1753: new EFP (P, 0, 0xf5257d152486cc2cL, 0x7b9d0c8L << 36),
1754: new EFP (P, 0, 0xf7d0df730ad13bb8L, 0xfe90d49L << 36),
1755: new EFP (P, 0, 0xfa83b2db722a033aL, 0x7c25bb1L << 36),
1756: new EFP (P, 0, 0xfd3e0c0cf486c174L, 0x853f3a6L << 36),
1757: };
1758: public final EFP[] EXP2M_T = {
1759:
1760: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
1761: new EFP (P, -1, 0xfd3e0c0cf486c174L, 0x853f3a6L << 36),
1762: new EFP (P, -1, 0xfa83b2db722a033aL, 0x7c25bb1L << 36),
1763: new EFP (P, -1, 0xf7d0df730ad13bb8L, 0xfe90d49L << 36),
1764: new EFP (P, -1, 0xf5257d152486cc2cL, 0x7b9d0c8L << 36),
1765: new EFP (P, -1, 0xf281773c59ffb139L, 0xe8980aaL << 36),
1766: new EFP (P, -1, 0xefe4b99bdcdaf5cbL, 0x46561cfL << 36),
1767: new EFP (P, -1, 0xed4f301ed9942b84L, 0x600d2dbL << 36),
1768: new EFP (P, -1, 0xeac0c6e7dd24392eL, 0xd02d75bL << 36),
1769: new EFP (P, -1, 0xe8396a503c4bdc68L, 0x791790dL << 36),
1770: new EFP (P, -1, 0xe5b906e77c8348a8L, 0x1e5e8f5L << 36),
1771: new EFP (P, -1, 0xe33f8972be8a5a51L, 0x09bfe90L << 36),
1772: new EFP (P, -1, 0xe0ccdeec2a94e111L, 0x0658950L << 36),
1773: new EFP (P, -1, 0xde60f4825e0e9123L, 0xdd07a2eL << 36),
1774: new EFP (P, -1, 0xdbfbb797daf23755L, 0x3d840d6L << 36),
1775: new EFP (P, -1, 0xd99d15c278afd7b5L, 0xfe873dfL << 36),
1776: new EFP (P, -1, 0xd744fccad69d6af4L, 0x39a68bcL << 36),
1777: new EFP (P, -1, 0xd4f35aabcfedfa1fL, 0x5921df0L << 36),
1778: new EFP (P, -1, 0xd2a81d91f12ae45aL, 0x12248e5L << 36),
1779: new EFP (P, -1, 0xd06333daef2b2594L, 0xd6d45c6L << 36),
1780: new EFP (P, -1, 0xce248c151f8480e3L, 0xe235839L << 36),
1781: new EFP (P, -1, 0xcbec14fef2727c5cL, 0xf4907c9L << 36),
1782: new EFP (P, -1, 0xc9b9bd866e2f27a2L, 0x80e1f93L << 36),
1783: new EFP (P, -1, 0xc78d74c8abb9b15cL, 0xc13a2e4L << 36),
1784: new EFP (P, -1, 0xc5672a115506daddL, 0x3e2ad0dL << 36),
1785: new EFP (P, -1, 0xc346ccda24976407L, 0x20ec856L << 36),
1786: new EFP (P, -1, 0xc12c4cca66709456L, 0x7c457d6L << 36),
1787: new EFP (P, -1, 0xbf1799b67a731082L, 0xe815d0bL << 36),
1788: new EFP (P, -1, 0xbd08a39f580c36beL, 0xa8811fbL << 36),
1789: new EFP (P, -1, 0xbaff5ab2133e45fbL, 0x74d519dL << 36),
1790: new EFP (P, -1, 0xb8fbaf4762fb9ee9L, 0x1b87978L << 36),
1791: new EFP (P, -1, 0xb6fd91e328d17791L, 0x07165f1L << 36),
1792: new EFP (P, -1, 0xb504f333f9de6484L, 0x597d89bL << 36),
1793: new EFP (P, -1, 0xb311c412a9112489L, 0x3ecf14eL << 36),
1794: new EFP (P, -1, 0xb123f581d2ac258fL, 0x87d037fL << 36),
1795: new EFP (P, -1, 0xaf3b78ad690a4374L, 0xdf26102L << 36),
1796: new EFP (P, -1, 0xad583eea42a14ac6L, 0x4980a8dL << 36),
1797: new EFP (P, -1, 0xab7a39b5a93ed337L, 0x658023bL << 36),
1798: new EFP (P, -1, 0xa9a15ab4ea7c0ef8L, 0x541e24fL << 36),
1799: new EFP (P, -1, 0xa7cd93b4e9653569L, 0x9ec5b4dL << 36),
1800: new EFP (P, -1, 0xa5fed6a9b15138eaL, 0x1cbd7f6L << 36),
1801: new EFP (P, -1, 0xa43515ae09e6809eL, 0x0d1db48L << 36),
1802: new EFP (P, -1, 0xa27043030c496818L, 0x9b7a04fL << 36),
1803: new EFP (P, -1, 0xa0b0510fb9714fc2L, 0x192dc7aL << 36),
1804: new EFP (P, -1, 0x9ef5326091a111adL, 0xa0911f1L << 36),
1805: new EFP (P, -1, 0x9d3ed9a72cffb750L, 0xde494cfL << 36),
1806: new EFP (P, -1, 0x9b8d39b9d54e5538L, 0xa2a817aL << 36),
1807: new EFP (P, -1, 0x99e0459320b7fa64L, 0xe43086dL << 36),
1808: new EFP (P, -1, 0x9837f0518db8a96fL, 0x46ad232L << 36),
1809: new EFP (P, -1, 0x96942d3720185a00L, 0x48ea9b7L << 36),
1810: new EFP (P, -1, 0x94f4efa8fef70961L, 0x2e8afadL << 36),
1811: new EFP (P, -1, 0x935a2b2f13e6e92bL, 0xd339941L << 36),
1812: new EFP (P, -1, 0x91c3d373ab11c336L, 0x0fd6d8eL << 36),
1813: new EFP (P, -1, 0x9031dc431466b1dcL, 0x775814bL << 36),
1814: new EFP (P, -1, 0x8ea4398b45cd53c0L, 0x2dc0145L << 36),
1815: new EFP (P, -1, 0x8d1adf5b7e5ba9e5L, 0xb4c7b49L << 36),
1816: new EFP (P, -1, 0x8b95c1e3ea8bd6e6L, 0xfbe4628L << 36),
1817: new EFP (P, -1, 0x8a14d575496efd9aL, 0x080ca1eL << 36),
1818: new EFP (P, -1, 0x88980e8092da8527L, 0x5df8d77L << 36),
1819: new EFP (P, -1, 0x871f61969e8d1010L, 0x3a1727cL << 36),
1820: new EFP (P, -1, 0x85aac367cc487b14L, 0xc5c95b9L << 36),
1821: new EFP (P, -1, 0x843a28c3acde4046L, 0x1af92edL << 36),
1822: new EFP (P, -1, 0x82cd8698ac2ba1d7L, 0x3e2a476L << 36),
1823: new EFP (P, -1, 0x8164d1f3bc030773L, 0x7be5652L << 36),
1824: };
1825:
1826:
1827:
1828:
1829: public final EFP EXP2M1_C1 = new EFP (P, -1, 0xb17217f7d1cf79abL, 0xc9e3b3aL << 36);
1830: public final EFP EXP2M1_C2 = new EFP (P, -3, 0xf5fdeffc162c7543L, 0x78b5837L << 36);
1831: public final EFP EXP2M1_C3 = new EFP (P, -5, 0xe35846b82505fc59L, 0x9d3b15eL << 36);
1832: public final EFP EXP2M1_C4 = new EFP (P, -7, 0x9d955b7dd273b94eL, 0x65df05bL << 36);
1833: public final EFP EXP2M1_C5 = new EFP (P, -10, 0xaec3ff3c53398883L, 0x8bfb4d3L << 36);
1834: public final EFP EXP2M1_C6 = new EFP (P, -13, 0xa184897c363c3b7aL, 0x58544c3L << 36);
1835: public final EFP EXP2M1_C7 = new EFP (P, -17, 0xffe5fe2c45863435L, 0x8a8e644L << 36);
1836: public final EFP EXP2M1_C8 = new EFP (P, -20, 0xb160111d2e411fecL, 0x7ff3037L << 36);
1837: public final EFP EXP2M1_C9 = new EFP (P, -24, 0xda929e9caf3e1ed2L, 0x53872d2L << 36);
1838: public final EFP EXP2M1_C10 = new EFP (P, -28, 0xf267a8ac5c764fb7L, 0xed0eca9L << 36);
1839: public final EFP EXP2M1_C11 = new EFP (P, -32, 0xf465639a8dd92607L, 0xabccaf2L << 36);
1840: public final EFP EXP2M1_C12 = new EFP (P, -36, 0xe1deb287e14c2f15L, 0xab43f0cL << 36);
1841: public final EFP EXP2M1_C13 = new EFP (P, -40, 0xc0b0c98b3687cb14L, 0x0d61808L << 36);
1842: public final EFP EXP2M1_C14 = new EFP (P, -44, 0x98a4b26ac3c54b9fL, 0x8a1b12bL << 36);
1843: public final EFP EXP2M1_C15 = new EFP (P, -49, 0xe1b7421d82010f33L, 0xd8abf8dL << 36);
1844: public final EFP EXP2M1_C16 = new EFP (P, -53, 0x9c744d73cfc59c91L, 0xc7f2765L << 36);
1845: public final EFP EXP2M1_C17 = new EFP (P, -58, 0xcc2225a0e12d3eabL, 0x0ec4008L << 36);
1846:
1847:
1848:
1849:
1850:
1851: public final EFP EXPM1_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
1852: public final EFP EXPM1_C2 = new EFP (P, -1, 0x8000000000000000L, 0x0000000L << 36);
1853: public final EFP EXPM1_C3 = new EFP (P, -3, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaabL << 36);
1854: public final EFP EXPM1_C4 = new EFP (P, -5, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaabL << 36);
1855: public final EFP EXPM1_C5 = new EFP (P, -7, 0x8888888888888888L, 0x8888889L << 36);
1856: public final EFP EXPM1_C6 = new EFP (P, -10, 0xb60b60b60b60b60bL, 0x60b60b6L << 36);
1857: public final EFP EXPM1_C7 = new EFP (P, -13, 0xd00d00d00d00d00dL, 0x00d00d0L << 36);
1858: public final EFP EXPM1_C8 = new EFP (P, -16, 0xd00d00d00d00d00dL, 0x00d00d0L << 36);
1859: public final EFP EXPM1_C9 = new EFP (P, -19, 0xb8ef1d2ab6399c7dL, 0x560e447L << 36);
1860: public final EFP EXPM1_C10 = new EFP (P, -22, 0x93f27dbbc4fae397L, 0x780b69fL << 36);
1861: public final EFP EXPM1_C11 = new EFP (P, -26, 0xd7322b3faa271c7fL, 0x3a3f25cL << 36);
1862: public final EFP EXPM1_C12 = new EFP (P, -29, 0x8f76c77fc6c4bdaaL, 0x26d4c3dL << 36);
1863: public final EFP EXPM1_C13 = new EFP (P, -33, 0xb092309d43684be5L, 0x1c198e9L << 36);
1864: public final EFP EXPM1_C14 = new EFP (P, -37, 0xc9cba54603e4e905L, 0xd6f8a2fL << 36);
1865: public final EFP EXPM1_C15 = new EFP (P, -41, 0xd73f9f399dc0f88eL, 0xc32b587L << 36);
1866: public final EFP EXPM1_C16 = new EFP (P, -45, 0xd73f9f399dc0f88eL, 0xc32b587L << 36);
1867: public final EFP EXPM1_C17 = new EFP (P, -49, 0xca963b81856a5359L, 0x3028cbcL << 36);
1868: public final EFP EXPM1_C18 = new EFP (P, -53, 0xb413c31dcbecbbddL, 0x8024435L << 36);
1869:
1870:
1871:
1872:
1873: public static final int[] TWO_PI_ARRAY = {
1874:
1875: 0x00000000, 0x00000000, 0x00000000, 0x517cc1b7, 0x1391054a, 0x3f84eafa, 0x1f534ddc, 0x06db14ac, 0x64f10e41, 0x03fca2c7,
1876: 0x2bdebbc5, 0x30db9237, 0x0e909374, 0x5c00c925, 0x6ea09d19, 0x10e7f0ef, 0x2c72c4a6, 0x4e7dd104, 0x35f52ebb, 0x224274ce,
1877: 0x1c09ad17, 0x6fc82732, 0x1d639835, 0x19cfa4e4, 0x117e2ef7, 0x7250763f, 0x7897ffde, 0x02cc07f7, 0x4bc462d6, 0x414da3ed,
1878: 0x5367ecf2, 0x3e584dba, 0x3d18fd9a, 0x3cbfd45a, 0x7527bac7, 0x75f2f8bd, 0x4f41ce7d, 0x714a525d, 0x26bfb5fb, 0x08fc6ae8,
1879: 0x21580cc1, 0x0df8f6d7, 0x2bf0cfbc, 0x104d7a1b, 0x076a78e4, 0x2c2bdcc3, 0x30865998, 0x2af8a503, 0x210237ff, 0x31009ae6,
1880: 0x27310606, 0x0aab6539, 0x6a325838, 0x4f78118d, 0x347c419c, 0x1b3e6ee7, 0x2024aa0d, 0x3388ed17, 0x161ca6dd, 0x57a268ab,
1881: 0x46414fa9, 0x3fe0e0a7, 0x77e33e83, 0x1616f27c, 0x60c9f6ef, 0x067a4dde, 0x6b1e5ef8, 0x4f9d0f9a, 0x72bc9fc7, 0x30fe2432,
1882: 0x07c7c246, 0x57d376ab, 0x5cb4c10c, 0x762b8c29, 0x359d19c3, 0x616256a0, 0x534b1740, 0x0188cfb0, 0x62d71e39, 0x5634d803,
1883: 0x08cdf34a, 0x692f4f69, 0x555537f6, 0x1f6b8c08, 0x28ff1d93, 0x2553ac95, 0x3d770f87, 0x631abd83, 0x6b9c545d, 0x2c9381b3,
1884: 0x563b3884, 0x53e59192, 0x1de2b588, 0x6a8b5723, 0x7001b0af, 0x0efe70cf, 0x7cc67da8, 0x3cccc2af, 0x1947fbac, 0x6c3fbf5b,
1885: 0x5948a27a, 0x064c17fc, 0x6cdc4ef0, 0x49b366a1, 0x7d775f78, 0x2dbc76b1, 0x129bde28, 0x11697443, 0x0a135638, 0x465958c2,
1886: 0x6e308cb7, 0x6f028600, 0x5e9c77cd, 0x37c03068, 0x132e6212, 0x4180a441, 0x56e3bd5f, 0x7615be5d, 0x11e434a4, 0x469b3886,
1887: 0x6376a909, 0x3f5d9cc2, 0x6aa4280a, 0x5a4ce9f9, 0x29819fdd, 0x6b907854, 0x3883c617, 0x439c52d4, 0x32bef75d, 0x5ec74c5b,
1888: 0x4bbff4ef, 0x40c6b3e0, 0x49917295, 0x26db395a, 0x2a8288d6, 0x0e13be48, 0x48509812, 0x368c2588, 0x59c444c5, 0x6448d926,
1889: 0x7cc5c02b, 0x287a9ca9, 0x12910d5f, 0x6fe5f006, 0x32507bbb, 0x1ce1ea7c, 0x1380f1ec, 0x61f3d994, 0x3e31e501, 0x3267ce38,
1890: 0x1b3092ef, 0x1a285ce0, 0x4a21ec82, 0x573f6a5d, 0x4292472f, 0x193db6aa, 0x432429dc, 0x43fced72, 0x6cb314a1, 0x33cf13ca,
1891: 0x06277fd2, 0x2f29d109, 0x66e29731, 0x4cb5f6c4, 0x0d97d7c3, 0x5fb77693, 0x2486ca46, 0x3a139389, 0x497636e0, 0x2b3e13cb,
1892: 0x3c25318d, 0x1cba7b8e, 0x014c0043, 0x01ad0109, 0x358ee2c9, 0x05523817, 0x1dd0935a, 0x7b4cfbee, 0x72486eef, 0x0b4fd34a,
1893: 0x23bda46d, 0x0a2a7a3e, 0x20acf339, 0x4103f25f, 0x55a18ec9, 0x3e7dba06, 0x5d407f89, 0x4294a92a, 0x70190dc4, 0x1b0da649,
1894: 0x032754c5, 0x5ea38a73, 0x39511704, 0x1216d3ea, 0x2ad56614, 0x4e8393a8, 0x011776ce, 0x7698aedd, 0x217f9877, 0x6b5a4dd1,
1895: 0x1c74a5a6, 0x2d59998c, 0x5414ad6a, 0x714844ec, 0x62141c8b, 0x17d48092, 0x40777703, 0x07993fe0, 0x02a1c7a9, 0x1384cc7b,
1896: 0x606483dd, 0x4bcb9fd1, 0x7f6510e3, 0x10c1bbc8, 0x1319d399, 0x146386ef, 0x1edc5cef, 0x3e10566e, 0x15a0805c, 0x49c02d49,
1897: 0x0444363a, 0x01f5f00d, 0x44bffdb0, 0x7c81c3b0, 0x61645695, 0x457796c3, 0x3989c7bd, 0x20080279, 0x3489dd52, 0x3ed6dd77,
1898: 0x322dbaa1, 0x20517934, 0x25da0d90, 0x66761235, 0x140eaa3a, 0x28e1518e, 0x6bbb6bc4, 0x44cb89b8, 0x26d9c7a2, 0x6cbab604,
1899: 0x0cfc0fdb, 0x60131880, 0x2b99316d, 0x03da1c8a, 0x480316f0, 0x7b18925e, 0x54badc6a, 0x2e527669, 0x5e9cdaa7, 0x4d292556,
1900: 0x6842ddde, 0x318cf7c6, 0x1d94a2da, 0x06fb7f95, 0x3a1ae311, 0x2efd0d70, 0x036bec31, 0x4c9ac96e, 0x05ed3065, 0x14dfab2b,
1901: 0x4ebfd1ee, 0x3f2d5e77, 0x675df932, 0x4184055f, 0x5a319857, 0x16080c45, 0x7a1de4d9, 0x52599ec7, 0x46d5c273, 0x26dd2849,
1902: 0x6a4be13b, 0x291998d5, 0x2bc2a195, 0x1f4b83a4, 0x0f3f0bcd, 0x3c2dbb7c, 0x48c122de, 0x6e42f12a, 0x3a6c6e26, 0x7378075f,
1903: 0x3d612a6e, 0x6fb58974, 0x66aacfcf, 0x3b0e8168, 0x4b7c6c70, 0x33318ef5, 0x5c3da488, 0x3502efbf, 0x520318bf, 0x615935d9,
1904: 0x5dbc5c3f, 0x36ef680f, 0x71e42db6, 0x654744b4, 0x39aaf009, 0x1a9d6822, 0x5edad0b4, 0x52fd0097, 0x2707da0e, 0x553b50ac,
1905: 0x5eca8485, 0x45b6fb9f, 0x5e5fafed, 0x5c4fedf4, 0x25b1db93, 0x79520ce1, 0x003e156e, 0x42ffc3fe, 0x41cf8a0c, 0x6cec30c3,
1906: 0x02aeabd4, 0x6d7f3d9b, 0x39b63ce5, 0x4f2ab77e, 0x3148d784, 0x0b6f9821, 0x4b71cd58, 0x24b9ce19, 0x1b8cb30f, 0x6b65fd10,
1907: 0x029391b0, 0x0b41bab4, 0x476f21d2, 0x0931422e, 0x2e52585c, 0x1c0acd60, 0x15299375, 0x2a85bea8, 0x7b13c4cd, 0x3edc27c8,
1908: 0x305da92e, 0x42e1d90e, 0x4d8ca869, 0x16e11a96, 0x1ea21f71, 0x37234c7b, 0x5ffc9e00, 0x06185a81, 0x0da0cd4f, 0x4cd29069,
1909: 0x68acc297, 0x25e85f36, 0x4cbda11d, 0x05f3ee0e, 0x6e6ef45e, 0x57034594, 0x5c6a0817, 0x2a972a80, 0x09fc051f, 0x70c0fc2c,
1910: 0x40b148d4, 0x0cb6f5f4, 0x1cabf76a, 0x6c4ad669, 0x097bfef3, 0x02cf5fdc, 0x53da9a2a, 0x05494b58, 0x44fbcf82, 0x6cc2d6bc,
1911: 0x571fd235, 0x1a1b4c74, 0x205f57a4, 0x589f8a4a, 0x4e200048, 0x1990dbae, 0x1b6dec9f, 0x2b05f88b, 0x1535ac1c, 0x03596119,
1912: 0x50c0b248, 0x2aa8877d, 0x47b0dca5, 0x2760d466, 0x540c07bd, 0x6036622f, 0x03e8a53b, 0x1195ac83, 0x73e8de64, 0x3e6c324d,
1913: 0x4c6fb670, 0x72f49a8b, 0x077c5e36, 0x489ed781, 0x70eae918, 0x308cbeea, 0x55f5bdd2, 0x6349372e, 0x4bab3b51, 0x01c847c3,
1914: 0x487c461e, 0x4fe94f9e, 0x5b9f29f0, 0x446b22df, 0x45e0088d, 0x6bfff135, 0x1bb1bf6c, 0x1821126e, 0x45d7cb2a, 0x6b5ceb76,
1915: 0x35edc8f9, 0x54238d53, 0x4ff7df73, 0x14dd64da, 0x54402dc3, 0x365c4497, 0x274607de, 0x2c56c3a1, 0x30543430, 0x310328cc,
1916: 0x7e162901, 0x3b3d4fdf, 0x3f7f7bd1, 0x2ac6cfdb, 0x113d9ecb, 0x4dd45fe4, 0x5f109ea0, 0x6386dde2, 0x36c59456, 0x546c5ad4,
1917: 0x2d03b333, 0x65b12246, 0x4576f895, 0x31671e74, 0x66e4835a, 0x54bcd738, 0x2a3ecc5f, 0x08a505fe, 0x7efd385b, 0x2771c590,
1918: 0x6e284d4e, 0x4d4da7e6, 0x47bbbf24, 0x6a5cc272, 0x2f442138, 0x646c8d85, 0x3f205a92, 0x5f7b0385, 0x784b4538, 0x64ca7661,
1919: 0x09537154, 0x55ad8d81, 0x16190bb8, 0x380d324a, 0x5a581689, 0x5dca47e1, 0x7117f11b, 0x2fa7ae5f, 0x70b6f0d3, 0x5d786998,
1920: 0x5de8605e, 0x6ecdc733, 0x7bcce4ae, 0x02f9336b, 0x061bc57e, 0x0e341a88, 0x40fb6121, 0x63bbba38, 0x2da118af, 0x231610eb,
1921: 0x7cd6661e, 0x5b380a93, 0x6fa864ff, 0x6032b573, 0x6794d88a, 0x12455a71, 0x5c9367aa, 0x742a9c13, 0x20a6f9f2, 0x5481aa36,
1922: 0x133990ed, 0x3d4a402b, 0x27c2c996, 0x4f10ff2e, 0x4c8836d1, 0x7cd9c910, 0x52a09ec8, 0x39f31b93, 0x7405547d, 0x61d3a70a,
1923: 0x0bad9f7e, 0x3bfcbfa8, 0x5ea4677b, 0x3d565d51, 0x3d9548e2, 0x056ab748, 0x1086e598, 0x31510c1a, 0x1ce79b8e, 0x13a93dca,
1924: 0x40fb49e9, 0x2b7fe507, 0x47229671, 0x257f5298, 0x5c1d3cfc, 0x287d72d6, 0x6e1b151d, 0x44870a77, 0x06219479, 0x1643b088,
1925: 0x1ed30a86, 0x45900257, 0x74390268, 0x4449e3c7, 0x1312a1ef, 0x37cb8475, 0x44eaf426, 0x4533fbdf, 0x64834ae8, 0x6cb63267,
1926: 0x50b7cbdd, 0x628d231e, 0x749f7785, 0x52332935, 0x1529a828, 0x67345a76, 0x424827d1, 0x195309cc, 0x38270237, 0x63f195c8,
1927: 0x3e3bd69f, 0x4eac2811, 0x71212a9d, 0x5aa6bf37, 0x5446696a, 0x7f36badb, 0x78261dd9, 0x3011b0b4, 0x7ceb1286, 0x4506dbda,
1928: 0x727a8d39, 0x54dc412e, 0x0c9ad6c9, 0x68dda680, 0x07700d25, 0x2fa7e26a, 0x640601c7, 0x41c27f13, 0x3295f364, 0x5478d753,
1929: 0x52ce3f13, 0x1d565768, 0x7270babc, 0x1d39a5d3, 0x014b74d3, 0x70ac75d6, 0x7e8a31bb, 0x1b2c4adb, 0x51fdea65, 0x18755a72,
1930: 0x2251e7f3, 0x76c4ba75, 0x6ea53f62, 0x5c03ccc3, 0x34393d8e, 0x5291d519, 0x41a3858c, 0x76a77631, 0x01d3a9d4, 0x009e8660,
1931: 0x6f97e18b, 0x4e77e51e, 0x39b5bf0b, 0x611a913a, 0x1fa891f0, 0x1aa5a3e3, 0x1add3909, 0x26fc988e, 0x42d0ac95, 0x12db65c4,
1932: 0x64b25ef1, 0x1a9de352, 0x0692b42a, 0x5925cc9d, 0x08657309, 0x0cc167d9, 0x446c6821, 0x65177b9d, 0x6160e142, 0x75b20ee8,
1933: 0x2ee8f956, 0x3a8b2f71, 0x42a4483f, 0x1995d7c2, 0x219cb234, 0x365f5360, 0x50f3ddf9, 0x7ab9edb0, 0x6d3f88cf, 0x4d8834dd,
1934: 0x6a318775, 0x5135e2f2, 0x733a9c22, 0x29b8afc4, 0x0196f1e8, 0x1cdf2428, 0x574b4bd3, 0x52aabb2d, 0x6c2e7d75, 0x2b182706,
1935: 0x00b83bf1, 0x014177f3, 0x337125a7, 0x1116fdfb, 0x067620e3, 0x038cc33c, 0x6b20d55b, 0x5a89bbcf, 0x2026be45, 0x121ae7bc,
1936: 0x0b0da5ce, 0x3fac560c, 0x4d1c9199, 0x6f434273, 0x626bc455, 0x2f3ac2e5, 0x55c47451, 0x10d32290, 0x0d6056ad, 0x55eb17b2,
1937: 0x25bb8308, 0x25fe6bad, 0x588a6768, 0x24ab28f5, 0x2e782937, 0x3dfcae20, 0x10836a39, 0x7c7518cf, 0x0e077ab2, 0x1639592d,
1938: 0x337f21ed, 0x282f4cc2, 0x1d0e7f15, 0x5806636e, 0x3b8bf886, 0x72b546e1, 0x50d88c39, 0x7279faad, 0x28f2d733, 0x0028d781,
1939: 0x06827f2d, 0x682b43aa, 0x6b236ff7, 0x1297a5e3, 0x6e29645f, 0x758b2b8a, 0x5de212c3, 0x458994b2, 0x73fd40d9, 0x44c5f4f6,
1940: 0x16f4d9a6, 0x1567f3f8, 0x1d00f535, 0x408dfb22, 0x631b1bfc, 0x5da282de, 0x5f203386, 0x28d7ac86, 0x4fd91cdf, 0x22a1af9a,
1941: 0x14f8ad6a, 0x5935d902, 0x31485f9d, 0x15fdd6dc, 0x79dbd6e6, 0x5e2b9f94, 0x318214b5, 0x36f4ff26, 0x543f0d7d, 0x35dab45a,
1942: 0x0c1c9605, 0x38c975b7, 0x2476481f, 0x22895d47, 0x46343566, 0x136ada18, 0x58788dfc, 0x344413df, 0x7958e234, 0x49bcc1af,
1943: 0x52992f70, 0x05857c27, 0x3e80a00b, 0x395188ae, 0x17c786f4, 0x21b69a70, 0x69e85969, 0x3b595648, 0x7e289b08, 0x60e1e008,
1944: 0x1412fc9f, 0x52fb951c, 0x271a1e38, 0x554eca19, 0x7e155927, 0x249a71c0, 0x2a4bdd54, 0x67e14c7b, 0x34399971, 0x715baad4,
1945: 0x629f0023, 0x63358a9a, 0x22ea0b4f, 0x2f9f0306, 0x2127ff49, 0x535ca59c, 0x7a5fdde9, 0x67037d85, 0x3a294333, 0x5d53a7c6,
1946: 0x766ddb83, 0x27a86d04, 0x4211be21, 0x15c7aa13, 0x1a032eae, 0x16fe5a05, 0x3ee6ccf8, 0x503ba362, 0x6bad8c0a, 0x7ecb5cbd,
1947: 0x54b72670, 0x4efeb2a3, 0x5521ccd6, 0x5b24b5ac, 0x1158acee, 0x5e5434b8, 0x47ca2cfa, 0x4dc9ebdb, 0x6e2520f4, 0x712d6079,
1948: 0x479cb1d0, 0x412ec476, 0x6df4e0ce, 0x218dccdd, 0x112dc112, 0x01a06f3c, 0x0a83fb99, 0x4cf103b8, 0x0ae80abf, 0x669460db,
1949: 0x6b378631, 0x1f046ecc, 0x6b9959db, 0x21603fd5, 0x2f580e29, 0x2ae0ad5d, 0x6bf5b0bd, 0x4af4a5f0, 0x02e7ace9, 0x43c47e49,
1950: 0x2d62c9ac, 0x278d6bae, 0x104be4ed, 0x5c16985d, 0x546c0ed2, 0x72af0b2a, 0x61e1a03e, 0x7eced683, 0x6698ec3a, 0x7142ea4b,
1951: 0x5f24a858, 0x6e9c3272, 0x06f911c9, 0x0d5513a3, 0x1fc36964, 0x67ed3ad4, 0x2578ec29, 0x7cfd545a, 0x2b766f3e, 0x76b83a17,
1952: 0x688dd533, 0x7f6f1b7b, 0x7bd82cc2, 0x16398030, 0x29ebb591, 0x28bd8e64, 0x5adfbbc3, 0x1bc4cf94, 0x73d1a019, 0x21dc51ba,
1953: 0x258a3a9a, 0x46e4c4c5, 0x6928185e, 0x530afef7, 0x2d875f8b, 0x1f4f5d6f, 0x148d28b4, 0x463d8e26, 0x00bc57e7, 0x30a17145,
1954: 0x5b016cdd, 0x2b1c719f, 0x52ced170, 0x525ea256, 0x04b90d6f, 0x6c1ccaef, 0x2b714760, 0x4c558061, 0x1a2a9160, 0x12d57856,
1955: 0x4f909d7d, 0x32160cfc, 0x774b63e8, 0x5580957f, 0x3f205106, 0x6cf7f633, 0x76d4d795, 0x2bffd269, 0x6c2ca700, 0x4c9bac8e,
1956: 0x34a1ad86, 0x19f38439, 0x16f7e283, 0x77df8d0a, 0x251e13b6, 0x32e8b8c3, 0x46a1068a, 0x1e9c5c29, 0x5b2fa425, 0x02e01623,
1957: 0x51ce180d, 0x66090a25, 0x5df2cab5, 0x552ac91c, 0x2e89ef09, 0x0c000db6, 0x6951b1e0, 0x789a0cbc, 0x6ae6f080, 0x197c594d,
1958: 0x10fa6934, 0x798f992f, 0x4bfbe442, 0x665adf98, 0x0215d378, 0x367fd774, 0x574985bf, 0x447087e5, 0x4828acdf, 0x26924cf7,
1959: 0x0f3ac27c, 0x0df67285, 0x60d6c4e2, 0x260b1d34, 0x22381ff4, 0x019645ba, 0x531bc9b6, 0x1e29e4a7, 0x2cb63fe8, 0x3c34ff74,
1960: 0x45e57b7c, 0x131273c5, 0x24ab0a65, 0x4683a26a, 0x2f7d5a42, 0x0c8e8918, 0x68b0e425, 0x2ede222c, 0x1fffc690, 0x1951ff6c,
1961: 0x390fa5f7, 0x72db49bf, 0x1a472a23, 0x3edb35f5, 0x2c822c06, 0x7b751e95, 0x20b4c1e8, 0x7201c30a, 0x1a568076, 0x3a3229c0,
1962: 0x0e8de742, 0x11c7a6ac, 0x0108583f, 0x61b495f1, 0x20f7527e, 0x2f65cc0e, 0x412fb7e9, 0x0f43e808, 0x5dc68477, 0x7a9463f7,
1963: 0x5fc162d6, 0x6949775c, 0x0a355126, 0x3f132edb, 0x7166ef0a, 0x4d1d3a6f, 0x61ad61d1, 0x4fdab592, 0x71a3b69c, 0x35df937d,
1964: 0x137af459, 0x4a907aed, 0x3ac1d542, 0x18e3e8d7, 0x5e8fac78, 0x14a4ae49, 0x6aabefb6, 0x77e37c4c, 0x3e4f0dde, 0x7ed7dccf,
1965: 0x3bac1d8a, 0x758937b9, 0x773b8d06, 0x44928857, 0x36123085, 0x6cfe74b3, 0x542cde0f, 0x75489536, 0x0bed8292, 0x2413fd2b,
1966: 0x5a2b596b, 0x5802b312, 0x1466722c, 0x5fd5e188, 0x2cfc3e6c, 0x457efa07, 0x7ca7008b, 0x30042951, 0x4d63ead1, 0x1dd4a4df,
1967: 0x3fb0dc1e, 0x49a31414, 0x4325445a, 0x5d3b0f83, 0x33285b53, 0x22a6d56b, 0x60ce333d, 0x261489f9, 0x206fdd19, 0x0473cf16,
1968: 0x12aff801, 0x3afc227c, 0x60cb396d, 0x71adb49d, 0x24f0aed6, 0x60dec1f8, 0x74bbf1d8, 0x6317b251, 0x7ddc3bf1, 0x39715e5c,
1969: 0x5dd12bf8, 0x0b70339b, 0x1751f725, 0x25cf2702, 0x66ad9d94, 0x5c36fbf7, 0x2cd904e7, 0x1705954c, 0x6522c5ae, 0x34701d5f,
1970: 0x1d1f3539, 0x4e5ac6f3, 0x58b21a8d, 0x5604296f, 0x59f20834, 0x71553e1c, 0x645dcd7a, 0x75f00a6f, 0x2dd36c8a, 0x2b16683e,
1971: 0x5217a178, 0x14afab5a, 0x78298160, 0x1561f22d, 0x44c17ce8, 0x7de4db61, 0x50910214, 0x513bc866, 0x478f0860, 0x5bea3878,
1972: 0x2001c11d, 0x1c94c363, 0x4f10f050, 0x4c8e924f, 0x4e6ce03d, 0x5d1db956, 0x796b4a2b, 0x76bbf110, 0x6f4060ad, 0x209f4870,
1973: 0x020eed54, 0x0003cfb4, 0x01b409a1, 0x1cd56a51, 0x5e1a1f1b, 0x0ad47bed, 0x0cc38b4a, 0x5bd71ce4, 0x76b45f98, 0x2f10a374,
1974: 0x345d3ab0, 0x6d3f6a7c, 0x7d00e32a, 0x5790fb34, 0x6a007a58, 0x2631f0a8, 0x53537781, 0x47e6d0a0, 0x1ef295fa, 0x12cb2e53,
1975: 0x1cc6f20c, 0x1f08d6aa, 0x4e0bd445, 0x0107ab02, 0x7692436d, 0x3c67f4e8, 0x04a2717c, 0x270b82ce, 0x284fedd0, 0x5856f438,
1976: 0x2dd7e754, 0x54aa2e82, 0x009d1952, 0x433b5bf8, 0x79923e89, 0x6e4a9f6e, 0x4173ab12, 0x06c14fa3, 0x1a1800a9, 0x04e69bb2,
1977: 0x56165d57, 0x432db958, 0x7e07141f, 0x15435c6f, 0x52777a77, 0x33496069, 0x3c48a10c, 0x0cd25a95, 0x0a91f166, 0x265bc1be,
1978: 0x67f67d7a, 0x719c9e48, 0x3e44fddd, 0x292e3d83, 0x46297725, 0x55068553, 0x3e829c3a, 0x02de9ef9, 0x2f4cf771, 0x0f7af4b0,
1979: 0x2a4a6256, 0x2c1f745d, 0x1b3c5c63, 0x415065a9, 0x144eec3f, 0x10adfef5, 0x7a8dd087, 0x5ba28ec9, 0x1e715b24, 0x2e781501,
1980: 0x196aafdb, 0x6ddc0ff5, 0x6a7db0b8, 0x2922c055, 0x1769411c, 0x7434d29c, 0x557218d4, 0x4d8688d7, 0x1fbe0ab7, 0x4e7d4e64,
1981: 0x2d3d2515, 0x7780f9d5, 0x701dfb6b, 0x4d9b6fed, 0x010dfebe, 0x7fecdbf5, 0x4882d11f, 0x276ba7ec, 0x7bb0cd6c, 0x259938b0,
1982: };
1983:
1984:
1985:
1986:
1987: public final EFP LOG_C1 = new EFP (P, 1, 0x8000000000000000L, 0x0000000L << 36);
1988: public final EFP LOG_C3 = new EFP (P, -1, 0xaaaaaaaaaaaaaaaaL, 0xaaaaafaL << 36);
1989: public final EFP LOG_C5 = new EFP (P, -2, 0xccccccccccccccccL, 0xcc9635cL << 36);
1990: public final EFP LOG_C7 = new EFP (P, -2, 0x9249249249249249L, 0xb11c709L << 36);
1991: public final EFP LOG_C9 = new EFP (P, -3, 0xe38e38e38e38e1f4L, 0xa08ab7fL << 36);
1992: public final EFP LOG_C11 = new EFP (P, -3, 0xba2e8ba2e8bba550L, 0x957b4b0L << 36);
1993: public final EFP LOG_C13 = new EFP (P, -3, 0x9d89d89d88f3a6b4L, 0xb83ee9bL << 36);
1994: public final EFP LOG_C15 = new EFP (P, -3, 0x88888888e97610a0L, 0x018bbc5L << 36);
1995: public final EFP LOG_C17 = new EFP (P, -4, 0xf0f0f0b6e98b6c2fL, 0x176ec78L << 36);
1996: public final EFP LOG_C19 = new EFP (P, -4, 0xd79442422528c14bL, 0xdacdc08L << 36);
1997: public final EFP LOG_C21 = new EFP (P, -4, 0xc30a54423d395d6dL, 0xa2f5188L << 36);
1998: public final EFP LOG_C23 = new EFP (P, -4, 0xb247b3a940a7a020L, 0x5cb7483L << 36);
1999: public final EFP LOG_C25 = new EFP (P, -4, 0xa07d6fb3e1085165L, 0x68590abL << 36);
2000: public final EFP LOG_C27 = new EFP (P, -4, 0xb976c8a2f3029b2dL, 0xa0b471bL << 36);
2001:
2002:
2003:
2004:
2005:
2006: public final EFP LOG10_C1 = new EFP (P, -1, 0xde5bd8a937287195L, 0x355baabL << 36);
2007: public final EFP LOG10_C3 = new EFP (P, -2, 0x943d3b1b7a1af663L, 0x78e7cb7L << 36);
2008: public final EFP LOG10_C5 = new EFP (P, -3, 0xb1e313ba9286c144L, 0x2a80513L << 36);
2009: public final EFP LOG10_C7 = new EFP (P, -4, 0xfe1fd30a882e38abL, 0x7a44130L << 36);
2010: public final EFP LOG10_C9 = new EFP (P, -4, 0xc5a6f979f823f1cbL, 0x86cedb8L << 36);
2011: public final EFP LOG10_C11 = new EFP (P, -4, 0xa1b729353f6480daL, 0x7d9f583L << 36);
2012: public final EFP LOG10_C13 = new EFP (P, -4, 0x88d60f2d0d7965b3L, 0x533de4bL << 36);
2013: public final EFP LOG10_C15 = new EFP (P, -5, 0xed2ec4f96bbfdbfdL, 0xfddb370L << 36);
2014: public final EFP LOG10_C17 = new EFP (P, -5, 0xd147624ebd9efe71L, 0xccd7fdfL << 36);
2015: public final EFP LOG10_C19 = new EFP (P, -5, 0xbb3fe99c80f7032eL, 0x107f05cL << 36);
2016: public final EFP LOG10_C21 = new EFP (P, -5, 0xa968eecf07930e0cL, 0xbd58cd0L << 36);
2017: public final EFP LOG10_C23 = new EFP (P, -5, 0x9ada242bfa9153a2L, 0x1833fc8L << 36);
2018: public final EFP LOG10_C25 = new EFP (P, -5, 0x8b665b489db905f7L, 0x74ec677L << 36);
2019: public final EFP LOG10_C27 = new EFP (P, -5, 0xa1178c2d7152670fL, 0x3d41c7cL << 36);
2020:
2021: public final EFP[] ACCURATE_LOG10_BASE = {
2022:
2023: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2024: null,
2025: null,
2026: new EFP (P, 3, 0xa000000000000000L, 0x0000000L << 36),
2027: null,
2028: null,
2029: new EFP (P, 6, 0xc800000000000000L, 0x0000000L << 36),
2030: null,
2031: null,
2032: new EFP (P, 9, 0xfa00000000000000L, 0x0000000L << 36),
2033: null,
2034: null,
2035: null,
2036: new EFP (P, 13, 0x9c40000000000000L, 0x0000000L << 36),
2037: null,
2038: null,
2039: new EFP (P, 16, 0xc350000000000000L, 0x0000000L << 36),
2040: null,
2041: null,
2042: new EFP (P, 19, 0xf424000000000000L, 0x0000000L << 36),
2043: null,
2044: null,
2045: null,
2046: new EFP (P, 23, 0x9896800000000000L, 0x0000000L << 36),
2047: null,
2048: null,
2049: new EFP (P, 26, 0xbebc200000000000L, 0x0000000L << 36),
2050: null,
2051: null,
2052: new EFP (P, 29, 0xee6b280000000000L, 0x0000000L << 36),
2053: null,
2054: null,
2055: null,
2056: new EFP (P, 33, 0x9502f90000000000L, 0x0000000L << 36),
2057: null,
2058: null,
2059: new EFP (P, 36, 0xba43b74000000000L, 0x0000000L << 36),
2060: null,
2061: null,
2062: new EFP (P, 39, 0xe8d4a51000000000L, 0x0000000L << 36),
2063: null,
2064: null,
2065: null,
2066: new EFP (P, 43, 0x9184e72a00000000L, 0x0000000L << 36),
2067: null,
2068: null,
2069: new EFP (P, 46, 0xb5e620f480000000L, 0x0000000L << 36),
2070: null,
2071: null,
2072: new EFP (P, 49, 0xe35fa931a0000000L, 0x0000000L << 36),
2073: null,
2074: null,
2075: null,
2076: new EFP (P, 53, 0x8e1bc9bf04000000L, 0x0000000L << 36),
2077: null,
2078: null,
2079: new EFP (P, 56, 0xb1a2bc2ec5000000L, 0x0000000L << 36),
2080: null,
2081: null,
2082: new EFP (P, 59, 0xde0b6b3a76400000L, 0x0000000L << 36),
2083: null,
2084: null,
2085: null,
2086: new EFP (P, 63, 0x8ac7230489e80000L, 0x0000000L << 36),
2087: null,
2088: null,
2089: new EFP (P, 66, 0xad78ebc5ac620000L, 0x0000000L << 36),
2090: null,
2091: null,
2092: new EFP (P, 69, 0xd8d726b7177a8000L, 0x0000000L << 36),
2093: null,
2094: null,
2095: null,
2096: new EFP (P, 73, 0x878678326eac9000L, 0x0000000L << 36),
2097: null,
2098: null,
2099: new EFP (P, 76, 0xa968163f0a57b400L, 0x0000000L << 36),
2100: null,
2101: null,
2102: new EFP (P, 79, 0xd3c21bcecceda100L, 0x0000000L << 36),
2103: null,
2104: null,
2105: null,
2106: new EFP (P, 83, 0x84595161401484a0L, 0x0000000L << 36),
2107: null,
2108: null,
2109: new EFP (P, 86, 0xa56fa5b99019a5c8L, 0x0000000L << 36),
2110: null,
2111: null,
2112: new EFP (P, 89, 0xcecb8f27f4200f3aL, 0x0000000L << 36),
2113: null,
2114: null,
2115: null,
2116: new EFP (P, 93, 0x813f3978f8940984L, 0x4000000L << 36),
2117: null,
2118: null,
2119: new EFP (P, 96, 0xa18f07d736b90be5L, 0x5000000L << 36),
2120: null,
2121: null,
2122: new EFP (P, 99, 0xc9f2c9cd04674edeL, 0xa400000L << 36),
2123: null,
2124: null,
2125: new EFP (P, 102, 0xfc6f7c4045812296L, 0x4d00000L << 36),
2126: null,
2127: null,
2128: null,
2129: new EFP (P, 106, 0x9dc5ada82b70b59dL, 0xf020000L << 36),
2130: null,
2131: null,
2132: new EFP (P, 109, 0xc5371912364ce305L, 0x6c28000L << 36),
2133: null,
2134: null,
2135: new EFP (P, 112, 0xf684df56c3e01bc6L, 0xc732000L << 36),
2136: null,
2137: null,
2138: null,
2139: new EFP (P, 116, 0x9a130b963a6c115cL, 0x3c7f400L << 36),
2140: null,
2141: null,
2142: new EFP (P, 119, 0xc097ce7bc90715b3L, 0x4b9f100L << 36),
2143: null,
2144: null,
2145: new EFP (P, 122, 0xf0bdc21abb48db20L, 0x1e86d40L << 36),
2146: null,
2147: null,
2148: null,
2149: new EFP (P, 126, 0x96769950b50d88f4L, 0x1314448L << 36),
2150: null,
2151: null,
2152: new EFP (P, 129, 0xbc143fa4e250eb31L, 0x17d955aL << 36),
2153: };
2154:
2155:
2156:
2157:
2158: public final EFP LOG1P_A = new EFP (M, -2, 0x95f619980c4336f7L, 0x4d04ecaL << 36);
2159: public final EFP LOG1P_B = new EFP (P, -2, 0xd413cccfe7799211L, 0x65f626dL << 36);
2160:
2161:
2162:
2163:
2164: public final EFP LOG2_C1 = new EFP (P, 1, 0xb8aa3b295c17f0bbL, 0xbe87fedL << 36);
2165: public final EFP LOG2_C3 = new EFP (P, -1, 0xf6384ee1d01feba4L, 0xfe0ab04L << 36);
2166: public final EFP LOG2_C5 = new EFP (P, -1, 0x93bb62877cdff3c9L, 0x651237dL << 36);
2167: public final EFP LOG2_C7 = new EFP (P, -2, 0xd30bb153d6f6c9fbL, 0xeda6121L << 36);
2168: public final EFP LOG2_C9 = new EFP (P, -2, 0xa42589ebe015469bL, 0xde296e2L << 36);
2169: public final EFP LOG2_C11 = new EFP (P, -2, 0x864d424ca0127799L, 0x7cdb742L << 36);
2170: public final EFP LOG2_C13 = new EFP (P, -3, 0xe347ab469770ad93L, 0x0c89676L << 36);
2171: public final EFP LOG2_C15 = new EFP (P, -3, 0xc4f9d8b532564b9eL, 0x7d50b7aL << 36);
2172: public final EFP LOG2_C17 = new EFP (P, -3, 0xadcd64b1c6112030L, 0x2abb956L << 36);
2173: public final EFP LOG2_C19 = new EFP (P, -3, 0x9b81e9e58a334402L, 0x0adf93dL << 36);
2174: public final EFP LOG2_C21 = new EFP (P, -3, 0x8cb11e7e743a9994L, 0xf74da62L << 36);
2175: public final EFP LOG2_C23 = new EFP (P, -3, 0x809a15f248e3a311L, 0x83d14aaL << 36);
2176: public final EFP LOG2_C25 = new EFP (P, -4, 0xe789c1589b85b20fL, 0xbe84fc9L << 36);
2177: public final EFP LOG2_C27 = new EFP (P, -3, 0x85c8b3f2b1daf78cL, 0x52db8eeL << 36);
2178:
2179:
2180:
2181:
2182:
2183: public final EFP LGAMMA_C1 = new EFP (P, -4, 0xaaaaaaaaaaaaaaaaL, 0xaaaaaabL << 36);
2184: public final EFP LGAMMA_C2 = new EFP (M, -9, 0xb60b60b60b60b60bL, 0x60b60b6L << 36);
2185: public final EFP LGAMMA_C3 = new EFP (P, -11, 0xd00d00d00d00d00dL, 0x00d00d0L << 36);
2186: public final EFP LGAMMA_C4 = new EFP (M, -11, 0x9c09c09c09c09c09L, 0xc09c09cL << 36);
2187: public final EFP LGAMMA_C5 = new EFP (P, -11, 0xdca8f158c7f91ab8L, 0x7539c03L << 36);
2188: public final EFP LGAMMA_C6 = new EFP (M, -10, 0xfb5586ccc9e3e40fL, 0xb5586cdL << 36);
2189: public final EFP LGAMMA_C7 = new EFP (P, -8, 0xd20d20d20d20d20dL, 0x20d20d2L << 36);
2190: public final EFP LGAMMA_C8 = new EFP (M, -6, 0xf21436587a9cbee1L, 0x0325477L << 36);
2191: public final EFP LGAMMA_C9 = new EFP (P, -3, 0xb7f4b1c0f033ffd0L, 0xc3b7f4bL << 36);
2192: public final EFP LGAMMA_C10 = new EFP (M, 0, 0xb23b3808c0f9cf6dL, 0xedce731L << 36);
2193: public final EFP LGAMMA_C11 = new EFP (P, 3, 0xd672219167002d3aL, 0x7a9c886L << 36);
2194: public final EFP LGAMMA_C12 = new EFP (M, 7, 0x9cd9292e6660d55bL, 0x3f712ecL << 36);
2195: public final EFP LGAMMA_C13 = new EFP (P, 11, 0x8911a740da740da7L, 0x40da741L << 36);
2196: public final EFP LGAMMA_C14 = new EFP (M, 15, 0x8d0cc570e255bf59L, 0xff6eec2L << 36);
2197:
2198:
2199: public final EFP LOGTWOPI_2 = new EFP (P, -1, 0xeb3f8e4325f5a534L, 0x94bc900L << 36);
2200:
2201:
2202:
2203: public final EFP[] ROUNDED_APERY = {
2204:
2205: new EFP (P, 0, 0x99dd0027803109c1L, 0xb8b8ae3L << 36),
2206: new EFP (P, 0, 0x99dd0027803109c1L, 0xb8b8ae2L << 36),
2207: new EFP (P, 0, 0x99dd0027803109c1L, 0xb8b8ae2L << 36),
2208: new EFP (P, 0, 0x99dd0027803109c1L, 0xb8b8ae3L << 36),
2209: };
2210:
2211:
2212:
2213: public final EFP[] ROUNDED_CATALAN = {
2214:
2215: new EFP (P, -1, 0xea7cb89f409ae845L, 0x215822eL << 36),
2216: new EFP (P, -1, 0xea7cb89f409ae845L, 0x215822eL << 36),
2217: new EFP (P, -1, 0xea7cb89f409ae845L, 0x215822eL << 36),
2218: new EFP (P, -1, 0xea7cb89f409ae845L, 0x215822fL << 36),
2219: };
2220:
2221:
2222:
2223: public final EFP[] ROUNDED_EULER = {
2224:
2225: new EFP (P, -1, 0x93c467e37db0c7a4L, 0xd1be3f8L << 36),
2226: new EFP (P, -1, 0x93c467e37db0c7a4L, 0xd1be3f8L << 36),
2227: new EFP (P, -1, 0x93c467e37db0c7a4L, 0xd1be3f8L << 36),
2228: new EFP (P, -1, 0x93c467e37db0c7a4L, 0xd1be3f9L << 36),
2229: };
2230:
2231:
2232:
2233: public final EFP[] ROUNDED_NAPIER = {
2234:
2235: new EFP (P, 1, 0xadf85458a2bb4a9aL, 0xafdc562L << 36),
2236: new EFP (P, 1, 0xadf85458a2bb4a9aL, 0xafdc562L << 36),
2237: new EFP (P, 1, 0xadf85458a2bb4a9aL, 0xafdc562L << 36),
2238: new EFP (P, 1, 0xadf85458a2bb4a9aL, 0xafdc563L << 36),
2239: };
2240:
2241:
2242:
2243: public final EFP[] ROUNDED_PI = {
2244:
2245: new EFP (P, 1, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2246: new EFP (P, 1, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2247: new EFP (P, 1, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2248: new EFP (P, 1, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2249: };
2250: public final EFP[] ROUNDED_NEGPI = {
2251:
2252: new EFP (M, 1, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2253: new EFP (M, 1, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2254: new EFP (M, 1, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2255: new EFP (M, 1, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2256: };
2257: public final EFP[] ROUNDED_PI_2 = {
2258:
2259: new EFP (P, 0, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2260: new EFP (P, 0, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2261: new EFP (P, 0, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2262: new EFP (P, 0, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2263: };
2264: public final EFP[] ROUNDED_NEGPI_2 = {
2265:
2266: new EFP (M, 0, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2267: new EFP (M, 0, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2268: new EFP (M, 0, 0xc90fdaa22168c234L, 0xc4c6629L << 36),
2269: new EFP (M, 0, 0xc90fdaa22168c234L, 0xc4c6628L << 36),
2270: };
2271:
2272:
2273:
2274:
2275: public final EFP SINH_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
2276: public final EFP SINH_C3 = new EFP (P, -3, 0xaaaaaaaaaaaaaaaaL, 0xaaa8d3bL << 36);
2277: public final EFP SINH_C5 = new EFP (P, -7, 0x8888888888888888L, 0xd801ef0L << 36);
2278: public final EFP SINH_C7 = new EFP (P, -13, 0xd00d00d00d00b865L, 0xe08a011L << 36);
2279: public final EFP SINH_C9 = new EFP (P, -19, 0xb8ef1d2ab9d6b01dL, 0x54d1cf9L << 36);
2280: public final EFP SINH_C11 = new EFP (P, -26, 0xd7322aa84ab102a5L, 0xf1b3e2aL << 36);
2281: public final EFP SINH_C13 = new EFP (P, -33, 0xb09ecdc339d62e71L, 0x8115862L << 36);
2282:
2283:
2284:
2285:
2286:
2287: public final EFP SQRT1PM1_C1 = new EFP (P, -1, 0x8000000000000000L, 0x0000000L << 36);
2288: public final EFP SQRT1PM1_C2 = new EFP (M, -3, 0x8000000000000000L, 0x0000000L << 36);
2289: public final EFP SQRT1PM1_C3 = new EFP (P, -4, 0x8000000000000000L, 0x0000000L << 36);
2290: public final EFP SQRT1PM1_C4 = new EFP (M, -5, 0xa000000000000000L, 0x0000000L << 36);
2291: public final EFP SQRT1PM1_C5 = new EFP (P, -6, 0xe000000000000000L, 0x0000000L << 36);
2292: public final EFP SQRT1PM1_C6 = new EFP (M, -6, 0xa800000000000000L, 0x0000000L << 36);
2293: public final EFP SQRT1PM1_C7 = new EFP (P, -6, 0x8400000000000000L, 0x0000000L << 36);
2294: public final EFP SQRT1PM1_C8 = new EFP (M, -7, 0xd680000000000000L, 0x0000000L << 36);
2295: public final EFP SQRT1PM1_C9 = new EFP (P, -7, 0xb2c0000000000000L, 0x0000000L << 36);
2296: public final EFP SQRT1PM1_C10 = new EFP (M, -7, 0x97f0000000000000L, 0x0000000L << 36);
2297: public final EFP SQRT1PM1_C11 = new EFP (P, -7, 0x8338000000000000L, 0x0000000L << 36);
2298:
2299:
2300:
2301:
2302:
2303: public final EFP TAN_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
2304: public final EFP TAN_C3 = new EFP (P, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaaa29L << 36);
2305: public final EFP TAN_C5 = new EFP (P, -3, 0x8888888888888888L, 0x88a184aL << 36);
2306: public final EFP TAN_C7 = new EFP (P, -5, 0xdd0dd0dd0dd0dd0dL, 0x88b7614L << 36);
2307: public final EFP TAN_C9 = new EFP (P, -6, 0xb327a4416087cfd4L, 0xf296a40L << 36);
2308: public final EFP TAN_C11 = new EFP (P, -7, 0x91371aaf3611c538L, 0x2426582L << 36);
2309: public final EFP TAN_C13 = new EFP (P, -9, 0xeb69e870ac055209L, 0xe907d72L << 36);
2310: public final EFP TAN_C15 = new EFP (P, -10, 0xbed1b229560565dcL, 0x00f1ae8L << 36);
2311: public final EFP TAN_C17 = new EFP (P, -11, 0x9aac124127c7ff13L, 0xd521318L << 36);
2312: public final EFP TAN_C19 = new EFP (P, -13, 0xfabebb506d37becdL, 0x7712cf3L << 36);
2313: public final EFP TAN_C21 = new EFP (P, -14, 0xcb3f13fd9e491aeeL, 0xb4ecd04L << 36);
2314: public final EFP TAN_C23 = new EFP (P, -15, 0xa4be2f633cfa3709L, 0x2c90e93L << 36);
2315: public final EFP TAN_C25 = new EFP (P, -16, 0x859266daac37850cL, 0xcb7028bL << 36);
2316: public final EFP TAN_C27 = new EFP (P, -18, 0xd7bbef57337218a7L, 0x4e73cafL << 36);
2317: public final EFP TAN_C29 = new EFP (P, -19, 0xb53ca49c91cc2ce0L, 0x289f9c2L << 36);
2318: public final EFP TAN_C31 = new EFP (P, -21, 0xe1a12ebdc4e0aba8L, 0x6c3a02cL << 36);
2319: public final EFP TAN_C33 = new EFP (P, -21, 0xc9eb997dffc9ad78L, 0x01e7a8fL << 36);
2320:
2321:
2322: public final EFP TAN7_C1 = new EFP (P, -1, 0xffffffffffffffffL, 0xfffffffL << 36);
2323: public final EFP TAN7_C3 = new EFP (P, -2, 0xaaaaaaaaaaaaaaaaL, 0xaae677dL << 36);
2324: public final EFP TAN7_C5 = new EFP (P, -3, 0x8888888888888827L, 0x9679788L << 36);
2325: public final EFP TAN7_C7 = new EFP (P, -5, 0xdd0dd0dd0e579281L, 0x2b6ed88L << 36);
2326: public final EFP TAN7_C9 = new EFP (P, -6, 0xb327a413e1bf5c5dL, 0x5ebd854L << 36);
2327: public final EFP TAN7_C11 = new EFP (P, -7, 0x913e7ab6529ea4edL, 0x6ea7f3bL << 36);
2328:
2329: public final EFP[] TAN7_T = {
2330:
2331: new EFP (),
2332: new EFP (P, -6, 0xc91a3123d48f7fddL, 0x894dd4bL << 36),
2333: new EFP (P, -5, 0xc9393c51d88b101aL, 0xda13cefL << 36),
2334: new EFP (P, -4, 0x9711ce67f9c18b0fL, 0x459611fL << 36),
2335: new EFP (P, -4, 0xc9b5dc62d96d130fL, 0xa0a9ed1L << 36),
2336: new EFP (P, -4, 0xfc98c1d46dcf46edL, 0xdf92d54L << 36),
2337: new EFP (P, -3, 0x97e5639d3032012cL, 0xfb5a747L << 36),
2338: new EFP (P, -3, 0xb1ae4c867069ae62L, 0x1454a67L << 36),
2339: new EFP (P, -3, 0xcbafaf02a98ac03dL, 0xeba6ce9L << 36),
2340: new EFP (P, -3, 0xe5f2675a5a679294L, 0xb7c658cL << 36),
2341: new EFP (P, -2, 0x803fd3ac3135715aL, 0x6d6c3c9L << 36),
2342: new EFP (P, -2, 0x8db081e9acbf49cbL, 0xda4f636L << 36),
2343: new EFP (P, -2, 0x9b5041aae31ede28L, 0xfb2e402L << 36),
2344: new EFP (P, -2, 0xa924570b80d8bb7dL, 0x2ec70f1L << 36),
2345: new EFP (P, -2, 0xb7324fbebc324978L, 0xe945dc4L << 36),
2346: new EFP (P, -2, 0xc5800cb59e810e8cL, 0xd859b1fL << 36),
2347: new EFP (P, -2, 0xd413cccfe7799211L, 0x65f626dL << 36),
2348: new EFP (P, -2, 0xe2f438c2f33db07fL, 0xd5fe854L << 36),
2349: new EFP (P, -2, 0xf228706939f3d282L, 0xa45e2bdL << 36),
2350: new EFP (P, -1, 0x80dc0cdad3e7ba17L, 0xf9dd77dL << 36),
2351: new EFP (P, -1, 0x88d5b8c841a75c35L, 0x36865c3L << 36),
2352: new EFP (P, -1, 0x9105af7823c1286bL, 0xb5bee4cL << 36),
2353: new EFP (P, -1, 0x9970c44823ffe5deL, 0x977bc33L << 36),
2354: new EFP (P, -1, 0xa21c36dce72ed4b0L, 0x5750623L << 36),
2355: new EFP (P, -1, 0xab0dc155bfcc82f5L, 0x18a42e5L << 36),
2356: new EFP (P, -1, 0xb44ba8a3a8edb143L, 0x9bc2d44L << 36),
2357: new EFP (P, -1, 0xbddccf694c8674abL, 0x158e376L << 36),
2358: new EFP (P, -1, 0xc7c8cbdfc2f75687L, 0x408e56bL << 36),
2359: new EFP (P, -1, 0xd218015721427e59L, 0x247f018L << 36),
2360: new EFP (P, -1, 0xdcd3be0c60d7916fL, 0xc7e578dL << 36),
2361: new EFP (P, -1, 0xe8065e39c269718dL, 0xcad85e6L << 36),
2362: new EFP (P, -1, 0xf3bb757e48b83322L, 0xbd576feL << 36),
2363: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2364: new EFP (P, 0, 0x86714e8441e4ca93L, 0x0c4cf4eL << 36),
2365: new EFP (P, 0, 0x8d39eaa93c625b28L, 0xd9816cdL << 36),
2366: new EFP (P, 0, 0x946337ed7c784903L, 0x22c9598L << 36),
2367: new EFP (P, 0, 0x9bf7ec6c3b03ef3cL, 0x0d29346L << 36),
2368: new EFP (P, 0, 0xa4044fc5fa1663f0L, 0xd6fd49aL << 36),
2369: new EFP (P, 0, 0xac96888a17d2a96aL, 0x085e3bcL << 36),
2370: new EFP (P, 0, 0xb5befc31328ffd5eL, 0x4284584L << 36),
2371: new EFP (P, 0, 0xbf90c712d3a30a83L, 0x3f4d2a9L << 36),
2372: new EFP (P, 0, 0xca2253a310915399L, 0x7dd7470L << 36),
2373: new EFP (P, 0, 0xd58e1aec53a74f24L, 0x82443ddL << 36),
2374: new EFP (P, 0, 0xe1f39c0435e07a14L, 0x725b359L << 36),
2375: new EFP (P, 0, 0xef789db9e0a0310fL, 0xb3e75c7L << 36),
2376: new EFP (P, 0, 0xfe4ad5d6b67a51b7L, 0x127cf35L << 36),
2377: new EFP (P, 1, 0x87510eb8b7dfb97cL, 0xe6cb464L << 36),
2378: new EFP (P, 1, 0x9061b6353f9c6ed6L, 0xe02bffdL << 36),
2379: new EFP (P, 1, 0x9a827999fcef3242L, 0x2cbec4eL << 36),
2380: new EFP (P, 1, 0xa5e9ec3ff0327cfaL, 0x748ca31L << 36),
2381: new EFP (P, 1, 0xb2de3664128a386bL, 0x2a51effL << 36),
2382: new EFP (P, 1, 0xc1bb136b87edc0d9L, 0xae371daL << 36),
2383: new EFP (P, 1, 0xd2facf483006e648L, 0x5eb2f29L << 36),
2384: new EFP (P, 1, 0xe7442b29893f385dL, 0xfd8e2a3L << 36),
2385: new EFP (P, 1, 0xff80982f66c6df3bL, 0x0194e40L << 36),
2386: new EFP (P, 2, 0x8e80a1f38ab2f611L, 0x8c89790L << 36),
2387: new EFP (P, 2, 0xa0dff712123b8844L, 0x1c1bfb5L << 36),
2388: new EFP (P, 2, 0xb86ba8c8460d85deL, 0x3af4952L << 36),
2389: new EFP (P, 2, 0xd7b9fa6519887651L, 0xc68dc64L << 36),
2390: new EFP (P, 3, 0x81b97d9b5c3f0e2bL, 0x5c8997bL << 36),
2391: new EFP (P, 3, 0xa27362cad7ee626aL, 0x3b5d4f3L << 36),
2392: new EFP (P, 3, 0xd8e81e01e97bf967L, 0xe518f26L << 36),
2393: new EFP (P, 4, 0xa2d7ff6900daa7f2L, 0x48ca591L << 36),
2394: new EFP (P, 5, 0xa2f122af255539e2L, 0x447b82dL << 36),
2395: };
2396:
2397: public final EFP TAN7_X = new EFP (P, -7, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
2398: public final EFP TAN7_Y = new EFP (P, 5, 0xa2f9836e4e441529L, 0xfc2757dL << 36);
2399:
2400: public final EFP TAN7_Z = new EFP (P, -6, 0xc90fdaa22168c234L, 0xc4c6629L << 36);
2401: public final EFP TAN7_ZA = new EFP (M, -99, 0x8fe47c65dadfb63eL, 0xeeb3067L << 36);
2402:
2403: public final EFP TAN8_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
2404: public final EFP TAN8_C3 = new EFP (P, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaaa02L << 36);
2405: public final EFP TAN8_C5 = new EFP (P, -3, 0x8888888888888888L, 0x8911d7aL << 36);
2406: public final EFP TAN8_C7 = new EFP (P, -5, 0xdd0dd0dd0dd0dd07L, 0x61e9558L << 36);
2407: public final EFP TAN8_C9 = new EFP (P, -6, 0xb327a4416087e508L, 0x1c05687L << 36);
2408: public final EFP TAN8_C11 = new EFP (P, -7, 0x91371aaf35e647d2L, 0x9bd741cL << 36);
2409: public final EFP TAN8_C13 = new EFP (P, -9, 0xeb69e8711de22b89L, 0x087ca38L << 36);
2410: public final EFP TAN8_C15 = new EFP (P, -10, 0xbed1b1c7d2310830L, 0x871a5a7L << 36);
2411: public final EFP TAN8_C17 = new EFP (P, -11, 0x9aac48a4e5208639L, 0x1e07899L << 36);
2412: public final EFP TAN8_C19 = new EFP (P, -13, 0xfa98b158590773f4L, 0xfa72a4eL << 36);
2413: public final EFP TAN8_C21 = new EFP (P, -14, 0xd2cd5a371c03b30eL, 0x42cac1cL << 36);
2414:
2415:
2416:
2417:
2418:
2419: public final EFP TANH_C1 = new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36);
2420: public final EFP TANH_C3 = new EFP (M, -2, 0xaaaaaaaaaaaaaaaaL, 0xaaaaa63L << 36);
2421: public final EFP TANH_C5 = new EFP (P, -3, 0x8888888888888888L, 0x88710efL << 36);
2422: public final EFP TANH_C7 = new EFP (M, -5, 0xdd0dd0dd0dd0dd0dL, 0x5eb1c0fL << 36);
2423: public final EFP TANH_C9 = new EFP (P, -6, 0xb327a4416087cefcL, 0x3226807L << 36);
2424: public final EFP TANH_C11 = new EFP (M, -7, 0x91371aaf36115c72L, 0x1057753L << 36);
2425: public final EFP TANH_C13 = new EFP (P, -9, 0xeb69e870ab51ac87L, 0xbc93275L << 36);
2426: public final EFP TANH_C15 = new EFP (M, -10, 0xbed1b2291c9448e3L, 0x025162cL << 36);
2427: public final EFP TANH_C17 = new EFP (P, -11, 0x9aac122e2d563679L, 0x7f53bd9L << 36);
2428: public final EFP TANH_C19 = new EFP (M, -13, 0xfabeb45554b7f61dL, 0xed9a4e5L << 36);
2429: public final EFP TANH_C21 = new EFP (P, -14, 0xcb3e00a83f1f1703L, 0x594e12fL << 36);
2430: public final EFP TANH_C23 = new EFP (M, -15, 0xa4a40e3c50e76340L, 0x922c2ccL << 36);
2431: public final EFP TANH_C25 = new EFP (P, -16, 0x83c53e40035eb57fL, 0x80a5513L << 36);
2432: public final EFP TANH_C27 = new EFP (M, -18, 0xb47b24ce1d988d76L, 0xa0271b7L << 36);
2433:
2434:
2435:
2436:
2437: public final EFP[] EFP_TEN_P16QR = {
2438:
2439: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2440: new EFP (P, 3, 0xa000000000000000L, 0x0000000L << 36),
2441: new EFP (P, 6, 0xc800000000000000L, 0x0000000L << 36),
2442: new EFP (P, 9, 0xfa00000000000000L, 0x0000000L << 36),
2443: new EFP (P, 13, 0x9c40000000000000L, 0x0000000L << 36),
2444: new EFP (P, 16, 0xc350000000000000L, 0x0000000L << 36),
2445: new EFP (P, 19, 0xf424000000000000L, 0x0000000L << 36),
2446: new EFP (P, 23, 0x9896800000000000L, 0x0000000L << 36),
2447: new EFP (P, 26, 0xbebc200000000000L, 0x0000000L << 36),
2448: new EFP (P, 29, 0xee6b280000000000L, 0x0000000L << 36),
2449: new EFP (P, 33, 0x9502f90000000000L, 0x0000000L << 36),
2450: new EFP (P, 36, 0xba43b74000000000L, 0x0000000L << 36),
2451: new EFP (P, 39, 0xe8d4a51000000000L, 0x0000000L << 36),
2452: new EFP (P, 43, 0x9184e72a00000000L, 0x0000000L << 36),
2453: new EFP (P, 46, 0xb5e620f480000000L, 0x0000000L << 36),
2454: new EFP (P, 49, 0xe35fa931a0000000L, 0x0000000L << 36),
2455: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2456: new EFP (P, 53, 0x8e1bc9bf04000000L, 0x0000000L << 36),
2457: new EFP (P, 106, 0x9dc5ada82b70b59dL, 0xf020000L << 36),
2458: new EFP (P, 159, 0xaf298d050e4395d6L, 0x9670b13L << 36),
2459: new EFP (P, 212, 0xc2781f49ffcfa6d5L, 0x3cbf6b7L << 36),
2460: new EFP (P, 265, 0xd7e77a8f87daf7fbL, 0xdc33746L << 36),
2461: new EFP (P, 318, 0xefb3ab16c59b14a2L, 0xc5cfe95L << 36),
2462: new EFP (P, 372, 0x850fadc09923329eL, 0x03e2cf7L << 36),
2463: new EFP (P, 425, 0x93ba47c980e98cdfL, 0xc66f337L << 36),
2464: new EFP (P, 478, 0xa402b9c5a8d3a6e7L, 0x5f16207L << 36),
2465: new EFP (P, 531, 0xb616a12b7fe617aaL, 0x577b987L << 36),
2466: new EFP (P, 584, 0xca28a291859bbf93L, 0x7d7b8f7L << 36),
2467: new EFP (P, 637, 0xe070f78d3927556aL, 0x85bbe25L << 36),
2468: new EFP (P, 690, 0xf92e0c3537826145L, 0xa7709a5L << 36),
2469: new EFP (P, 744, 0x8a5296ffe33cc92fL, 0x82bd6b7L << 36),
2470: new EFP (P, 797, 0x9991a6f3d6bf1765L, 0xacca6daL << 36),
2471: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2472: new EFP (P, 850, 0xaa7eebfb9df9de8dL, 0xddbb902L << 36),
2473: new EFP (P, 1700, 0xe319a0aea60e91c6L, 0xcc655c5L << 36),
2474: new EFP (P, 2551, 0x973f9ca8cd00a68cL, 0x6c8d3fdL << 36),
2475: new EFP (P, 3401, 0xc976758681750c17L, 0x650d3d3L << 36),
2476: new EFP (P, 4252, 0x862c8c0eeb856ecbL, 0x085bccdL << 36),
2477: new EFP (P, 5102, 0xb2b8353b3993a7e4L, 0x4257ac4L << 36),
2478: new EFP (P, 5952, 0xee0ddd84924ab88cL, 0x2d4070fL << 36),
2479: new EFP (P, 6803, 0x9e8b3b5dc53d5de4L, 0xa74d28dL << 36),
2480: new EFP (P, 7653, 0xd32e203241f4806fL, 0x3f50c80L << 36),
2481: new EFP (P, 8504, 0x8ca554c020a1f0a6L, 0x5dfed0aL << 36),
2482: new EFP (P, 9354, 0xbb570a9a9bd977ccL, 0x4c80875L << 36),
2483: new EFP (P, 10204, 0xf9895d25d88b5a8aL, 0xfdd08c5L << 36),
2484: new EFP (P, 11055, 0xa630ef7d5699fe45L, 0x50e3660L << 36),
2485: new EFP (P, 11905, 0xdd5dc8a2bf27f3f7L, 0x95aa119L << 36),
2486: new EFP (P, 12756, 0x936e07737dc64f6dL, 0x8c474bbL << 36),
2487: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2488: new EFP (P, 13606, 0xc46052028a20979aL, 0xc94c154L << 36),
2489: new EFP (P, 27213, 0x96a3a1d17faf211aL, 0x0c7c289L << 36),
2490: };
2491: public final EFP[] EFP_TEN_M16QR = {
2492:
2493: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2494: new EFP (P, -4, 0xccccccccccccccccL, 0xccccccdL << 36),
2495: new EFP (P, -7, 0xa3d70a3d70a3d70aL, 0x3d70a3dL << 36),
2496: new EFP (P, -10, 0x83126e978d4fdf3bL, 0x645a1cbL << 36),
2497: new EFP (P, -14, 0xd1b71758e219652bL, 0xd3c3611L << 36),
2498: new EFP (P, -17, 0xa7c5ac471b478423L, 0x0fcf80eL << 36),
2499: new EFP (P, -20, 0x8637bd05af6c69b5L, 0xa63f9a5L << 36),
2500: new EFP (P, -24, 0xd6bf94d5e57a42bcL, 0x3d32907L << 36),
2501: new EFP (P, -27, 0xabcc77118461cefcL, 0xfdc20d3L << 36),
2502: new EFP (P, -30, 0x89705f4136b4a597L, 0x31680a9L << 36),
2503: new EFP (P, -34, 0xdbe6fecebdedd5beL, 0xb573441L << 36),
2504: new EFP (P, -37, 0xafebff0bcb24aafeL, 0xf78f69aL << 36),
2505: new EFP (P, -40, 0x8cbccc096f5088cbL, 0xf93f87bL << 36),
2506: new EFP (P, -44, 0xe12e13424bb40e13L, 0x2865a5fL << 36),
2507: new EFP (P, -47, 0xb424dc35095cd80fL, 0x538484cL << 36),
2508: new EFP (P, -50, 0x901d7cf73ab0acd9L, 0x0f9d370L << 36),
2509: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2510: new EFP (P, -54, 0xe69594bec44de15bL, 0x4c2ebe7L << 36),
2511: new EFP (P, -107, 0xcfb11ead453994baL, 0x67de18fL << 36),
2512: new EFP (P, -160, 0xbb127c53b17ec159L, 0x5560c02L << 36),
2513: new EFP (P, -213, 0xa87fea27a539e9a5L, 0x3f2398dL << 36),
2514: new EFP (P, -266, 0x97c560ba6b0919a5L, 0xdccd87aL << 36),
2515: new EFP (P, -319, 0x88b402f7fd75539bL, 0x11dbcb0L << 36),
2516: new EFP (P, -373, 0xf64335bcf065d37dL, 0x4d4617bL << 36),
2517: new EFP (P, -426, 0xddd0467c64bce4a0L, 0xac7cb3fL << 36),
2518: new EFP (P, -479, 0xc7caba6e7c5382c8L, 0xfe64a53L << 36),
2519: new EFP (P, -532, 0xb3f4e093db73a093L, 0x59ed216L << 36),
2520: new EFP (P, -585, 0xa21727db38cb002fL, 0xb8ada01L << 36),
2521: new EFP (P, -638, 0x91ff83775423cc06L, 0x7b6306aL << 36),
2522: new EFP (P, -691, 0x8380dea93da4bc60L, 0x4247cbaL << 36),
2523: new EFP (P, -745, 0xece53cec4a314ebdL, 0xa4f8bf5L << 36),
2524: new EFP (P, -798, 0xd5605fcdcf32e1d6L, 0xfb1e4aaL << 36),
2525: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2526: new EFP (P, -851, 0xc0314325637a1939L, 0xfa91115L << 36),
2527: new EFP (P, -1701, 0x9049ee32db23d21cL, 0x7132d33L << 36),
2528: new EFP (P, -2552, 0xd8a66d4a505de96bL, 0x5ae1b26L << 36),
2529: new EFP (P, -3402, 0xa2a682a5da57c0bdL, 0x87a6016L << 36),
2530: new EFP (P, -4253, 0xf4385d0975edbabeL, 0x1f4bf66L << 36),
2531: new EFP (P, -5103, 0xb759449f52a711b2L, 0x68e1eb7L << 36),
2532: new EFP (P, -5953, 0x89a63ba4c497b50eL, 0x6c83ad1L << 36),
2533: new EFP (P, -6804, 0xceae534f34362de4L, 0x492512dL << 36),
2534: new EFP (P, -7654, 0x9b2a840f28a1638fL, 0xe393a9cL << 36),
2535: new EFP (P, -8505, 0xe8fb7dc2dec0a404L, 0x598eec8L << 36),
2536: new EFP (P, -9355, 0xaee973911228abcaL, 0xe3187c3L << 36),
2537: new EFP (P, -10205, 0x8350bf3c91575a87L, 0xe79e237L << 36),
2538: new EFP (P, -11056, 0xc52ba8a6aeb15d92L, 0x9e98cbaL << 36),
2539: new EFP (P, -11906, 0x9406af8f83fd6265L, 0x4b4de35L << 36),
2540: new EFP (P, -12757, 0xde42ff8d37cad87fL, 0x1463ef5L << 36),
2541: new EFP (P, 0, 0x8000000000000000L, 0x0000000L << 36),
2542: new EFP (P, -13607, 0xa6dd04c8d2ce9fdeL, 0x2de3812L << 36),
2543: new EFP (P, -27214, 0xd986c20b686da869L, 0x5d1d4feL << 36),
2544: };
2545:
2546: public final EFP TENTO28 = new EFP (P, 93, 0x813f3978f8940984L, 0x4000000L << 36);
2547:
2548:
2549:
2550:
2551:
2552:
2553:
2554:
2555:
2556:
2557:
2558:
2559:
2560:
2561:
2562:
2563:
2564:
2565:
2566:
2567:
2568:
2569:
2570:
2571:
2572:
2573:
2574:
2575:
2576:
2577:
2578:
2579:
2580:
2581:
2582:
2583:
2584:
2585:
2586:
2587:
2588:
2589:
2590:
2591:
2592:
2593:
2594:
2595:
2596:
2597:
2598:
2599:
2600:
2601:
2602:
2603:
2604:
2605:
2606:
2607:
2608:
2609:
2610:
2611:
2612:
2613:
2614:
2615:
2616:
2617:
2618:
2619:
2620:
2621:
2622:
2623:
2624:
2625:
2626:
2627:
2628:
2629:
2630:
2631:
2632:
2633:
2634:
2635:
2636:
2637:
2638:
2639:
2640:
2641:
2642:
2643:
2644:
2645:
2646:
2647:
2648:
2649:
2650:
2651:
2652:
2653:
2654:
2655:
2656:
2657:
2658:
2659:
2660:
2661:
2662:
2663:
2664:
2665:
2666:
2667:
2668:
2669:
2670:
2671:
2672:
2673:
2674:
2675:
2676:
2677:
2678:
2679:
2680:
2681:
2682:
2683:
2684:
2685:
2686:
2687:
2688:
2689:
2690:
2691:
2692:
2693:
2694:
2695:
2696:
2697:
2698:
2699:
2700:
2701:
2702:
2703:
2704:
2705:
2706:
2707:
2708:
2709:
2710:
2711:
2712:
2713:
2714:
2715:
2716:
2717:
2718:
2719:
2720:
2721:
2722:
2723:
2724:
2725:
2726:
2727:
2728:
2729:
2730:
2731:
2732:
2733:
2734:
2735:
2736:
2737:
2738:
2739:
2740:
2741:
2742:
2743:
2744:
2745:
2746:
2747:
2748:
2749:
2750:
2751:
2752:
2753:
2754:
2755:
2756:
2757:
2758:
2759:
2760:
2761:
2762:
2763:
2764:
2765:
2766:
2767:
2768:
2769:
2770:
2771:
2772:
2773:
2774:
2775:
2776:
2777:
2778:
2779:
2780: public class EFP implements Comparable<EFP> {
2781:
2782:
2783:
2784:
2785: public static final int LEN = 92;
2786: public static final long MSB = 1L << 63;
2787: public static final long LSB = 1L << 128 - LEN;
2788: public static final long GBM = LSB >>> 1;
2789: public static final long RBM = GBM >>> 1;
2790: public static final long SBM = RBM - 1L;
2791:
2792: public static final int EFP_DECIMAL_PREC = 26;
2793:
2794: public static final int EFP_COTH_EPP_MAX = 5;
2795:
2796:
2797:
2798:
2799: public static final boolean EFP_FPCP_NAN = true;
2800:
2801:
2802:
2803:
2804:
2805: public int flg;
2806: public int epp;
2807: public long dvl;
2808:
2809: public long cvl;
2810:
2811:
2812:
2813:
2814:
2815:
2816:
2817:
2818:
2819:
2820:
2821:
2822: public EFP () {
2823: this.set0 ();
2824: }
2825: public EFP (double d) {
2826: this.setd (d);
2827: }
2828: public EFP (float f) {
2829: this.setf (f);
2830: }
2831: public EFP (int i) {
2832: this.seti (i);
2833: }
2834: public EFP (long l) {
2835: this.setl (l);
2836: }
2837: public EFP (String s) {
2838: this.parse (s);
2839: }
2840: public EFP (EFP x) {
2841: this.sete (x);
2842: }
2843:
2844:
2845:
2846:
2847:
2848: public EFP (int xf, int xe, long xd, long xc) {
2849: this.flg = xf;
2850: this.epp = xe;
2851: this.dvl = xd;
2852: this.cvl = xc;
2853: }
2854:
2855:
2856:
2857:
2858:
2859:
2860:
2861:
2862:
2863:
2864:
2865: public final EFP inner () {
2866: if (epbRoundingDepth++ == 0) {
2867: epbRoundingOuterPrec = epbRoundingPrec;
2868: epbRoundingPrec = EPB_PREC_EFP;
2869: epbRoundingOuterMode = epbRoundingMode;
2870: epbRoundingMode = EPB_MODE_RN;
2871: }
2872: if (false) {
2873: if (epbRoundingDepth == 10) {
2874: System.out.println ("too many EFP.inner()\n");
2875: }
2876: }
2877: return this;
2878: }
2879:
2880:
2881:
2882:
2883:
2884:
2885:
2886:
2887: public final EFP outer () {
2888: if (--epbRoundingDepth == 0) {
2889: epbRoundingPrec = epbRoundingOuterPrec;
2890: epbRoundingMode = epbRoundingOuterMode;
2891: }
2892: if (false) {
2893: if (epbRoundingDepth == -1) {
2894: System.out.println ("too many EFP.outer()\n");
2895: }
2896: }
2897: return this;
2898: }
2899:
2900:
2901:
2902:
2903:
2904:
2905: public final EFP finish () {
2906: int zf = this.flg;
2907: if (zf << 1 != 0) {
2908: return this;
2909: }
2910: switch (epbRoundingPrec) {
2911: case EPB_PREC_EXD:
2912: return this.roundx (epbRoundingMode);
2913: case EPB_PREC_SGL:
2914: return this.roundf (epbRoundingMode);
2915: case EPB_PREC_DBL:
2916: case EPB_PREC_DBL3:
2917: return this.roundd (epbRoundingMode);
2918: case EPB_PREC_TPL:
2919: return this.roundy (epbRoundingMode);
2920: case EPB_PREC_XSG:
2921: return this.roundg (epbRoundingMode);
2922: case EPB_PREC_EFP:
2923: default:
2924: int ze = this.epp;
2925: long zd = this.dvl;
2926: long zc = this.cvl;
2927: switch (epbRoundingMode) {
2928: case EPB_MODE_RN:
2929: if (zc << 28 != 0L) {
2930: epbFpsr |= EPB_FPSR_X2;
2931: if (zc << 28 < 0L && (zc & 0x00000017ffffffffL) != 0L &&
2932: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
2933: zd = MSB;
2934: ze++;
2935: }
2936: zc &= 0xfffffff000000000L;
2937: }
2938: break;
2939: case EPB_MODE_RZ:
2940: if (zc << 28 != 0L) {
2941: epbFpsr |= EPB_FPSR_X2;
2942: zc &= 0xfffffff000000000L;
2943: }
2944: break;
2945: case EPB_MODE_RM:
2946: if (zc << 28 != 0L) {
2947: epbFpsr |= EPB_FPSR_X2;
2948: if (zf < 0 &&
2949: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
2950: zd = MSB;
2951: ze++;
2952: }
2953: zc &= 0xfffffff000000000L;
2954: }
2955: break;
2956: case EPB_MODE_RP:
2957: default:
2958: if (zc << 28 != 0L) {
2959: epbFpsr |= EPB_FPSR_X2;
2960: if (0 <= zf &&
2961: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
2962: zd = MSB;
2963: ze++;
2964: }
2965: zc &= 0xfffffff000000000L;
2966: }
2967: break;
2968: }
2969: if ((short) ze != ze) {
2970: if (0 <= ze) {
2971: epbFpsr |= EPB_FPSR_OF;
2972: epbExceptionOperandExponent = zf;
2973: epbExceptionOperandMantissa = zd;
2974: return this.sete (OVFL_RESULTS[EPB_PREC_EFP << 3 | EPB_MODE_RP << 1 | zf >>> 31]);
2975: } else {
2976: epbFpsr |= EPB_FPSR_UF;
2977: epbExceptionOperandExponent = zf;
2978: epbExceptionOperandMantissa = zd;
2979: return this.sete (UNFL_RESULTS[EPB_PREC_EFP << 3 | EPB_MODE_RP << 1 | zf >>> 31]);
2980: }
2981: }
2982: this.flg = zf;
2983: this.epp = ze;
2984: this.dvl = zd;
2985: this.cvl = zc;
2986: return this;
2987: }
2988: }
2989: public final EFP finish (int zf, int ze, long zd, long zc, long zb) {
2990: if (zf << 1 != 0) {
2991: this.flg = zf;
2992: return this;
2993: }
2994: switch (epbRoundingPrec) {
2995: case EPB_PREC_EXD:
2996: this.flg = zf;
2997: this.epp = ze;
2998: this.dvl = zd;
2999: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3000: return this.roundx (epbRoundingMode);
3001: case EPB_PREC_SGL:
3002: this.flg = zf;
3003: this.epp = ze;
3004: this.dvl = zd;
3005: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3006: return this.roundf (epbRoundingMode);
3007: case EPB_PREC_DBL:
3008: case EPB_PREC_DBL3:
3009: this.flg = zf;
3010: this.epp = ze;
3011: this.dvl = zd;
3012: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3013: return this.roundd (epbRoundingMode);
3014: case EPB_PREC_TPL:
3015: this.flg = zf;
3016: this.epp = ze;
3017: this.dvl = zd;
3018: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3019: return this.roundy (epbRoundingMode);
3020: case EPB_PREC_XSG:
3021: this.flg = zf;
3022: this.epp = ze;
3023: this.dvl = zd;
3024: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3025: return this.roundg (epbRoundingMode);
3026: case EPB_PREC_EFP:
3027: default:
3028: switch (epbRoundingMode) {
3029: case EPB_MODE_RN:
3030: if ((zc << 28 | zb) != 0L) {
3031: epbFpsr |= EPB_FPSR_X2;
3032: if (zc << 28 < 0L && ((zc & 0x00000017ffffffffL) | zb) != 0L &&
3033: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3034: zd = MSB;
3035: ze++;
3036: }
3037: zc &= 0xfffffff000000000L;
3038: }
3039: break;
3040: case EPB_MODE_RZ:
3041: if ((zc << 28 | zb) != 0L) {
3042: epbFpsr |= EPB_FPSR_X2;
3043: zc &= 0xfffffff000000000L;
3044: }
3045: break;
3046: case EPB_MODE_RM:
3047: if ((zc << 28 | zb) != 0L) {
3048: epbFpsr |= EPB_FPSR_X2;
3049: if (zf < 0 &&
3050: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3051: zd = MSB;
3052: ze++;
3053: }
3054: zc &= 0xfffffff000000000L;
3055: }
3056: break;
3057: case EPB_MODE_RP:
3058: default:
3059: if ((zc << 28 | zb) != 0L) {
3060: epbFpsr |= EPB_FPSR_X2;
3061: if (0 <= zf &&
3062: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3063: zd = MSB;
3064: ze++;
3065: }
3066: zc &= 0xfffffff000000000L;
3067: }
3068: break;
3069: }
3070: if ((short) ze != ze) {
3071: if (0 <= ze) {
3072: epbFpsr |= EPB_FPSR_OF;
3073: epbExceptionOperandExponent = zf;
3074: epbExceptionOperandMantissa = zd;
3075: return this.sete (OVFL_RESULTS[EPB_PREC_EFP << 3 | EPB_MODE_RP << 1 | zf >>> 31]);
3076: } else {
3077: epbFpsr |= EPB_FPSR_UF;
3078: epbExceptionOperandExponent = zf;
3079: epbExceptionOperandMantissa = zd;
3080: return this.sete (UNFL_RESULTS[EPB_PREC_EFP << 3 | EPB_MODE_RP << 1 | zf >>> 31]);
3081: }
3082: }
3083: this.flg = zf;
3084: this.epp = ze;
3085: this.dvl = zd;
3086: this.cvl = zc;
3087: return this;
3088: }
3089: }
3090: public final EFP finish2 (int zf, int ze, long zd, long zc, long zb) {
3091: if (zf << 1 != 0) {
3092: this.flg = zf;
3093: return this;
3094: }
3095: switch (epbRoundingPrec) {
3096: case EPB_PREC_EXD:
3097: this.flg = zf;
3098: this.epp = ze;
3099: this.dvl = zd;
3100: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3101: return this.roundx2 (epbRoundingMode);
3102: case EPB_PREC_SGL:
3103: this.flg = zf;
3104: this.epp = ze;
3105: this.dvl = zd;
3106: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3107: return this.roundf (epbRoundingMode);
3108: case EPB_PREC_DBL:
3109: case EPB_PREC_DBL3:
3110: this.flg = zf;
3111: this.epp = ze;
3112: this.dvl = zd;
3113: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3114: return this.roundd (epbRoundingMode);
3115: case EPB_PREC_TPL:
3116: this.flg = zf;
3117: this.epp = ze;
3118: this.dvl = zd;
3119: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3120: return this.roundy2 (epbRoundingMode);
3121: case EPB_PREC_XSG:
3122: this.flg = zf;
3123: this.epp = ze;
3124: this.dvl = zd;
3125: this.cvl = zc | zb >>> 32 | zb & 0xffffffffL;
3126: return this.roundg (epbRoundingMode);
3127: case EPB_PREC_EFP:
3128: default:
3129: switch (epbRoundingMode) {
3130: case EPB_MODE_RN:
3131: if ((zc << 28 | zb) != 0L) {
3132: epbFpsr |= EPB_FPSR_X2;
3133: if (zc << 28 < 0L && ((zc & 0x00000017ffffffffL) | zb) != 0L &&
3134: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3135: zd = MSB;
3136: ze++;
3137: }
3138: zc &= 0xfffffff000000000L;
3139: }
3140: break;
3141: case EPB_MODE_RZ:
3142: if ((zc << 28 | zb) != 0L) {
3143: epbFpsr |= EPB_FPSR_X2;
3144: zc &= 0xfffffff000000000L;
3145: }
3146: break;
3147: case EPB_MODE_RM:
3148: if ((zc << 28 | zb) != 0L) {
3149: epbFpsr |= EPB_FPSR_X2;
3150: if (zf < 0 &&
3151: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3152: zd = MSB;
3153: ze++;
3154: }
3155: zc &= 0xfffffff000000000L;
3156: }
3157: break;
3158: case EPB_MODE_RP:
3159: default:
3160: if ((zc << 28 | zb) != 0L) {
3161: epbFpsr |= EPB_FPSR_X2;
3162: if (0 <= zf &&
3163: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3164: zd = MSB;
3165: ze++;
3166: }
3167: zc &= 0xfffffff000000000L;
3168: }
3169: break;
3170: }
3171: if ((short) ze != ze) {
3172: if (0 <= ze) {
3173: epbFpsr |= EPB_FPSR_OF;
3174: epbExceptionOperandExponent = zf;
3175: epbExceptionOperandMantissa = zd;
3176: return this.sete (OVFL_RESULTS[EPB_PREC_EFP << 3 | EPB_MODE_RP << 1 | zf >>> 31]);
3177: } else {
3178: epbFpsr |= EPB_FPSR_UF;
3179: epbExceptionOperandExponent = zf;
3180: epbExceptionOperandMantissa = zd;
3181: return this.sete (UNFL_RESULTS[EPB_PREC_EFP << 3 | EPB_MODE_RP << 1 | zf >>> 31]);
3182: }
3183: }
3184: this.flg = zf;
3185: this.epp = ze;
3186: this.dvl = zd;
3187: this.cvl = zc;
3188: return this;
3189: }
3190: }
3191: public final EFP ifinish (int zf, int ze, long zd, long zc, long zb) {
3192: if (zf << 1 == 0 &&
3193: (zc << 28 | zb) != 0L) {
3194: epbFpsr |= EPB_FPSR_X2;
3195: if (zc << 28 < 0L && ((zc & 0x00000017ffffffffL) | zb) != 0L &&
3196: (zc += 1L << 36) >>> 36 == 0L && ++zd == 0L) {
3197: zd = MSB;
3198: ze++;
3199: }
3200: zc &= 0xfffffff000000000L;
3201: }
3202: this.flg = zf;
3203: this.epp = ze;
3204: this.dvl = zd;
3205: this.cvl = zc;
3206: return this;
3207: }
3208:
3209:
3210:
3211:
3212:
3213:
3214:
3215:
3216:
3217:
3218:
3219:
3220:
3221:
3222:
3223:
3224:
3225:
3226:
3227:
3228: public final EFP originLowerLower (EFP x) {
3229: if (x.flg << 1 == 0 && x.epp < -16) {
3230: if (x.flg < 0) {
3231: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3232: if (this.gt (x)) {
3233:
3234: this.sete (x).finish ();
3235: }
3236: }
3237: if (epbRoundingMode == EPB_MODE_RM) {
3238: if (this.ge (x)) {
3239:
3240: this.nextdown (x, epbRoundingPrec);
3241: }
3242: }
3243: } else {
3244: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3245: if (this.gt (x)) {
3246:
3247: this.sete (x).finish ();
3248: }
3249: }
3250: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
3251: if (this.ge (x)) {
3252:
3253: this.nextdown (x, epbRoundingPrec);
3254: }
3255: }
3256: }
3257: }
3258: return this;
3259: }
3260: public final EFP originLowerUpper (EFP x) {
3261: if (x.flg << 1 == 0 && x.epp < -16) {
3262: if (x.flg < 0) {
3263: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3264: if (this.gt (x)) {
3265:
3266: this.sete (x).finish ();
3267: }
3268: }
3269: if (epbRoundingMode == EPB_MODE_RM) {
3270: if (this.ge (x)) {
3271:
3272: this.nextdown (x, epbRoundingPrec);
3273: }
3274: }
3275: } else {
3276: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3277: if (this.lt (x)) {
3278:
3279: this.sete (x).finish ();
3280: }
3281: }
3282: if (epbRoundingMode == EPB_MODE_RP) {
3283: if (this.le (x)) {
3284:
3285: this.nextup (x, epbRoundingPrec);
3286: }
3287: }
3288: }
3289: }
3290: return this;
3291: }
3292: public final EFP originUpperLower (EFP x) {
3293: if (x.flg << 1 == 0 && x.epp < -16) {
3294: if (x.flg < 0) {
3295: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3296: if (this.lt (x)) {
3297:
3298: this.sete (x).finish ();
3299: }
3300: }
3301: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
3302: if (this.le (x)) {
3303:
3304: this.nextup (x, epbRoundingPrec);
3305: }
3306: }
3307: } else {
3308: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3309: if (this.gt (x)) {
3310:
3311: this.sete (x).finish ();
3312: }
3313: }
3314: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
3315: if (this.ge (x)) {
3316:
3317: this.nextdown (x, epbRoundingPrec);
3318: }
3319: }
3320: }
3321: }
3322: return this;
3323: }
3324: public final EFP originUpperUpper (EFP x) {
3325: if (x.flg << 1 == 0 && x.epp < -16) {
3326: if (x.flg < 0) {
3327: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3328: if (this.lt (x)) {
3329:
3330: this.sete (x).finish ();
3331: }
3332: }
3333: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
3334: if (this.le (x)) {
3335:
3336: this.nextup (x, epbRoundingPrec);
3337: }
3338: }
3339: } else {
3340: if (epbRoundingPrec != EPB_PREC_SGL && epbRoundingPrec != EPB_PREC_DBL) {
3341: if (this.lt (x)) {
3342:
3343: this.sete (x).finish ();
3344: }
3345: }
3346: if (epbRoundingMode == EPB_MODE_RP) {
3347: if (this.le (x)) {
3348:
3349: this.nextup (x, epbRoundingPrec);
3350: }
3351: }
3352: }
3353: }
3354: return this;
3355: }
3356:
3357:
3358:
3359: public final EFP correctUnderflow (int savedFpsr) {
3360: if (this.flg << 1 == 0) {
3361: if (this.epp < (epbRoundingPrec == EPB_PREC_SGL ? -126 :
3362: epbRoundingPrec == EPB_PREC_DBL || epbRoundingPrec == EPB_PREC_DBL3 ? -1022 :
3363: -16383)) {
3364: epbFpsr |= EPB_FPSR_UF;
3365: } else {
3366: epbFpsr = epbFpsr & ~EPB_FPSR_UF | savedFpsr & EPB_FPSR_UF;
3367: }
3368: }
3369: return this;
3370: }
3371:
3372:
3373:
3374:
3375:
3376:
3377:
3378:
3379:
3380:
3381:
3382:
3383:
3384:
3385:
3386:
3387:
3388:
3389:
3390:
3391:
3392:
3393:
3394:
3395:
3396:
3397:
3398:
3399:
3400:
3401:
3402:
3403:
3404:
3405:
3406:
3407:
3408:
3409:
3410:
3411:
3412:
3413:
3414:
3415:
3416:
3417:
3418:
3419:
3420:
3421:
3422:
3423:
3424:
3425:
3426:
3427:
3428:
3429:
3430: public final EFP abs () {
3431: return this.finish (this.flg & ~M, this.epp, this.dvl, this.cvl, 0L);
3432: }
3433: public final EFP iabs () {
3434: this.flg &= ~M;
3435: return this;
3436: }
3437: public final EFP abs (EFP x) {
3438: return this.finish (x.flg & ~M, x.epp, x.dvl, x.cvl, 0L);
3439: }
3440: public final EFP iabs (EFP x) {
3441: this.flg = x.flg & ~M;
3442: this.epp = x.epp;
3443: this.dvl = x.dvl;
3444: this.cvl = x.cvl;
3445: return this;
3446: }
3447:
3448:
3449:
3450:
3451:
3452:
3453:
3454:
3455:
3456:
3457:
3458:
3459:
3460:
3461:
3462:
3463:
3464:
3465:
3466:
3467:
3468:
3469:
3470:
3471:
3472:
3473:
3474:
3475:
3476:
3477:
3478:
3479:
3480:
3481:
3482:
3483:
3484:
3485:
3486:
3487:
3488:
3489:
3490:
3491:
3492:
3493:
3494:
3495:
3496:
3497:
3498:
3499:
3500:
3501:
3502:
3503:
3504:
3505:
3506:
3507:
3508:
3509:
3510:
3511:
3512:
3513:
3514:
3515:
3516:
3517:
3518:
3519:
3520:
3521:
3522:
3523:
3524:
3525:
3526:
3527: public final EFP acos () {
3528: return this.acos (this);
3529: }
3530: public final EFP acos (EFP x) {
3531:
3532: int xf = x.flg;
3533: if (xf << 1 != 0) {
3534: if (xf << 1 < 0) {
3535: epbFpsr |= EPB_FPSR_X2;
3536: this.sete (ROUNDED_PI_2[epbRoundingMode]).finish ();
3537: } else if (xf << 2 < 0) {
3538: epbFpsr |= EPB_FPSR_OE;
3539: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
3540: epbExceptionOperandMantissa = 0x0000000000000000L;
3541: this.flg = N;
3542: } else {
3543: this.flg = N;
3544: }
3545: return this;
3546: }
3547:
3548: int xe = x.epp;
3549: if (xe >= 0) {
3550: if (xe == 0 && x.dvl == MSB && x.cvl == 0L) {
3551: if (xf >= 0) {
3552: this.flg = P | Z;
3553: } else {
3554: epbFpsr |= EPB_FPSR_X2;
3555: this.sete (ROUNDED_PI[epbRoundingMode]).finish ();
3556: }
3557: } else {
3558: epbFpsr |= EPB_FPSR_OE;
3559: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
3560: epbExceptionOperandMantissa = x.dvl;
3561: this.flg = N;
3562: }
3563: return this;
3564: }
3565:
3566: if (this == x) {
3567: x = new EFP (x);
3568: }
3569: return this.inner ().negdec (x).imul (new EFP ().inc (x)).sqrt ().outer ().atan2 (x);
3570: }
3571:
3572:
3573:
3574:
3575:
3576:
3577:
3578:
3579:
3580:
3581:
3582:
3583:
3584:
3585:
3586:
3587:
3588:
3589:
3590:
3591:
3592:
3593:
3594:
3595:
3596:
3597:
3598:
3599:
3600:
3601:
3602:
3603:
3604:
3605:
3606:
3607:
3608:
3609:
3610:
3611:
3612:
3613:
3614:
3615:
3616:
3617:
3618:
3619:
3620:
3621:
3622:
3623:
3624:
3625:
3626:
3627:
3628:
3629:
3630:
3631:
3632:
3633:
3634:
3635:
3636:
3637:
3638:
3639: public final EFP acosh () {
3640: return this.acosh (this);
3641: }
3642: public final EFP acosh (EFP x) {
3643: int xf = x.flg;
3644: if (xf != 0) {
3645: if (xf < 0 || xf << 1 < 0) {
3646: epbFpsr |= EPB_FPSR_OE;
3647: if (xf << 1 < 0) {
3648: epbExceptionOperandExponent = xf & M;
3649: epbExceptionOperandMantissa = 0x0000000000000000L;
3650: } else if (xf == (M | I)) {
3651: epbExceptionOperandExponent = M | 0x7fff << 16;
3652: epbExceptionOperandMantissa = 0x0000000000000000L;
3653: } else {
3654: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
3655: epbExceptionOperandMantissa = x.dvl;
3656: }
3657: this.flg = N;
3658: } else {
3659: this.flg = xf == (P | I) ? P | I : N;
3660: }
3661: return this;
3662: }
3663:
3664: if (x.epp < 0) {
3665: epbFpsr |= EPB_FPSR_OE;
3666: epbExceptionOperandExponent = 0x3fff + x.epp << 16;
3667: epbExceptionOperandMantissa = x.dvl;
3668: this.flg = N;
3669: return this;
3670: }
3671:
3672: return this.inner ().dec (x).iadd (new EFP ().isqu (this).iadd (new EFP ().imul2 (this)).sqrt ()).outer ().log1p ();
3673: }
3674:
3675:
3676:
3677:
3678:
3679:
3680:
3681:
3682:
3683:
3684:
3685:
3686:
3687:
3688:
3689:
3690:
3691:
3692:
3693:
3694:
3695:
3696:
3697:
3698:
3699:
3700:
3701:
3702:
3703:
3704:
3705:
3706:
3707:
3708:
3709:
3710:
3711:
3712:
3713:
3714:
3715:
3716:
3717:
3718:
3719:
3720:
3721:
3722:
3723:
3724:
3725:
3726:
3727:
3728:
3729:
3730:
3731:
3732:
3733:
3734:
3735:
3736:
3737:
3738:
3739: public final EFP acot () {
3740: return this.acot (this);
3741: }
3742: public final EFP acot (EFP x) {
3743: return this.inner ().rcp (x).outer ().atan ();
3744: }
3745:
3746:
3747:
3748:
3749:
3750:
3751:
3752:
3753:
3754:
3755:
3756:
3757:
3758:
3759:
3760:
3761:
3762:
3763:
3764:
3765:
3766:
3767:
3768:
3769:
3770:
3771:
3772:
3773:
3774:
3775:
3776:
3777:
3778:
3779:
3780:
3781:
3782:
3783:
3784:
3785:
3786:
3787:
3788:
3789:
3790:
3791:
3792:
3793:
3794:
3795:
3796:
3797:
3798:
3799:
3800:
3801:
3802:
3803:
3804:
3805:
3806:
3807:
3808:
3809:
3810:
3811: public final EFP acoth () {
3812: return this.acoth (this);
3813: }
3814: public final EFP acoth (EFP x) {
3815: int xf = x.flg;
3816: if (xf << 1 != 0) {
3817: if (xf << 1 < 0) {
3818: epbFpsr |= EPB_FPSR_OE;
3819: epbExceptionOperandExponent = xf & M;
3820: epbExceptionOperandMantissa = 0x0000000000000000L;
3821: this.flg = N;
3822: } else {
3823: this.flg = xf << 2 < 0 ? xf ^ (Z | I) : N;
3824: }
3825: return this;
3826: }
3827:
3828: if (x.epp < 0) {
3829: epbFpsr |= EPB_FPSR_OE;
3830: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
3831: epbExceptionOperandMantissa = x.dvl;
3832: this.flg = N;
3833: return this;
3834: }
3835: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
3836: epbFpsr |= EPB_FPSR_DZ;
3837: epbExceptionOperandExponent = xf & M | 0x3fff << 16;
3838: epbExceptionOperandMantissa = 0x8000000000000000L;
3839: this.flg = xf | I;
3840: return this;
3841: }
3842:
3843: return this.inner ().iabs (x).dec ().rcp ().imul2 ().log1p ().idiv2 ().outer ().neg (xf < 0);
3844: }
3845:
3846:
3847:
3848:
3849:
3850:
3851:
3852:
3853:
3854:
3855:
3856:
3857:
3858:
3859:
3860:
3861:
3862:
3863:
3864:
3865:
3866:
3867:
3868:
3869:
3870:
3871:
3872:
3873:
3874:
3875:
3876:
3877:
3878:
3879:
3880:
3881:
3882:
3883:
3884:
3885:
3886:
3887:
3888:
3889:
3890:
3891:
3892:
3893:
3894:
3895:
3896:
3897:
3898:
3899:
3900:
3901:
3902:
3903:
3904:
3905:
3906:
3907:
3908:
3909:
3910:
3911:
3912:
3913:
3914: public final EFP acsc () {
3915: return this.acsc (this);
3916: }
3917: public final EFP acsc (EFP x) {
3918: int xf = x.flg;
3919: if (xf << 1 != 0) {
3920: if (xf << 1 < 0) {
3921: epbFpsr |= EPB_FPSR_OE;
3922: epbExceptionOperandExponent = xf & M;
3923: epbExceptionOperandMantissa = 0x0000000000000000L;
3924: this.flg = N;
3925: } else {
3926: this.flg = xf << 2 < 0 ? xf ^ (Z | I) : N;
3927: }
3928: return this;
3929: }
3930:
3931: if (x.epp < 0) {
3932: epbFpsr |= EPB_FPSR_OE;
3933: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
3934: epbExceptionOperandMantissa = x.dvl;
3935: this.flg = N;
3936: return this;
3937: }
3938: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
3939: epbFpsr |= EPB_FPSR_X2;
3940: if (xf >= 0) {
3941: this.sete (ROUNDED_PI_2[epbRoundingMode]).finish ();
3942: } else {
3943: this.sete (ROUNDED_NEGPI_2[epbRoundingMode]).finish ();
3944: }
3945: return this;
3946: }
3947:
3948: EFP t = new EFP ().inner ().inc (x);
3949: return this.dec (x).imul (t).sqrt ().rcp ().atan ().outer ().neg (xf < 0);
3950: }
3951:
3952:
3953:
3954:
3955:
3956:
3957:
3958:
3959:
3960:
3961:
3962:
3963:
3964:
3965:
3966:
3967:
3968:
3969:
3970:
3971:
3972:
3973:
3974:
3975:
3976:
3977:
3978:
3979:
3980:
3981:
3982:
3983:
3984:
3985:
3986:
3987:
3988:
3989:
3990:
3991:
3992:
3993:
3994:
3995:
3996:
3997:
3998:
3999:
4000:
4001:
4002:
4003:
4004:
4005:
4006:
4007:
4008:
4009:
4010:
4011:
4012:
4013:
4014:
4015:
4016:
4017:
4018:
4019:
4020:
4021:
4022:
4023:
4024:
4025:
4026:
4027:
4028:
4029:
4030:
4031:
4032:
4033:
4034:
4035:
4036:
4037:
4038:
4039:
4040:
4041:
4042:
4043:
4044:
4045:
4046:
4047:
4048:
4049:
4050: public final EFP acsch () {
4051: return this.acsch (this);
4052: }
4053: public final EFP acsch (EFP x) {
4054: int xf = x.flg;
4055: if (xf << 1 != 0) {
4056: if (xf << 1 < 0) {
4057: epbFpsr |= EPB_FPSR_OE;
4058: epbExceptionOperandExponent = xf & M;
4059: epbExceptionOperandMantissa = 0x0000000000000000L;
4060: this.flg = N;
4061: } else {
4062: this.flg = xf << 2 < 0 ? xf ^ (Z | I) : N;
4063: }
4064: return this;
4065: }
4066:
4067: x = new EFP ().inner ().rcp (x);
4068: if (x.epp < -1) {
4069: EFP x2 = new EFP ().isqu (x);
4070: return this.imul (ASINH_C43, x2)
4071: .iadd (ASINH_C41).imul (x2)
4072: .iadd (ASINH_C39).imul (x2)
4073: .iadd (ASINH_C37).imul (x2)
4074: .iadd (ASINH_C35).imul (x2)
4075: .iadd (ASINH_C33).imul (x2)
4076: .iadd (ASINH_C31).imul (x2)
4077: .iadd (ASINH_C29).imul (x2)
4078: .iadd (ASINH_C27).imul (x2)
4079: .iadd (ASINH_C25).imul (x2)
4080: .iadd (ASINH_C23).imul (x2)
4081: .iadd (ASINH_C21).imul (x2)
4082: .iadd (ASINH_C19).imul (x2)
4083: .iadd (ASINH_C17).imul (x2)
4084: .iadd (ASINH_C15).imul (x2)
4085: .iadd (ASINH_C13).imul (x2)
4086: .iadd (ASINH_C11).imul (x2)
4087: .iadd (ASINH_C9).imul (x2)
4088: .iadd (ASINH_C7).imul (x2)
4089: .iadd (ASINH_C5).imul (x2)
4090: .iadd (ASINH_C3).imul (x2)
4091: .iadd (ASINH_C1).outer ().mul (x);
4092: }
4093:
4094: return this.iabs (x).iadd (new EFP ().isqu (this).inc ().sqrt ()).log ().outer ().neg (xf < 0);
4095: }
4096:
4097:
4098:
4099:
4100:
4101:
4102:
4103:
4104:
4105:
4106:
4107:
4108: public final EFP add (EFP y) {
4109: int xf = this.flg;
4110: int xe = this.epp;
4111: long xd = this.dvl;
4112: long xc = this.cvl;
4113: long xb = 0L;
4114: int yf = y.flg;
4115: if ((xf | yf) << 1 != 0) {
4116: if ((xf | yf) << 3 < 0) {
4117: this.flg = N;
4118: return this;
4119: }
4120: if ((xf & yf) << 2 < 0 && xf != yf) {
4121: epbFpsr |= EPB_FPSR_OE;
4122: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
4123: epbExceptionOperandMantissa = 0x0000000000000000L;
4124: this.flg = N;
4125: return this;
4126: }
4127: if ((xf & yf) << 1 < 0 && xf != yf) {
4128: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4129: return this;
4130: }
4131: if (xf << 1 < 0 || yf << 2 < 0) {
4132: xf = yf;
4133: xe = y.epp;
4134: xd = y.dvl;
4135: xc = y.cvl;
4136: }
4137:
4138: } else {
4139:
4140: long yd = y.dvl;
4141: long yc = y.cvl;
4142: int o = xe - y.epp;
4143: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
4144:
4145: xf = yf;
4146: xe += o = -o;
4147: xd = yd;
4148: xc = yc;
4149: yf = this.flg;
4150: yd = this.dvl;
4151: yc = this.cvl;
4152: }
4153:
4154:
4155: if (0 < o) {
4156: if (o <= 63) {
4157: xb = yc << -o;
4158: yc = yd << -o | yc >>> o;
4159: yd >>>= o;
4160: } else if (o == 64) {
4161: xb = yc;
4162: yc = yd;
4163: yd = 0L;
4164: } else if (o <= 127) {
4165: xb = yd << -o | yc;
4166: yc = yd >>> o;
4167: yd = 0L;
4168: } else {
4169: xb = yd | yc;
4170: yc = 0L;
4171: yd = 0L;
4172: }
4173: }
4174:
4175: if (xf == yf) {
4176:
4177: xb |= yc << 62;
4178:
4179: xc = xd << 63 | xc >>> 1;
4180: xd >>>= 1;
4181: yc = yd << 63 | yc >>> 1;
4182: yd >>>= 1;
4183:
4184: yc >>>= 1;
4185: xc >>>= 1;
4186:
4187: xc += yc;
4188: xd += yd + (xc >>> 63);
4189:
4190: xc <<= 1;
4191:
4192: if (xd < 0L) {
4193: xe++;
4194: } else {
4195: xd = xd << 1 | xc >>> 63;
4196: xc <<= 1;
4197: }
4198: } else {
4199:
4200: xb |= yc << 63;
4201:
4202: yc >>>= 1;
4203: xc >>>= 1;
4204:
4205:
4206: if (xb != 0L) {
4207: xc--;
4208: }
4209: xc -= yc;
4210: xd -= yd + (xc >>> 63);
4211:
4212: xc <<= 1;
4213:
4214: if (0L <= xd) {
4215: if (xd != 0L) {
4216: xe -= o = Long.numberOfLeadingZeros (xd);
4217: xd = xd << o | xc >>> -o;
4218: xc <<= o;
4219: } else if (xc != 0L) {
4220: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
4221: xd = xc << o;
4222: xc = 0L;
4223: } else {
4224: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4225: }
4226: }
4227: }
4228: }
4229: return this.finish (xf, xe, xd, xc, xb);
4230: }
4231: public final EFP iadd (EFP y) {
4232: int xf = this.flg;
4233: int xe = this.epp;
4234: long xd = this.dvl;
4235: long xc = this.cvl;
4236: long xb = 0L;
4237: int yf = y.flg;
4238: if ((xf | yf) << 1 != 0) {
4239: if ((xf | yf) << 3 < 0) {
4240: this.flg = N;
4241: return this;
4242: }
4243: if ((xf & yf) << 2 < 0 && xf != yf) {
4244: epbFpsr |= EPB_FPSR_OE;
4245: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
4246: epbExceptionOperandMantissa = 0x0000000000000000L;
4247: this.flg = N;
4248: return this;
4249: }
4250: if ((xf & yf) << 1 < 0 && xf != yf) {
4251: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4252: return this;
4253: }
4254: if (xf << 1 < 0 || yf << 2 < 0) {
4255: xf = yf;
4256: xe = y.epp;
4257: xd = y.dvl;
4258: xc = y.cvl;
4259: }
4260:
4261: } else {
4262:
4263: long yd = y.dvl;
4264: long yc = y.cvl;
4265: int o = xe - y.epp;
4266: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
4267:
4268: xf = yf;
4269: xe += o = -o;
4270: xd = yd;
4271: xc = yc;
4272: yf = this.flg;
4273: yd = this.dvl;
4274: yc = this.cvl;
4275: }
4276:
4277:
4278: if (0 < o) {
4279: if (o <= 63) {
4280: xb = yc << -o;
4281: yc = yd << -o | yc >>> o;
4282: yd >>>= o;
4283: } else if (o == 64) {
4284: xb = yc;
4285: yc = yd;
4286: yd = 0L;
4287: } else if (o <= 127) {
4288: xb = yd << -o | yc;
4289: yc = yd >>> o;
4290: yd = 0L;
4291: } else {
4292: xb = yd | yc;
4293: yc = 0L;
4294: yd = 0L;
4295: }
4296: }
4297:
4298: if (xf == yf) {
4299:
4300: xb |= yc << 62;
4301:
4302: xc = xd << 63 | xc >>> 1;
4303: xd >>>= 1;
4304: yc = yd << 63 | yc >>> 1;
4305: yd >>>= 1;
4306:
4307: yc >>>= 1;
4308: xc >>>= 1;
4309:
4310: xc += yc;
4311: xd += yd + (xc >>> 63);
4312:
4313: xc <<= 1;
4314:
4315: if (xd < 0L) {
4316: xe++;
4317: } else {
4318: xd = xd << 1 | xc >>> 63;
4319: xc <<= 1;
4320: }
4321: } else {
4322:
4323: xb |= yc << 63;
4324:
4325: yc >>>= 1;
4326: xc >>>= 1;
4327:
4328:
4329: if (xb != 0L) {
4330: xc--;
4331: }
4332: xc -= yc;
4333: xd -= yd + (xc >>> 63);
4334:
4335: xc <<= 1;
4336:
4337: if (0L <= xd) {
4338: if (xd != 0L) {
4339: xe -= o = Long.numberOfLeadingZeros (xd);
4340: xd = xd << o | xc >>> -o;
4341: xc <<= o;
4342: } else if (xc != 0L) {
4343: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
4344: xd = xc << o;
4345: xc = 0L;
4346: } else {
4347: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4348: }
4349: }
4350: }
4351: }
4352: return this.ifinish (xf, xe, xd, xc, xb);
4353: }
4354: public final EFP add (EFP x, EFP y) {
4355: int xf = x.flg;
4356: int xe = x.epp;
4357: long xd = x.dvl;
4358: long xc = x.cvl;
4359: long xb = 0L;
4360: int yf = y.flg;
4361: if ((xf | yf) << 1 != 0) {
4362: if ((xf | yf) << 3 < 0) {
4363: this.flg = N;
4364: return this;
4365: }
4366: if ((xf & yf) << 2 < 0 && xf != yf) {
4367: epbFpsr |= EPB_FPSR_OE;
4368: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
4369: epbExceptionOperandMantissa = 0x0000000000000000L;
4370: this.flg = N;
4371: return this;
4372: }
4373: if ((xf & yf) << 1 < 0 && xf != yf) {
4374: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4375: return this;
4376: }
4377: if (xf << 1 < 0 || yf << 2 < 0) {
4378: xf = yf;
4379: xe = y.epp;
4380: xd = y.dvl;
4381: xc = y.cvl;
4382: }
4383:
4384: } else {
4385:
4386: long yd = y.dvl;
4387: long yc = y.cvl;
4388: int o = xe - y.epp;
4389: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
4390:
4391: xf = yf;
4392: xe += o = -o;
4393: xd = yd;
4394: xc = yc;
4395: yf = x.flg;
4396: yd = x.dvl;
4397: yc = x.cvl;
4398: }
4399:
4400:
4401: if (0 < o) {
4402: if (o <= 63) {
4403: xb = yc << -o;
4404: yc = yd << -o | yc >>> o;
4405: yd >>>= o;
4406: } else if (o == 64) {
4407: xb = yc;
4408: yc = yd;
4409: yd = 0L;
4410: } else if (o <= 127) {
4411: xb = yd << -o | yc;
4412: yc = yd >>> o;
4413: yd = 0L;
4414: } else {
4415: xb = yd | yc;
4416: yc = 0L;
4417: yd = 0L;
4418: }
4419: }
4420:
4421: if (xf == yf) {
4422:
4423: xb |= yc << 62;
4424:
4425: xc = xd << 63 | xc >>> 1;
4426: xd >>>= 1;
4427: yc = yd << 63 | yc >>> 1;
4428: yd >>>= 1;
4429:
4430: yc >>>= 1;
4431: xc >>>= 1;
4432:
4433: xc += yc;
4434: xd += yd + (xc >>> 63);
4435:
4436: xc <<= 1;
4437:
4438: if (xd < 0L) {
4439: xe++;
4440: } else {
4441: xd = xd << 1 | xc >>> 63;
4442: xc <<= 1;
4443: }
4444: } else {
4445:
4446: xb |= yc << 63;
4447:
4448: yc >>>= 1;
4449: xc >>>= 1;
4450:
4451:
4452: if (xb != 0L) {
4453: xc--;
4454: }
4455: xc -= yc;
4456: xd -= yd + (xc >>> 63);
4457:
4458: xc <<= 1;
4459:
4460: if (0L <= xd) {
4461: if (xd != 0L) {
4462: xe -= o = Long.numberOfLeadingZeros (xd);
4463: xd = xd << o | xc >>> -o;
4464: xc <<= o;
4465: } else if (xc != 0L) {
4466: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
4467: xd = xc << o;
4468: xc = 0L;
4469: } else {
4470: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4471: }
4472: }
4473: }
4474: }
4475: return this.finish (xf, xe, xd, xc, xb);
4476: }
4477: public final EFP iadd (EFP x, EFP y) {
4478: int xf = x.flg;
4479: int xe = x.epp;
4480: long xd = x.dvl;
4481: long xc = x.cvl;
4482: long xb = 0L;
4483: int yf = y.flg;
4484: if ((xf | yf) << 1 != 0) {
4485: if ((xf | yf) << 3 < 0) {
4486: this.flg = N;
4487: return this;
4488: }
4489: if ((xf & yf) << 2 < 0 && xf != yf) {
4490: epbFpsr |= EPB_FPSR_OE;
4491: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
4492: epbExceptionOperandMantissa = 0x0000000000000000L;
4493: this.flg = N;
4494: return this;
4495: }
4496: if ((xf & yf) << 1 < 0 && xf != yf) {
4497: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4498: return this;
4499: }
4500: if (xf << 1 < 0 || yf << 2 < 0) {
4501: xf = yf;
4502: xe = y.epp;
4503: xd = y.dvl;
4504: xc = y.cvl;
4505: }
4506:
4507: } else {
4508:
4509: long yd = y.dvl;
4510: long yc = y.cvl;
4511: int o = xe - y.epp;
4512: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
4513:
4514: xf = yf;
4515: xe += o = -o;
4516: xd = yd;
4517: xc = yc;
4518: yf = x.flg;
4519: yd = x.dvl;
4520: yc = x.cvl;
4521: }
4522:
4523:
4524: if (0 < o) {
4525: if (o <= 63) {
4526: xb = yc << -o;
4527: yc = yd << -o | yc >>> o;
4528: yd >>>= o;
4529: } else if (o == 64) {
4530: xb = yc;
4531: yc = yd;
4532: yd = 0L;
4533: } else if (o <= 127) {
4534: xb = yd << -o | yc;
4535: yc = yd >>> o;
4536: yd = 0L;
4537: } else {
4538: xb = yd | yc;
4539: yc = 0L;
4540: yd = 0L;
4541: }
4542: }
4543:
4544: if (xf == yf) {
4545:
4546: xb |= yc << 62;
4547:
4548: xc = xd << 63 | xc >>> 1;
4549: xd >>>= 1;
4550: yc = yd << 63 | yc >>> 1;
4551: yd >>>= 1;
4552:
4553: yc >>>= 1;
4554: xc >>>= 1;
4555:
4556: xc += yc;
4557: xd += yd + (xc >>> 63);
4558:
4559: xc <<= 1;
4560:
4561: if (xd < 0L) {
4562: xe++;
4563: } else {
4564: xd = xd << 1 | xc >>> 63;
4565: xc <<= 1;
4566: }
4567: } else {
4568:
4569: xb |= yc << 63;
4570:
4571: yc >>>= 1;
4572: xc >>>= 1;
4573:
4574:
4575: if (xb != 0L) {
4576: xc--;
4577: }
4578: xc -= yc;
4579: xd -= yd + (xc >>> 63);
4580:
4581: xc <<= 1;
4582:
4583: if (0L <= xd) {
4584: if (xd != 0L) {
4585: xe -= o = Long.numberOfLeadingZeros (xd);
4586: xd = xd << o | xc >>> -o;
4587: xc <<= o;
4588: } else if (xc != 0L) {
4589: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
4590: xd = xc << o;
4591: xc = 0L;
4592: } else {
4593: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
4594: }
4595: }
4596: }
4597: }
4598: return this.ifinish (xf, xe, xd, xc, xb);
4599: }
4600:
4601:
4602:
4603:
4604:
4605:
4606:
4607:
4608:
4609:
4610:
4611:
4612:
4613:
4614:
4615:
4616:
4617:
4618:
4619:
4620:
4621:
4622:
4623:
4624:
4625:
4626:
4627:
4628:
4629:
4630:
4631:
4632:
4633:
4634:
4635:
4636:
4637:
4638:
4639:
4640:
4641:
4642:
4643:
4644:
4645:
4646:
4647:
4648:
4649:
4650:
4651:
4652:
4653:
4654:
4655:
4656:
4657:
4658:
4659:
4660:
4661:
4662: public final EFP agi (EFP be) {
4663: return this.agi (this, be);
4664: }
4665: public final EFP agi (EFP ae, EFP be) {
4666: return this.agm (ae, be).rcpdiv (PI_2);
4667: }
4668:
4669:
4670:
4671:
4672:
4673:
4674:
4675:
4676:
4677:
4678:
4679:
4680:
4681:
4682:
4683:
4684:
4685:
4686:
4687:
4688:
4689:
4690:
4691:
4692:
4693:
4694:
4695:
4696:
4697:
4698:
4699:
4700:
4701:
4702:
4703:
4704:
4705:
4706:
4707:
4708:
4709:
4710:
4711:
4712:
4713:
4714:
4715:
4716:
4717:
4718:
4719:
4720:
4721:
4722:
4723:
4724:
4725:
4726:
4727:
4728:
4729:
4730:
4731:
4732:
4733: public final EFP agm (EFP be) {
4734: return this.agm (this, be);
4735: }
4736: public final EFP agm (EFP ae, EFP be) {
4737: int af = ae.flg;
4738: int bf = be.flg;
4739: if ((af | bf) != 0) {
4740: this.flg = ((af | bf) << 3 < 0 ||
4741: ((af | bf) & (Z | I)) == (Z | I) ? N :
4742: (af | bf) << 1 < 0 ? P | Z :
4743: (af | bf) < 0 ? N :
4744: P | I);
4745: return this;
4746: }
4747:
4748: EFP t = new EFP ();
4749: EFP u = new EFP ();
4750: EFP v = new EFP ();
4751: if (ae.ge (be)) {
4752:
4753: u.flg = ae.flg;
4754: u.epp = ae.epp;
4755: u.dvl = ae.dvl;
4756: u.cvl = ae.cvl;
4757:
4758: v.flg = be.flg;
4759: v.epp = be.epp;
4760: v.dvl = be.dvl;
4761: v.cvl = be.cvl;
4762: } else {
4763:
4764: u.flg = be.flg;
4765: u.epp = be.epp;
4766: u.dvl = be.dvl;
4767: u.cvl = be.cvl;
4768:
4769: v.flg = ae.flg;
4770: v.epp = ae.epp;
4771: v.dvl = ae.dvl;
4772: v.cvl = ae.cvl;
4773: }
4774:
4775:
4776: this.inner ();
4777: for (;;) {
4778:
4779: t.iadd (u, v).idiv2 ();
4780: if (t.ge (u)) {
4781: return this.outer ().sete (u).finish ();
4782: }
4783: v.imul (u).sqrt ();
4784:
4785: u.iadd (t, v).idiv2 ();
4786: if (u.ge (t)) {
4787: return this.outer ().sete (t).finish ();
4788: }
4789: v.imul (t).sqrt ();
4790: }
4791: }
4792:
4793:
4794:
4795:
4796:
4797:
4798:
4799:
4800:
4801:
4802:
4803:
4804:
4805:
4806:
4807:
4808:
4809:
4810:
4811:
4812:
4813:
4814:
4815:
4816:
4817:
4818:
4819:
4820:
4821:
4822:
4823:
4824:
4825:
4826:
4827:
4828:
4829:
4830:
4831:
4832:
4833:
4834:
4835:
4836:
4837:
4838:
4839:
4840:
4841:
4842:
4843:
4844:
4845:
4846:
4847:
4848:
4849:
4850:
4851:
4852:
4853:
4854:
4855:
4856: public final EFP asec () {
4857: return this.asec (this);
4858: }
4859: public final EFP asec (EFP x) {
4860: int xf = x.flg;
4861: if (x.cmp1abs () < 0) {
4862: epbFpsr |= EPB_FPSR_OE;
4863: if (xf << 1 < 0) {
4864: epbExceptionOperandExponent = xf & M;
4865: epbExceptionOperandMantissa = 0x0000000000000000L;
4866: } else {
4867: epbExceptionOperandExponent = xf & M | 0x3fff + x.epp << 16;
4868: epbExceptionOperandMantissa = x.dvl;
4869: }
4870: this.flg = N;
4871: return this;
4872: }
4873: EFP t = new EFP ().inner ().dec (x);
4874: this.inc (x).imul (t).sqrt ();
4875: return (xf < 0 ?
4876: this.atan ().negsub (PI).outer ().add (PIA) :
4877: this.outer ().atan ());
4878: }
4879:
4880:
4881:
4882:
4883:
4884:
4885:
4886:
4887:
4888:
4889:
4890:
4891:
4892:
4893:
4894:
4895:
4896:
4897:
4898:
4899:
4900:
4901:
4902:
4903:
4904:
4905:
4906:
4907:
4908:
4909:
4910:
4911:
4912:
4913:
4914:
4915:
4916:
4917:
4918:
4919:
4920:
4921:
4922:
4923:
4924:
4925:
4926:
4927:
4928:
4929:
4930:
4931:
4932:
4933:
4934:
4935:
4936:
4937:
4938:
4939:
4940:
4941:
4942:
4943:
4944:
4945:
4946:
4947: public final EFP asech () {
4948: return this.asech (this);
4949: }
4950: public final EFP asech (EFP x) {
4951:
4952: int xf = x.flg;
4953: if (xf != 0) {
4954: if (xf < 0 || xf << 2 < 0) {
4955: epbFpsr |= EPB_FPSR_OE;
4956: if (xf == (M | Z)) {
4957: epbExceptionOperandExponent = M;
4958: epbExceptionOperandMantissa = 0x0000000000000000L;
4959: } else if (xf << 2 < 0) {
4960: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
4961: epbExceptionOperandMantissa = 0x0000000000000000L;
4962: } else {
4963: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
4964: epbExceptionOperandMantissa = x.dvl;
4965: }
4966: this.flg = N;
4967: } else {
4968: this.flg = xf << 1 < 0 ? P | I : N;
4969: }
4970: return this;
4971: }
4972:
4973: if (0 <= x.epp) {
4974: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
4975: this.flg = P | Z;
4976: } else {
4977: epbFpsr |= EPB_FPSR_OE;
4978: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
4979: epbExceptionOperandMantissa = x.dvl;
4980: this.flg = N;
4981: }
4982: return this;
4983: }
4984:
4985: EFP t = new EFP ().inner ().negdec (x).div (x);
4986: return this.iadd (t, new EFP ().isqu (t).iadd (new EFP ().imul2 (t)).sqrt ()).outer ().log1p ();
4987: }
4988:
4989:
4990:
4991:
4992:
4993:
4994:
4995:
4996:
4997:
4998:
4999:
5000:
5001:
5002:
5003:
5004:
5005:
5006:
5007:
5008:
5009:
5010:
5011:
5012:
5013:
5014:
5015:
5016:
5017:
5018:
5019:
5020:
5021:
5022:
5023:
5024:
5025:
5026:
5027:
5028:
5029:
5030:
5031:
5032:
5033:
5034:
5035:
5036:
5037:
5038:
5039:
5040:
5041:
5042:
5043:
5044:
5045:
5046:
5047:
5048:
5049:
5050:
5051:
5052:
5053:
5054:
5055:
5056:
5057:
5058:
5059:
5060:
5061:
5062:
5063:
5064:
5065:
5066:
5067:
5068:
5069:
5070:
5071:
5072:
5073:
5074:
5075:
5076:
5077:
5078:
5079:
5080:
5081:
5082:
5083:
5084:
5085:
5086:
5087:
5088:
5089: public final EFP asin () {
5090: return this.asin (this);
5091: }
5092: public final EFP asin (EFP x) {
5093: int xf = x.flg;
5094: if (xf << 1 != 0) {
5095: if (xf << 2 < 0) {
5096: epbFpsr |= EPB_FPSR_OE;
5097: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
5098: epbExceptionOperandMantissa = 0x0000000000000000L;
5099: this.flg = N;
5100: } else {
5101: this.flg = xf;
5102: }
5103: return this;
5104: }
5105:
5106: int xe = x.epp;
5107: if (0 <= xe) {
5108: if (xe == 0 && x.dvl == MSB && x.cvl == 0L) {
5109: epbFpsr |= EPB_FPSR_X2;
5110: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
5111: epbExceptionOperandMantissa = x.dvl;
5112: if (0 <= xf) {
5113: this.sete (ROUNDED_PI_2[epbRoundingMode]).finish ();
5114: } else {
5115: this.sete (ROUNDED_NEGPI_2[epbRoundingMode]).finish ();
5116: }
5117: } else {
5118: epbFpsr |= EPB_FPSR_OE;
5119: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
5120: epbExceptionOperandMantissa = x.dvl;
5121: this.flg = N;
5122: }
5123: return this;
5124: }
5125:
5126: epbFpsr |= EPB_FPSR_X2;
5127: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
5128: epbExceptionOperandMantissa = x.dvl;
5129: if (x.epp < -4) {
5130:
5131:
5132: int savedFpsr = epbFpsr;
5133: this.inner ();
5134: if (this == x) {
5135: x = new EFP (x);
5136: }
5137: EFP x2 = new EFP ().isqu (x);
5138: this.imul (ASIN_C17, x2)
5139: .iadd (ASIN_C15).imul (x2)
5140: .iadd (ASIN_C13).imul (x2)
5141: .iadd (ASIN_C11).imul (x2)
5142: .iadd (ASIN_C9).imul (x2)
5143: .iadd (ASIN_C7).imul (x2)
5144: .iadd (ASIN_C5).imul (x2)
5145: .iadd (ASIN_C3).imul (x2)
5146: .iadd (ASIN_C1).outer ().mul (x);
5147: return this.originLowerUpper (x).correctUnderflow (savedFpsr);
5148: }
5149:
5150: this.inner ();
5151: EFP t = new EFP ().negdec (x).imul (new EFP ().inc (x)).sqrt ();
5152: return this.outer ().atan2 (x, t);
5153: }
5154:
5155:
5156:
5157:
5158:
5159:
5160:
5161:
5162:
5163:
5164:
5165:
5166:
5167:
5168:
5169:
5170:
5171:
5172:
5173:
5174:
5175:
5176:
5177:
5178:
5179:
5180:
5181:
5182:
5183:
5184:
5185:
5186:
5187:
5188:
5189:
5190:
5191:
5192:
5193:
5194:
5195:
5196:
5197:
5198:
5199:
5200:
5201:
5202:
5203:
5204:
5205:
5206:
5207:
5208:
5209:
5210:
5211:
5212:
5213:
5214:
5215:
5216:
5217:
5218:
5219:
5220:
5221:
5222:
5223:
5224:
5225:
5226:
5227:
5228:
5229:
5230:
5231:
5232:
5233:
5234:
5235:
5236: public final EFP asinh () {
5237: return this.asinh (this);
5238: }
5239: public final EFP asinh (EFP x) {
5240: int xf = x.flg;
5241: if (xf << 1 != 0) {
5242: this.flg = xf;
5243: return this;
5244: }
5245:
5246: if (x.epp < -1) {
5247: int savedFpsr = epbFpsr;
5248: this.inner ();
5249: if (this == x) {
5250: x = new EFP (x);
5251: }
5252: EFP x2 = new EFP ().isqu (x);
5253: this.imul (ASINH_C43, x2)
5254: .iadd (ASINH_C41).imul (x2)
5255: .iadd (ASINH_C39).imul (x2)
5256: .iadd (ASINH_C37).imul (x2)
5257: .iadd (ASINH_C35).imul (x2)
5258: .iadd (ASINH_C33).imul (x2)
5259: .iadd (ASINH_C31).imul (x2)
5260: .iadd (ASINH_C29).imul (x2)
5261: .iadd (ASINH_C27).imul (x2)
5262: .iadd (ASINH_C25).imul (x2)
5263: .iadd (ASINH_C23).imul (x2)
5264: .iadd (ASINH_C21).imul (x2)
5265: .iadd (ASINH_C19).imul (x2)
5266: .iadd (ASINH_C17).imul (x2)
5267: .iadd (ASINH_C15).imul (x2)
5268: .iadd (ASINH_C13).imul (x2)
5269: .iadd (ASINH_C11).imul (x2)
5270: .iadd (ASINH_C9).imul (x2)
5271: .iadd (ASINH_C7).imul (x2)
5272: .iadd (ASINH_C5).imul (x2)
5273: .iadd (ASINH_C3).imul (x2)
5274: .iadd (ASINH_C1).outer ().mul (x);
5275: return this.originUpperLower (x).correctUnderflow (savedFpsr);
5276: }
5277:
5278: EFP t = new EFP ().inner ().iabs (x);
5279: return this.isqu (t).inc ().sqrt ().iadd (t).log ().outer ().neg (xf < 0);
5280: }
5281:
5282:
5283:
5284:
5285:
5286:
5287:
5288:
5289:
5290:
5291:
5292:
5293:
5294:
5295:
5296:
5297:
5298:
5299:
5300:
5301:
5302:
5303:
5304:
5305:
5306:
5307:
5308:
5309:
5310:
5311:
5312:
5313:
5314:
5315:
5316:
5317:
5318:
5319:
5320:
5321:
5322:
5323:
5324:
5325:
5326:
5327:
5328:
5329:
5330:
5331:
5332:
5333:
5334:
5335:
5336:
5337:
5338:
5339:
5340:
5341:
5342:
5343:
5344:
5345:
5346:
5347:
5348:
5349:
5350:
5351:
5352:
5353:
5354:
5355:
5356:
5357:
5358:
5359:
5360:
5361:
5362:
5363:
5364:
5365:
5366:
5367:
5368:
5369:
5370:
5371:
5372:
5373:
5374:
5375:
5376:
5377:
5378:
5379:
5380:
5381:
5382:
5383:
5384:
5385:
5386:
5387:
5388:
5389:
5390:
5391:
5392:
5393:
5394:
5395:
5396:
5397:
5398:
5399:
5400:
5401:
5402:
5403:
5404:
5405:
5406:
5407:
5408:
5409:
5410:
5411:
5412:
5413:
5414:
5415:
5416:
5417:
5418:
5419:
5420:
5421:
5422:
5423:
5424:
5425:
5426:
5427:
5428:
5429:
5430:
5431:
5432:
5433:
5434:
5435:
5436:
5437:
5438:
5439:
5440:
5441:
5442:
5443:
5444:
5445:
5446:
5447:
5448:
5449:
5450:
5451:
5452:
5453:
5454:
5455:
5456:
5457:
5458:
5459:
5460:
5461:
5462:
5463:
5464:
5465:
5466:
5467:
5468:
5469:
5470:
5471:
5472:
5473:
5474:
5475:
5476:
5477:
5478:
5479:
5480:
5481:
5482:
5483:
5484:
5485:
5486:
5487:
5488:
5489:
5490:
5491:
5492:
5493:
5494:
5495:
5496:
5497:
5498:
5499:
5500:
5501:
5502:
5503:
5504:
5505:
5506:
5507:
5508:
5509:
5510:
5511:
5512:
5513:
5514:
5515:
5516:
5517:
5518:
5519:
5520:
5521:
5522:
5523:
5524:
5525:
5526:
5527:
5528:
5529:
5530:
5531:
5532:
5533:
5534:
5535:
5536:
5537:
5538:
5539:
5540:
5541:
5542:
5543:
5544:
5545:
5546:
5547:
5548:
5549:
5550:
5551:
5552:
5553:
5554:
5555:
5556:
5557:
5558:
5559:
5560:
5561:
5562:
5563:
5564:
5565:
5566:
5567:
5568:
5569:
5570:
5571:
5572:
5573:
5574:
5575:
5576:
5577:
5578:
5579:
5580:
5581:
5582:
5583:
5584:
5585:
5586:
5587:
5588:
5589:
5590:
5591:
5592:
5593:
5594:
5595:
5596:
5597:
5598:
5599:
5600:
5601:
5602:
5603:
5604:
5605:
5606:
5607:
5608:
5609:
5610:
5611:
5612:
5613:
5614:
5615:
5616:
5617:
5618:
5619:
5620:
5621:
5622:
5623:
5624:
5625:
5626:
5627:
5628:
5629:
5630:
5631:
5632:
5633:
5634:
5635:
5636:
5637:
5638:
5639:
5640:
5641:
5642:
5643:
5644:
5645:
5646:
5647:
5648:
5649:
5650:
5651:
5652:
5653:
5654:
5655:
5656:
5657:
5658:
5659:
5660:
5661:
5662:
5663:
5664:
5665:
5666:
5667:
5668:
5669:
5670:
5671:
5672:
5673:
5674:
5675:
5676:
5677:
5678:
5679:
5680:
5681:
5682:
5683:
5684:
5685:
5686:
5687:
5688:
5689:
5690:
5691:
5692:
5693:
5694:
5695:
5696:
5697:
5698:
5699:
5700:
5701:
5702:
5703:
5704:
5705:
5706:
5707:
5708:
5709:
5710:
5711:
5712:
5713:
5714:
5715:
5716:
5717:
5718:
5719:
5720: public final EFP atan () {
5721: return this.atan (this);
5722: }
5723: public final EFP atan (EFP x) {
5724: int xf = x.flg;
5725: if (xf << 1 != 0) {
5726: if (xf << 2 >= 0) {
5727: this.flg = xf;
5728: } else {
5729: epbFpsr |= EPB_FPSR_X2;
5730: if (xf >= 0) {
5731: this.sete (ROUNDED_PI_2[epbRoundingMode]).finish ();
5732: } else {
5733: this.sete (ROUNDED_NEGPI_2[epbRoundingMode]).finish ();
5734: }
5735: }
5736: return this;
5737: }
5738:
5739: int xe = x.epp;
5740: if (xe <= -LEN / 2) {
5741: epbFpsr |= EPB_FPSR_X2;
5742: int savedFpsr = epbFpsr;
5743:
5744: this.flg = xf;
5745: this.epp = xe;
5746: this.dvl = x.dvl;
5747: this.cvl = x.cvl;
5748: if (this.flg < 0) {
5749: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
5750: this.nextup (epbRoundingPrec);
5751: }
5752: } else {
5753: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
5754: this.nextdown (epbRoundingPrec);
5755: }
5756: }
5757: return this.finish ().correctUnderflow (savedFpsr);
5758: }
5759: if (LEN + 1 <= xe) {
5760: epbFpsr |= EPB_FPSR_X2;
5761: return this.sete (ROUNDED_PI_2[epbRoundingMode]).neg (xf < 0);
5762: }
5763: if (false) {
5764: this.inner ();
5765: EFP u = new EFP ().iabs (x);
5766: EFP b;
5767: EFP bw;
5768: EFP t = new EFP ();
5769: if (u.le (DECSQRT2)) {
5770: b = null;
5771: bw = null;
5772: } else if (u.lt (INCSQRT2)) {
5773:
5774:
5775: u.div (t.negdec (u), u.inc ());
5776: b = PI_4;
5777: bw = PI_4A;
5778: } else {
5779: u.rcp ();
5780: b = PI_2;
5781: bw = PI_2A;
5782: }
5783: if (false) {
5784: EFP x2 = new EFP (u).isqu ();
5785:
5786: this.flg = P | Z;
5787: for (int k = 0; ; k++) {
5788: t.divi (u, 2 * k + 1);
5789: if ((k & 1) == 0) {
5790: t.iadd (this, t);
5791: } else {
5792: t.sub (this, t);
5793: }
5794: if (this.eq (t)) {
5795: break;
5796: }
5797:
5798: this.flg = t.flg;
5799: this.epp = t.epp;
5800: this.dvl = t.dvl;
5801: this.cvl = t.cvl;
5802: u.imul (x2);
5803: }
5804: } else {
5805: t.isqu (u);
5806: this.imul (ATAN_C39, t)
5807: .iadd (ATAN_C37).imul (t)
5808: .iadd (ATAN_C35).imul (t)
5809: .iadd (ATAN_C33).imul (t)
5810: .iadd (ATAN_C31).imul (t)
5811: .iadd (ATAN_C29).imul (t)
5812: .iadd (ATAN_C27).imul (t)
5813: .iadd (ATAN_C25).imul (t)
5814: .iadd (ATAN_C23).imul (t)
5815: .iadd (ATAN_C21).imul (t)
5816: .iadd (ATAN_C19).imul (t)
5817: .iadd (ATAN_C17).imul (t)
5818: .iadd (ATAN_C15).imul (t)
5819: .iadd (ATAN_C13).imul (t)
5820: .iadd (ATAN_C11).imul (t)
5821: .iadd (ATAN_C9).imul (t)
5822: .iadd (ATAN_C7).imul (t)
5823: .iadd (ATAN_C5).imul (t)
5824: .iadd (ATAN_C3).imul (t)
5825: .iadd (ATAN_C1).imul (u);
5826: }
5827: if (b != null) {
5828: this.negsub (b).iadd (bw);
5829: }
5830: return this.outer ().neg (xf < 0);
5831: } else {
5832: int savedFpsr = epbFpsr;
5833: this.inner ();
5834: if (this == x) {
5835: x = new EFP (x);
5836: }
5837:
5838:
5839: long s = Double.doubleToLongBits (Math.atan (Double.longBitsToDouble ((long) (1023 + x.epp) << 52 | x.dvl << 1 >>> 12)));
5840: EFP tt = new EFP (xf, (int) (s >>> 52) - 1023, MSB | s << 12 >>> 1, 0L);
5841:
5842: EFP xx = new EFP ().tan (tt);
5843:
5844:
5845: this.imul (x, xx).inc ().rcp ().imul (xx.negsub (x)).outer ().add (tt);
5846: return this.originUpperLower (x).correctUnderflow (savedFpsr);
5847: }
5848: }
5849:
5850:
5851:
5852:
5853:
5854:
5855:
5856:
5857:
5858:
5859:
5860:
5861:
5862:
5863:
5864:
5865:
5866:
5867:
5868:
5869:
5870:
5871:
5872: public final EFP atan2 (EFP x) {
5873: return this.atan2 (this, x);
5874: }
5875: public final EFP atan2 (EFP y, EFP x) {
5876: int yf = y.flg;
5877: int xf = x.flg;
5878: if ((yf | xf) << 1 != 0) {
5879: if ((yf | xf) << 3 < 0) {
5880: this.flg = N;
5881: } else if ((yf & xf) << 2 < 0) {
5882: epbFpsr |= EPB_FPSR_X2;
5883: this.sete (yf >= 0 ? xf >= 0 ? PI_4 : PI3_4 : xf >= 0 ? NEGPI_4 : NEGPI3_4).finish ();
5884: } else if (yf << 1 < 0 || xf << 2 < 0) {
5885: if (xf >= 0) {
5886: this.sete (yf >= 0 ? ZERO : NEGZERO);
5887: } else {
5888: epbFpsr |= EPB_FPSR_X2;
5889: if (yf >= 0) {
5890: this.sete (ROUNDED_PI[epbRoundingMode]).finish ();
5891: } else {
5892: this.sete (ROUNDED_NEGPI[epbRoundingMode]).finish ();
5893: }
5894: }
5895: } else {
5896: epbFpsr |= EPB_FPSR_X2;
5897: if (yf >= 0) {
5898: this.sete (ROUNDED_PI_2[epbRoundingMode]).finish ();
5899: } else {
5900: this.sete (ROUNDED_NEGPI_2[epbRoundingMode]).finish ();
5901: }
5902: }
5903: return this;
5904: }
5905:
5906: return (xf < 0 ?
5907: this.inner ().div (y, x).atan ().outer ().add (yf >= 0 ? PI : NEGPI) :
5908: this.inner ().div (y, x).outer ().atan ());
5909: }
5910:
5911:
5912:
5913:
5914:
5915:
5916:
5917:
5918:
5919:
5920:
5921:
5922:
5923:
5924:
5925:
5926:
5927:
5928:
5929:
5930:
5931:
5932:
5933:
5934:
5935:
5936:
5937:
5938:
5939:
5940:
5941:
5942:
5943:
5944:
5945:
5946:
5947:
5948:
5949:
5950:
5951:
5952:
5953:
5954:
5955:
5956:
5957:
5958:
5959:
5960:
5961:
5962:
5963:
5964:
5965:
5966:
5967:
5968:
5969:
5970:
5971:
5972:
5973:
5974:
5975:
5976:
5977:
5978:
5979:
5980:
5981:
5982:
5983:
5984:
5985:
5986:
5987:
5988:
5989:
5990:
5991:
5992:
5993:
5994:
5995:
5996:
5997:
5998:
5999:
6000:
6001:
6002:
6003:
6004:
6005:
6006:
6007:
6008:
6009:
6010:
6011:
6012:
6013:
6014:
6015:
6016:
6017:
6018:
6019:
6020:
6021:
6022:
6023:
6024:
6025:
6026:
6027:
6028:
6029:
6030:
6031:
6032:
6033:
6034:
6035:
6036:
6037:
6038:
6039:
6040:
6041:
6042:
6043:
6044:
6045:
6046:
6047:
6048:
6049:
6050:
6051:
6052:
6053:
6054:
6055:
6056:
6057:
6058:
6059:
6060:
6061:
6062:
6063:
6064:
6065:
6066:
6067:
6068:
6069:
6070:
6071:
6072:
6073:
6074:
6075:
6076:
6077:
6078:
6079:
6080:
6081:
6082:
6083:
6084:
6085:
6086:
6087:
6088:
6089:
6090:
6091:
6092:
6093:
6094:
6095:
6096:
6097:
6098:
6099:
6100:
6101:
6102:
6103:
6104:
6105:
6106:
6107:
6108:
6109:
6110:
6111:
6112:
6113:
6114:
6115:
6116:
6117:
6118:
6119:
6120:
6121:
6122:
6123:
6124:
6125:
6126:
6127:
6128:
6129:
6130:
6131:
6132:
6133:
6134:
6135:
6136:
6137:
6138:
6139:
6140:
6141:
6142:
6143:
6144:
6145:
6146:
6147:
6148:
6149:
6150:
6151:
6152:
6153:
6154:
6155:
6156:
6157:
6158:
6159:
6160:
6161:
6162:
6163:
6164:
6165:
6166:
6167:
6168:
6169:
6170:
6171:
6172:
6173:
6174:
6175:
6176:
6177:
6178:
6179:
6180:
6181:
6182:
6183:
6184:
6185:
6186:
6187:
6188:
6189:
6190:
6191:
6192:
6193:
6194:
6195:
6196: public final EFP atanh () {
6197: return this.atanh (this);
6198: }
6199: public final EFP atanh (EFP x) {
6200: int xf = x.flg;
6201: if (xf << 1 != 0) {
6202: if (xf << 2 < 0) {
6203: epbFpsr |= EPB_FPSR_OE;
6204: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
6205: epbExceptionOperandMantissa = 0x0000000000000000L;
6206: this.flg = N;
6207: } else {
6208: this.flg = xf;
6209: }
6210: return this;
6211: }
6212:
6213: int xe = x.epp;
6214: if (0 <= xe) {
6215: if (xe == 0 && x.dvl == MSB && x.cvl == 0L) {
6216: epbFpsr |= EPB_FPSR_DZ;
6217: epbExceptionOperandExponent = xf | 0x3fff << 16;
6218: epbExceptionOperandMantissa = 0x8000000000000000L;
6219: this.flg = xf | I;
6220: } else {
6221: epbFpsr |= EPB_FPSR_OE;
6222: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
6223: epbExceptionOperandMantissa = x.dvl;
6224: this.flg = N;
6225: }
6226: return this;
6227: }
6228:
6229: if (false) {
6230: if (x.epp < -4) {
6231: EFP x2 = new EFP ().inner ().isqu (x);
6232: return this.imul (ATANH_C19, x2)
6233: .iadd (ATANH_C17).imul (x2)
6234: .iadd (ATANH_C15).imul (x2)
6235: .iadd (ATANH_C13).imul (x2)
6236: .iadd (ATANH_C11).imul (x2)
6237: .iadd (ATANH_C9).imul (x2)
6238: .iadd (ATANH_C7).imul (x2)
6239: .iadd (ATANH_C5).imul (x2)
6240: .iadd (ATANH_C3).imul (x2)
6241: .iadd (ATANH_C1).outer ().mul (x);
6242: }
6243:
6244: this.inner ().iabs (x);
6245: EFP t = new EFP ().negdec (this);
6246: return this.inc ().div (t).log ().idiv2 ().outer ().neg (xf < 0);
6247: } else {
6248: int savedFpsr = epbFpsr;
6249: this.inner ();
6250: long xd = x.dvl;
6251: long xc = x.cvl;
6252: if (xe <= -3 && (xe < -3 || xd <= 0xafb0ccc06219b7baL)) {
6253: if (this == x) {
6254: x = new EFP (x);
6255: }
6256: EFP x2 = new EFP ().isqu (x);
6257:
6258:
6259:
6260:
6261:
6262:
6263:
6264:
6265:
6266:
6267:
6268:
6269:
6270:
6271:
6272: this.imul (ATH_C27, x2)
6273: .iadd (ATH_C25).imul (x2)
6274: .iadd (ATH_C23).imul (x2)
6275: .iadd (ATH_C21).imul (x2)
6276: .iadd (ATH_C19).imul (x2)
6277: .iadd (ATH_C17).imul (x2)
6278: .iadd (ATH_C15).imul (x2)
6279: .iadd (ATH_C13).imul (x2)
6280: .iadd (ATH_C11).imul (x2)
6281: .iadd (ATH_C9).imul (x2)
6282: .iadd (ATH_C7).imul (x2)
6283: .iadd (ATH_C5).imul (x2)
6284: .iadd (ATH_C3).imul (x2)
6285: .iadd (ATH_C1).outer ().mul (x);
6286: return this.originLowerUpper (x).correctUnderflow (savedFpsr);
6287: }
6288: EFP a = new EFP (P, xe, xd, xc);
6289: EFP t = new EFP ().negdec (a);
6290: int n = -t.epp;
6291: if (ATH_T[n].lt (a)) {
6292: n++;
6293: }
6294: EFP u = new EFP ().iadd (a.inc (), t.shl (n));
6295: t.negsub (a).div (u);
6296: a.isqu (t);
6297:
6298:
6299:
6300:
6301:
6302:
6303:
6304:
6305:
6306:
6307:
6308:
6309:
6310:
6311:
6312: return this.imul (ATH_C27, a)
6313: .iadd (ATH_C25).imul (a)
6314: .iadd (ATH_C23).imul (a)
6315: .iadd (ATH_C21).imul (a)
6316: .iadd (ATH_C19).imul (a)
6317: .iadd (ATH_C17).imul (a)
6318: .iadd (ATH_C15).imul (a)
6319: .iadd (ATH_C13).imul (a)
6320: .iadd (ATH_C11).imul (a)
6321: .iadd (ATH_C9).imul (a)
6322: .iadd (ATH_C7).imul (a)
6323: .iadd (ATH_C5).imul (a)
6324: .iadd (ATH_C3).imul (a)
6325: .iadd (ATH_C1).imul (t).iadd (t.muli (LOG_2_2, n)).outer ().neg (xf < 0);
6326: }
6327: }
6328:
6329:
6330:
6331:
6332:
6333:
6334:
6335:
6336:
6337:
6338:
6339:
6340:
6341:
6342:
6343:
6344:
6345:
6346:
6347:
6348:
6349:
6350:
6351:
6352:
6353:
6354:
6355:
6356:
6357:
6358:
6359:
6360:
6361:
6362:
6363:
6364:
6365:
6366:
6367:
6368:
6369:
6370:
6371:
6372:
6373:
6374:
6375:
6376:
6377:
6378:
6379:
6380:
6381:
6382:
6383:
6384:
6385:
6386:
6387:
6388:
6389:
6390:
6391:
6392:
6393:
6394:
6395: public final EFP cbrt () {
6396: return this.cbrt (this);
6397: }
6398: public final EFP cbrt (EFP x) {
6399: int xf = x.flg;
6400: if (xf << 1 != 0) {
6401: this.flg = xf;
6402: return this;
6403: }
6404:
6405: if (false) {
6406: this.inner ();
6407: EFP s = new EFP ().sgn (x);
6408: EFP a = new EFP ().iabs (x);
6409: EFP t = new EFP ().iadd (TWO, a).div3 ();
6410: EFP w = new EFP ();
6411: do {
6412:
6413: this.flg = t.flg;
6414: this.epp = t.epp;
6415: this.dvl = t.dvl;
6416: this.cvl = t.cvl;
6417: w.isqu (t).mul3 ();
6418: t.cub ().imul2 ().iadd (a).div (w);
6419: } while (this.gt (t));
6420: return this.outer ().mul (s);
6421: } else {
6422: this.inner ();
6423: int xe = x.epp;
6424: int xe3 = (int) (xe * 43691L >> 17);
6425: long s = Double.doubleToLongBits (Math.cbrt (Double.longBitsToDouble ((long) (1023 + (xe - xe3 * 3)) << 52 | x.dvl << 1 >>> 12)));
6426: EFP t = new EFP (P, (int) (s >>> 52) - 1023 + xe3, MSB | s << 12 >>> 1, 0L);
6427: EFP t2 = new EFP ().imul2 (t);
6428: t2.flg |= xf;
6429: return this.iadd (t2, t.isqu ().rcpdiv (x)).outer ().div3 ();
6430: }
6431: }
6432:
6433:
6434:
6435:
6436:
6437:
6438:
6439:
6440:
6441:
6442:
6443:
6444:
6445:
6446:
6447:
6448:
6449:
6450:
6451:
6452:
6453:
6454:
6455:
6456:
6457:
6458:
6459:
6460:
6461:
6462:
6463:
6464:
6465:
6466:
6467:
6468:
6469:
6470:
6471:
6472:
6473:
6474:
6475:
6476:
6477:
6478:
6479:
6480:
6481:
6482:
6483:
6484:
6485: public final EFP ceil () {
6486: return this.ceil (this);
6487: }
6488: public final EFP ceil (EFP x) {
6489: int xf = x.flg;
6490: if (xf << 1 != 0) {
6491: this.flg = xf;
6492: return this;
6493: }
6494:
6495: int xe = x.epp;
6496: if (xe < 0) {
6497: epbFpsr |= EPB_FPSR_X2;
6498: if (xf < 0) {
6499: this.flg = M | Z;
6500: } else {
6501: this.flg = P;
6502: this.epp = 0;
6503: this.dvl = MSB;
6504: this.cvl = 0L;
6505: }
6506: return this;
6507: }
6508:
6509: long xd = x.dvl;
6510: long xc = x.cvl;
6511: long m = MSB >> xe;
6512: if (xf < 0) {
6513: if (xe <= 63) {
6514: if ((xd & ~m | xc) != 0L) {
6515: epbFpsr |= EPB_FPSR_X2;
6516: xd &= m;
6517: xc = 0L;
6518: }
6519: } else if (xe <= LEN - 2) {
6520: if ((xc & ~m) != 0L) {
6521: epbFpsr |= EPB_FPSR_X2;
6522: xc &= m;
6523: }
6524: }
6525:
6526: } else {
6527: if (xe <= 63) {
6528: long t = xd;
6529: xd &= m;
6530: if (((t ^ xd) | xc) != 0L) {
6531: epbFpsr |= EPB_FPSR_X2;
6532: xd -= m;
6533: if (xd >= 0L) {
6534: xd = MSB;
6535: xe++;
6536: if ((short) xe != xe) {
6537: epbFpsr |= EPB_FPSR_OF;
6538: epbExceptionOperandExponent = xf;
6539: epbExceptionOperandMantissa = xd;
6540: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
6541: }
6542: }
6543: xc = 0L;
6544: }
6545:
6546: } else if (xe <= LEN - 2) {
6547: long t = xc;
6548: xc &= m;
6549: if ((t ^ xc) != 0L) {
6550: epbFpsr |= EPB_FPSR_X2;
6551: xc -= m;
6552: if ((t ^ xc) < 0L) {
6553: xd++;
6554: if (xd >= 0L) {
6555: xd = MSB;
6556: xe++;
6557: if ((short) xe != xe) {
6558: epbFpsr |= EPB_FPSR_OF;
6559: epbExceptionOperandExponent = xf;
6560: epbExceptionOperandMantissa = xd;
6561: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
6562: }
6563: }
6564: }
6565: }
6566: }
6567:
6568: }
6569: return this.finish (xf, xe, xd, xc, 0L);
6570: }
6571:
6572:
6573:
6574:
6575:
6576:
6577:
6578:
6579:
6580:
6581:
6582:
6583:
6584:
6585:
6586:
6587:
6588:
6589:
6590:
6591:
6592:
6593:
6594:
6595:
6596:
6597: public int cmp (EFP y) {
6598: int xf = this.flg;
6599: int yf = y.flg;
6600: if ((xf | yf) << 1 != 0) {
6601:
6602:
6603:
6604: return EFP_CMP_TABLE[xf >>> 28] << (yf >>> 28 - 1) >> 30;
6605: }
6606:
6607: if (xf != yf) {
6608: return xf >= 0 ? 1 : -1;
6609: }
6610:
6611: int s;
6612: long t;
6613: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
6614: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
6615: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
6616: 0);
6617: }
6618:
6619:
6620:
6621:
6622:
6623:
6624:
6625:
6626:
6627:
6628:
6629:
6630:
6631:
6632:
6633:
6634:
6635:
6636:
6637:
6638:
6639:
6640:
6641:
6642:
6643:
6644:
6645:
6646:
6647:
6648:
6649:
6650:
6651:
6652:
6653:
6654:
6655:
6656:
6657:
6658:
6659:
6660:
6661:
6662:
6663:
6664:
6665:
6666:
6667:
6668:
6669:
6670:
6671: public int cmp0 () {
6672: int xf = this.flg;
6673: return xf << 3 < 0 || xf << 1 < 0 ? 0 : xf >= 0 ? 1 : -1;
6674: }
6675:
6676:
6677:
6678:
6679:
6680:
6681:
6682:
6683:
6684:
6685:
6686:
6687:
6688:
6689:
6690:
6691:
6692:
6693:
6694:
6695:
6696:
6697:
6698:
6699:
6700:
6701:
6702:
6703:
6704:
6705:
6706:
6707:
6708:
6709:
6710:
6711:
6712:
6713:
6714:
6715:
6716:
6717:
6718:
6719:
6720:
6721:
6722:
6723:
6724:
6725:
6726:
6727:
6728: public int cmp1 () {
6729: int xf = this.flg;
6730: if (xf != 0) {
6731: return xf << 3 < 0 ? 0 : (xf | xf << 1) < 0 ? -1 : 1;
6732: }
6733:
6734: int xe = this.epp;
6735: return xe < 0 ? -1 : xe == 0 && this.dvl == MSB && this.cvl == 0L ? 0 : 1;
6736: }
6737:
6738:
6739:
6740:
6741:
6742:
6743:
6744:
6745:
6746:
6747:
6748:
6749:
6750:
6751:
6752:
6753:
6754:
6755:
6756:
6757:
6758:
6759:
6760:
6761:
6762:
6763:
6764:
6765:
6766:
6767:
6768:
6769:
6770:
6771:
6772:
6773:
6774:
6775:
6776:
6777:
6778:
6779:
6780:
6781:
6782:
6783:
6784:
6785:
6786:
6787:
6788:
6789:
6790: public int cmp1abs () {
6791: int xf = this.flg;
6792: if (xf << 1 != 0) {
6793: return xf << 3 < 0 ? 0 : xf << 1 < 0 ? -1 : 1;
6794: }
6795:
6796: int xe = this.epp;
6797: return xe < 0 ? -1 : xe == 0 && this.dvl == MSB && this.cvl == 0L ? 0 : 1;
6798: }
6799:
6800:
6801:
6802:
6803:
6804:
6805: public int cmpabs (EFP y) {
6806: int xf = this.flg & ~M;
6807: int yf = y.flg & ~M;
6808: if ((xf | yf) << 1 != 0) {
6809: return EFP_CMP_TABLE[xf >>> 28] << (yf >>> 28 - 1) >> 30;
6810: }
6811:
6812: int s;
6813: long t;
6814: return ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
6815: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
6816: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
6817: 0);
6818: }
6819:
6820:
6821:
6822:
6823:
6824:
6825:
6826:
6827:
6828:
6829:
6830: @Override public int compareTo (EFP y) {
6831: EFP x = this;
6832: int xf = x.flg;
6833: int yf = y.flg;
6834: if ((xf | yf) << 1 != 0) {
6835:
6836:
6837:
6838:
6839: return EFP_COMPARE_TABLE[xf >>> 28] << (yf >>> 28 - 1) >> 30;
6840: }
6841:
6842: if (xf != yf) {
6843: return xf >= 0 ? 1 : -1;
6844: }
6845:
6846: int s;
6847: long t;
6848: return (xf >= 0 ? 1 : -1) * ((s = x.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
6849: (t = x.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
6850: (t = (x.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
6851: 0);
6852: }
6853:
6854:
6855:
6856:
6857:
6858:
6859:
6860:
6861:
6862:
6863:
6864:
6865:
6866:
6867:
6868:
6869:
6870:
6871:
6872:
6873:
6874:
6875:
6876:
6877:
6878:
6879:
6880:
6881:
6882:
6883:
6884:
6885:
6886:
6887:
6888:
6889:
6890:
6891:
6892:
6893:
6894:
6895:
6896:
6897:
6898:
6899:
6900:
6901:
6902:
6903:
6904:
6905:
6906:
6907:
6908:
6909:
6910:
6911:
6912:
6913:
6914:
6915:
6916:
6917:
6918:
6919:
6920:
6921:
6922:
6923:
6924:
6925:
6926:
6927:
6928:
6929:
6930:
6931:
6932:
6933:
6934:
6935:
6936:
6937:
6938:
6939:
6940:
6941:
6942:
6943:
6944:
6945:
6946:
6947:
6948:
6949:
6950:
6951:
6952:
6953:
6954:
6955:
6956:
6957:
6958: public final EFP cos () {
6959: return this.cos (this);
6960: }
6961: public final EFP cos (EFP x) {
6962: int xf = x.flg;
6963: if (xf << 1 != 0) {
6964: if (xf << 1 < 0) {
6965: this.flg = P;
6966: this.epp = 0;
6967: this.dvl = MSB;
6968: this.cvl = 0L;
6969: } else if (xf << 2 < 0) {
6970: epbFpsr |= EPB_FPSR_OE;
6971: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
6972: epbExceptionOperandMantissa = 0x0000000000000000L;
6973: this.flg = N;
6974: } else {
6975: this.flg = N;
6976: }
6977: return this;
6978: }
6979:
6980: this.inner ();
6981: EFP u = new EFP ();
6982: EFP u2 = new EFP ();
6983: int k = u.ieeerempi2 (x);
6984: if (false) {
6985: EFP s = new EFP ();
6986: EFP t = new EFP ();
6987: u2.isqu (u);
6988: if ((k & 1) != 0) {
6989:
6990: s.flg = u.flg;
6991: s.epp = u.epp;
6992: s.dvl = u.dvl;
6993: s.cvl = u.cvl;
6994:
6995: t.flg = P | Z;
6996:
6997: this.flg = s.flg;
6998: this.epp = s.epp;
6999: this.dvl = s.dvl;
7000: this.cvl = s.cvl;
7001: for (int twok1 = 3; this.ne (t); twok1 += 2) {
7002: s.imul (u2).divi ((1 - twok1) * twok1);
7003:
7004: t.flg = this.flg;
7005: t.epp = this.epp;
7006: t.dvl = this.dvl;
7007: t.cvl = this.cvl;
7008: this.iadd (s);
7009: }
7010: } else {
7011:
7012: s.flg = P;
7013: s.epp = 0;
7014: s.dvl = MSB;
7015: s.cvl = 0L;
7016:
7017: t.flg = P | Z;
7018:
7019: this.flg = s.flg;
7020: this.epp = s.epp;
7021: this.dvl = s.dvl;
7022: this.cvl = s.cvl;
7023: for (int twok = 2; this.ne (t); twok += 2) {
7024: s.imul (u2).divi ((1 - twok) * twok);
7025:
7026: t.flg = this.flg;
7027: t.epp = this.epp;
7028: t.dvl = this.dvl;
7029: t.cvl = this.cvl;
7030: this.iadd (s);
7031: }
7032: }
7033: } else {
7034: if ((k & 1) != 0) {
7035: u2.isqu (u);
7036: this.imul (SIN_C21, u2)
7037: .iadd (SIN_C19).imul (u2)
7038: .iadd (SIN_C17).imul (u2)
7039: .iadd (SIN_C15).imul (u2)
7040: .iadd (SIN_C13).imul (u2)
7041: .iadd (SIN_C11).imul (u2)
7042: .iadd (SIN_C9).imul (u2)
7043: .iadd (SIN_C7).imul (u2)
7044: .iadd (SIN_C5).imul (u2)
7045: .iadd (SIN_C3).imul (u2)
7046: .iadd (SIN_C1).imul (u);
7047: } else {
7048: u2.isqu (u);
7049: this.imul (COS_C20, u2)
7050: .iadd (COS_C18).imul (u2)
7051: .iadd (COS_C16).imul (u2)
7052: .iadd (COS_C14).imul (u2)
7053: .iadd (COS_C12).imul (u2)
7054: .iadd (COS_C10).imul (u2)
7055: .iadd (COS_C8).imul (u2)
7056: .iadd (COS_C6).imul (u2)
7057: .iadd (COS_C4).imul (u2)
7058: .iadd (COS_C2).imul (u2)
7059: .iadd (COS_C0);
7060: }
7061: }
7062:
7063: this.outer ().neg (0b0110 << 28 << k < 0);
7064:
7065:
7066:
7067: if (this.flg << 1 == 0 && this.epp == 0) {
7068: if (this.flg < 0) {
7069: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
7070: this.sete (NEXTUP_MINUSONE[epbRoundingPrec]);
7071: }
7072: } else {
7073: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
7074: this.sete (NEXTDOWN_PLUSONE[epbRoundingPrec]);
7075: }
7076: }
7077: }
7078: return this;
7079: }
7080:
7081:
7082:
7083:
7084:
7085:
7086:
7087:
7088:
7089:
7090:
7091:
7092:
7093:
7094:
7095:
7096:
7097:
7098:
7099:
7100:
7101:
7102:
7103:
7104:
7105:
7106:
7107:
7108:
7109:
7110:
7111:
7112:
7113:
7114:
7115:
7116:
7117:
7118:
7119:
7120:
7121:
7122:
7123:
7124:
7125:
7126:
7127:
7128:
7129:
7130:
7131:
7132:
7133:
7134:
7135:
7136:
7137:
7138:
7139:
7140:
7141:
7142:
7143:
7144:
7145:
7146:
7147:
7148:
7149:
7150:
7151:
7152:
7153:
7154:
7155: public final EFP cosh () {
7156: return this.cosh (this);
7157: }
7158: public final EFP cosh (EFP x) {
7159: int xf = x.flg;
7160: if (xf << 1 != 0) {
7161: if (xf << 1 < 0) {
7162:
7163: this.flg = P;
7164: this.epp = 0;
7165: this.dvl = MSB;
7166: this.cvl = 0L;
7167: } else if (xf << 2 < 0) {
7168: this.flg = P | I;
7169: } else {
7170: this.flg = N;
7171: }
7172: return this;
7173: }
7174:
7175: epbFpsr |= EPB_FPSR_X2;
7176: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
7177: epbExceptionOperandMantissa = x.dvl;
7178: if (15 <= x.epp) {
7179: epbFpsr |= EPB_FPSR_OF;
7180: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
7181: }
7182: if (x.epp < -3) {
7183: EFP x2 = new EFP ().inner ().isqu (x);
7184: return this.imul (COSH_C14, x2)
7185: .iadd (COSH_C12).imul (x2)
7186: .iadd (COSH_C10).imul (x2)
7187: .iadd (COSH_C8).imul (x2)
7188: .iadd (COSH_C6).imul (x2)
7189: .iadd (COSH_C4).imul (x2)
7190: .iadd (COSH_C2).imul (x2)
7191: .outer ().add (COSH_C0);
7192: }
7193:
7194:
7195:
7196: this.inner ().abs (x).exp ();
7197: this.iadd (new EFP ().rcp (this)).outer ().div2 ();
7198: if (this.flg << 2 < 0) {
7199: epbFpsr |= EPB_FPSR_OF;
7200: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | this.flg >>> 31]).finish ();
7201: }
7202: return this;
7203: }
7204:
7205:
7206:
7207:
7208:
7209:
7210:
7211:
7212:
7213:
7214:
7215:
7216:
7217:
7218:
7219:
7220:
7221:
7222:
7223:
7224:
7225:
7226:
7227:
7228:
7229:
7230:
7231:
7232:
7233:
7234:
7235:
7236:
7237:
7238:
7239:
7240:
7241:
7242:
7243:
7244:
7245:
7246:
7247:
7248:
7249:
7250:
7251:
7252:
7253:
7254:
7255:
7256:
7257:
7258:
7259:
7260:
7261:
7262:
7263:
7264:
7265:
7266:
7267:
7268:
7269: public final EFP cot () {
7270: return this.cot (this);
7271: }
7272: public final EFP cot (EFP x) {
7273: int xf = x.flg;
7274: if (xf << 1 != 0) {
7275: if (xf << 1 < 0) {
7276: epbFpsr |= EPB_FPSR_OE;
7277: epbExceptionOperandExponent = xf & M;
7278: epbExceptionOperandMantissa = 0x0000000000000000L;
7279: this.flg = N;
7280: } else if (xf << 2 < 0) {
7281: epbFpsr |= EPB_FPSR_OE;
7282: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
7283: epbExceptionOperandMantissa = 0x0000000000000000L;
7284: this.flg = N;
7285: } else {
7286: this.flg = N;
7287: }
7288: return this;
7289: }
7290:
7291: if (false) {
7292: EFP s = new EFP ().inner ().sin (x);
7293: return this.cos (x).outer ().div (s);
7294: } else if (false) {
7295: return this.inner ().sub (PI_2, x).iadd (PI_2A).outer ().tan ();
7296: } else if (false) {
7297: return this.inner ().tan (x).outer ().rcp ();
7298: } else {
7299: if (15 <= x.epp) {
7300: EFP s = new EFP ().inner ().sin (x);
7301: return this.cos (x).outer ().div (s);
7302: }
7303: this.inner ();
7304: EFP s = new EFP ();
7305: EFP t = new EFP ();
7306: EFP u = new EFP ().iabs (x);
7307: EFP u2 = new EFP ();
7308: s.iadd (u, TAN7_X).imul (TAN7_Y).trunc ();
7309:
7310: u.sub (t.imulw (u2, s, TAN7_Z)).sub (u2).sub (t.imul (s, TAN7_ZA));
7311: int k = s.geti () & 127;
7312: u2.isqu (u);
7313: this.imul (TAN7_C11, u2)
7314: .iadd (TAN7_C9).imul (u2)
7315: .iadd (TAN7_C7).imul (u2)
7316: .iadd (TAN7_C5).imul (u2)
7317: .iadd (TAN7_C3).imul (u2)
7318: .iadd (TAN7_C1).imul (u);
7319: if (k == 0) {
7320: this.rcp ();
7321: } else if (k <= 63) {
7322: t = TAN7_T[k];
7323: s.iadd (this, t);
7324: this.imul (t).negdec ().div (s);
7325: } else if (k == 64) {
7326: this.ineg ();
7327: } else {
7328: t = TAN7_T[128 - k];
7329: s.sub (this, t);
7330: this.imul (t).inc ().div (s);
7331: }
7332: return this.outer ().neg (xf < 0);
7333: }
7334: }
7335:
7336:
7337:
7338:
7339:
7340:
7341:
7342:
7343:
7344:
7345:
7346:
7347:
7348:
7349:
7350:
7351:
7352:
7353:
7354:
7355:
7356:
7357:
7358:
7359:
7360:
7361:
7362:
7363:
7364:
7365:
7366:
7367:
7368:
7369:
7370:
7371:
7372:
7373:
7374:
7375:
7376:
7377:
7378:
7379:
7380:
7381:
7382:
7383:
7384:
7385:
7386:
7387:
7388:
7389:
7390:
7391:
7392:
7393:
7394:
7395:
7396:
7397:
7398:
7399:
7400:
7401:
7402:
7403:
7404:
7405:
7406:
7407:
7408:
7409:
7410:
7411:
7412:
7413:
7414:
7415:
7416:
7417:
7418:
7419:
7420:
7421:
7422: public final EFP coth () {
7423: return this.coth (this);
7424: }
7425: public final EFP coth (EFP x) {
7426: int xf = x.flg;
7427: if (xf << 1 != 0) {
7428: if (xf << 1 < 0) {
7429: epbFpsr |= EPB_FPSR_OE;
7430: epbExceptionOperandExponent = xf & M;
7431: epbExceptionOperandMantissa = 0x0000000000000000L;
7432: this.flg = N;
7433: } else if (xf << 2 < 0) {
7434: this.flg = xf & M;
7435: this.epp = 0;
7436: this.dvl = MSB;
7437: this.cvl = 0L;
7438: } else {
7439: this.flg = N;
7440: }
7441: return this;
7442: }
7443:
7444:
7445: int xe = x.epp;
7446: if (xe < -2) {
7447: EFP x2 = new EFP ().inner ().isqu (x);
7448: return this.imul (TANH_C27, x2)
7449: .iadd (TANH_C25).imul (x2)
7450: .iadd (TANH_C23).imul (x2)
7451: .iadd (TANH_C21).imul (x2)
7452: .iadd (TANH_C19).imul (x2)
7453: .iadd (TANH_C17).imul (x2)
7454: .iadd (TANH_C15).imul (x2)
7455: .iadd (TANH_C13).imul (x2)
7456: .iadd (TANH_C11).imul (x2)
7457: .iadd (TANH_C9).imul (x2)
7458: .iadd (TANH_C7).imul (x2)
7459: .iadd (TANH_C5).imul (x2)
7460: .iadd (TANH_C3).imul (x2)
7461: .iadd (TANH_C1).imul (x).outer ().rcp ();
7462: }
7463:
7464: if (false) {
7465: EFP s = new EFP ().inner ().sinh (x);
7466: return this.cosh (x).outer ().div (s);
7467: } else if (EFP_COTH_EPP_MAX < xe) {
7468: this.flg = xf & M;
7469: this.epp = 0;
7470: this.dvl = MSB;
7471: this.cvl = 0L;
7472: return this;
7473: } else {
7474: EFP t = new EFP ().inner ().imul2 (x).exp ();
7475: return this.inc (t).outer ().div (t.dec ());
7476: }
7477: }
7478:
7479:
7480:
7481:
7482:
7483:
7484:
7485:
7486:
7487:
7488:
7489:
7490:
7491:
7492:
7493:
7494:
7495:
7496:
7497:
7498:
7499:
7500:
7501:
7502:
7503:
7504:
7505:
7506:
7507:
7508:
7509:
7510:
7511:
7512:
7513:
7514:
7515:
7516:
7517:
7518:
7519:
7520:
7521:
7522:
7523:
7524:
7525:
7526:
7527:
7528:
7529:
7530:
7531:
7532:
7533:
7534:
7535:
7536:
7537:
7538:
7539:
7540:
7541:
7542: public final EFP csc () {
7543: return this.csc (this);
7544: }
7545: public final EFP csc (EFP x) {
7546: return this.inner ().sin (x).outer ().rcp ();
7547: }
7548:
7549:
7550:
7551:
7552:
7553:
7554:
7555:
7556:
7557:
7558:
7559:
7560:
7561:
7562:
7563:
7564:
7565:
7566:
7567:
7568:
7569:
7570:
7571:
7572:
7573:
7574:
7575:
7576:
7577:
7578:
7579:
7580:
7581:
7582:
7583:
7584:
7585:
7586:
7587:
7588:
7589:
7590:
7591:
7592:
7593:
7594:
7595:
7596:
7597:
7598:
7599:
7600:
7601:
7602:
7603:
7604:
7605:
7606:
7607:
7608:
7609:
7610:
7611:
7612:
7613:
7614:
7615:
7616: public final EFP csch () {
7617: return this.csch (this);
7618: }
7619: public final EFP csch (EFP x) {
7620: int xf = x.flg;
7621: if (xf << 1 != 0) {
7622: if (xf << 1 < 0) {
7623: epbFpsr |= EPB_FPSR_OE;
7624: epbExceptionOperandExponent = xf & M;
7625: epbExceptionOperandMantissa = 0x0000000000000000L;
7626: this.flg = N;
7627: } else {
7628: this.flg = xf << 2 < 0 ? xf ^ (Z | I) : N;
7629: }
7630: return this;
7631: }
7632:
7633: if (true) {
7634: return this.inner ().sinh (x).outer ().rcp ();
7635: } else if (false) {
7636: this.inner ().exp (x);
7637: return this.sub (new EFP ().rcp (this)).outer ().rcp ().outer ().mul2 ();
7638: } else {
7639: return this.sub (new EFP ().inner ().exp (x), new EFP ().ineg (x).exp ()).rcp ().outer ().mul2 ();
7640: }
7641: }
7642:
7643:
7644:
7645:
7646:
7647:
7648:
7649:
7650:
7651:
7652:
7653:
7654:
7655:
7656:
7657:
7658:
7659:
7660:
7661:
7662:
7663:
7664:
7665:
7666:
7667:
7668:
7669:
7670:
7671:
7672:
7673:
7674:
7675:
7676:
7677:
7678:
7679:
7680:
7681:
7682:
7683:
7684:
7685:
7686:
7687:
7688:
7689:
7690:
7691:
7692:
7693:
7694:
7695:
7696:
7697:
7698:
7699:
7700:
7701:
7702:
7703: public final EFP cub () {
7704: return this.mul (new EFP ().isqu (this));
7705: }
7706: public final EFP cub (EFP x) {
7707: return this.mul (x, new EFP ().isqu (x));
7708: }
7709:
7710:
7711:
7712:
7713:
7714:
7715:
7716:
7717:
7718:
7719:
7720:
7721:
7722:
7723:
7724:
7725:
7726:
7727:
7728:
7729:
7730:
7731:
7732:
7733:
7734:
7735:
7736:
7737:
7738:
7739:
7740:
7741:
7742:
7743:
7744:
7745:
7746:
7747:
7748:
7749:
7750:
7751:
7752:
7753:
7754:
7755:
7756:
7757:
7758:
7759:
7760:
7761:
7762: public final EFP dec () {
7763: return this.dec (this);
7764: }
7765: public final EFP dec (EFP x) {
7766:
7767:
7768: int xf = x.flg;
7769: if (xf << 1 != 0) {
7770: if (xf << 1 < 0) {
7771: this.flg = M;
7772: this.epp = 0;
7773: this.dvl = MSB;
7774: this.cvl = 0L;
7775: } else {
7776: this.flg = xf;
7777: }
7778: return this;
7779: }
7780:
7781: int xe = x.epp;
7782: if (xe < -LEN) {
7783:
7784: epbFpsr |= EPB_FPSR_X2;
7785: this.flg = M;
7786: this.epp = 0;
7787: this.dvl = MSB;
7788: this.cvl = 0L;
7789: return this;
7790: }
7791: long xd = x.dvl;
7792: long xc = x.cvl;
7793: if (LEN < xe) {
7794:
7795: epbFpsr |= EPB_FPSR_X2;
7796: return this.finish (xf, xe, xd, xc, 0L);
7797: }
7798: long xb = 0L;
7799: if (xe == 0) {
7800:
7801: if (xf < 0) {
7802:
7803: xb = xc << -1;
7804: xc = xd << -1 | xc >>> 1;
7805: xd = (xd >>> 1) + (MSB >>> 1);
7806: xe++;
7807: } else {
7808:
7809: xd -= MSB;
7810: }
7811: } else if (0 < xe) {
7812:
7813: if (xf < 0) {
7814:
7815: if (xe <= 63) {
7816: if ((xd += MSB >>> xe) >>> ~xe == 0L) {
7817: xb = xc << -1;
7818: xc = xd << -1 | xc >>> 1;
7819: xd = MSB | xd >>> 1;
7820: xe++;
7821: }
7822: } else {
7823: if ((xc += MSB >>> xe) >>> ~xe == 0L && ++xd == 0L) {
7824: xb = xc << -1;
7825: xc = xc >>> 1;
7826: xd = MSB;
7827: xe++;
7828: }
7829: }
7830: } else {
7831:
7832: if (xe <= 63) {
7833: xd -= MSB >>> xe;
7834: } else {
7835: if (xc >>> ~xe != 0L) {
7836: xc -= MSB >>> xe;
7837: } else {
7838: xc |= MSB >> xe;
7839: xd--;
7840: }
7841: }
7842: }
7843: } else {
7844:
7845: if (-63 <= xe) {
7846: xb = xc << xe;
7847: xc = xd << xe | xc >>> -xe;
7848: xd >>>= -xe;
7849: } else if (-64 == xe) {
7850: xb = xc;
7851: xc = xd;
7852: xd = 0L;
7853: } else {
7854: xb = xd << xe | xc >>> -xe;
7855: xc = xd >>> -xe;
7856: xd = 0L;
7857: }
7858: xe = 0;
7859: if (xf < 0) {
7860:
7861: xd |= MSB;
7862: } else {
7863:
7864: if (xb != 0L) {
7865: xb = -xb;
7866: xc = -1L - xc;
7867: xd = MSB - 1L - xd;
7868: } else if (xc != 0L) {
7869: xc = -xc;
7870: xd = MSB - 1L - xd;
7871: } else {
7872: xd = MSB - xd;
7873: }
7874: xf ^= M;
7875: }
7876: }
7877:
7878: if (xd >= 0L) {
7879: if (xd != 0L) {
7880: int o = Long.numberOfLeadingZeros (xd);
7881: xe -= o;
7882: xd = xd << o | xc >>> -o;
7883: xc = xc << o | xb >>> -o;
7884: xb <<= o;
7885: } else if (xc < 0L) {
7886: xe -= 64;
7887: xd = xc;
7888: xc = xb;
7889: xb = 0L;
7890: } else if (xc != 0L) {
7891: int o = 64 + Long.numberOfLeadingZeros (xc);
7892: xe -= o;
7893: xd = xc << o | xb >>> -o;
7894: xc = xb << o;
7895: xb = 0L;
7896: } else if (xb < 0L) {
7897: xe -= 128;
7898: xd = xb;
7899: xc = 0L;
7900: xb = 0L;
7901: } else if (xb != 0L) {
7902: int o = 128 + Long.numberOfLeadingZeros (xb);
7903: xe -= o;
7904: xd = xb << o;
7905: xc = 0L;
7906: xb = 0L;
7907: } else {
7908: this.flg = P | Z;
7909: return this;
7910: }
7911: }
7912: return this.finish (xf, xe, xd, xc, xb);
7913: }
7914:
7915:
7916:
7917:
7918:
7919:
7920:
7921:
7922:
7923:
7924:
7925:
7926:
7927:
7928:
7929:
7930:
7931:
7932:
7933:
7934:
7935:
7936:
7937:
7938:
7939:
7940:
7941:
7942:
7943:
7944:
7945:
7946:
7947:
7948:
7949:
7950:
7951:
7952:
7953:
7954:
7955:
7956:
7957:
7958:
7959:
7960:
7961:
7962:
7963:
7964:
7965:
7966:
7967:
7968:
7969:
7970:
7971:
7972:
7973: public final EFP deg () {
7974: return this.deg (this);
7975: }
7976: public final EFP deg (EFP x) {
7977: return this.mul (x, TO_DEG);
7978: }
7979:
7980:
7981:
7982:
7983:
7984:
7985:
7986:
7987:
7988:
7989:
7990: public final EFP div (EFP y) {
7991: return this.div (this, y);
7992: }
7993: public final EFP div (EFP x, EFP y) {
7994: int xf = x.flg;
7995: int yf = y.flg;
7996: if ((xf | yf) << 1 != 0) {
7997: if ((xf | yf) << 3 != 0) {
7998: this.flg = N;
7999: } else if ((xf & yf & (Z | I)) != 0) {
8000: epbFpsr |= EPB_FPSR_OE;
8001: if (yf << 1 < 0) {
8002: epbExceptionOperandExponent = yf & M;
8003: epbExceptionOperandMantissa = 0x0000000000000000L;
8004: } else {
8005: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
8006: epbExceptionOperandMantissa = 0x0000000000000000L;
8007: }
8008: this.flg = N;
8009: } else if (xf << 1 == 0 && yf << 1 < 0) {
8010: epbFpsr |= EPB_FPSR_DZ;
8011: epbExceptionOperandExponent = yf & M;
8012: epbExceptionOperandMantissa = 0x0000000000000000L;
8013: this.flg = (xf ^ yf) & M | I;
8014: } else {
8015: this.flg = (xf ^ yf) & M | ((xf & Z | yf & I) != 0 ? Z : I);
8016: }
8017: return this;
8018: }
8019:
8020: long r01 = x.dvl;
8021: long y01 = y.dvl;
8022: long r2 = (r01 << -2 | x.cvl >>> 2) >>> 33;
8023: long y2 = (y01 << -2 | y.cvl >>> 2) >>> 33;
8024: r01 >>>= 2;
8025: y01 >>>= 2;
8026: long y0 = y01 >>> 31;
8027: long y1 = y01 & 0x7fffffffL;
8028:
8029: boolean qq;
8030: if (r01 < y01 || (r01 == y01 && r2 < y2)) {
8031: qq = false;
8032: } else {
8033: qq = true;
8034: r2 -= y2;
8035: r01 -= y01;
8036: if (r2 < 0L) {
8037: r2 += 0x80000000L;
8038: r01--;
8039: }
8040: }
8041:
8042: long q0 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
8043: r01 = (r01 - q0 * y0 << 31) + r2 - q0 * y1;
8044: if (r01 < 0L) {
8045: q0--;
8046: r01 += y01;
8047: }
8048: r2 = q0 * y2 + 0x7fffffffL;
8049: r01 -= r2 >> 31;
8050: r2 = ~r2 & 0x7fffffffL;
8051: if (r01 < 0L) {
8052: q0--;
8053: r2 += y2;
8054: r01 += y01 + (r2 >> 31);
8055: r2 &= 0x7fffffffL;
8056: }
8057:
8058: long q1 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
8059: r01 = (r01 - q1 * y0 << 31) + r2 - q1 * y1;
8060: if (r01 < 0L) {
8061: q1--;
8062: r01 += y01;
8063: }
8064: r2 = q1 * y2 + 0x7fffffffL;
8065: r01 -= r2 >> 31;
8066: r2 = ~r2 & 0x7fffffffL;
8067: if (r01 < 0L) {
8068: q1--;
8069: r2 += y2;
8070: r01 += y01 + (r2 >> 31);
8071: r2 &= 0x7fffffffL;
8072: }
8073:
8074: long q2 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
8075: r01 = (r01 - q2 * y0 << 31) + r2 - q2 * y1;
8076: if (r01 < 0L) {
8077: q2--;
8078: r01 += y01;
8079: }
8080: r2 = q2 * y2 + 0x7fffffffL;
8081: r01 -= r2 >> 31;
8082: r2 = ~r2 & 0x7fffffffL;
8083: if (r01 < 0L) {
8084: q2--;
8085: r2 += y2;
8086: r01 += y01 + (r2 >> 31);
8087: r2 &= 0x7fffffffL;
8088: }
8089:
8090:
8091:
8092: int ze = x.epp - y.epp;
8093: if (qq) {
8094: q0 = MSB | q0 << 32 | q1 << 1 | q2 >>> 30;
8095: q2 <<= -30;
8096: } else {
8097: ze--;
8098: q0 = q0 << -31 | q1 << 2 | q2 >>> 29;
8099: q2 <<= -29;
8100: }
8101: return this.finish2 (xf ^ yf, ze, q0, q2, r01 | r2);
8102: }
8103:
8104:
8105:
8106:
8107:
8108:
8109:
8110:
8111:
8112:
8113:
8114:
8115:
8116:
8117:
8118:
8119:
8120:
8121:
8122:
8123:
8124:
8125:
8126:
8127:
8128:
8129:
8130:
8131:
8132:
8133:
8134:
8135:
8136:
8137:
8138:
8139:
8140:
8141:
8142:
8143:
8144:
8145:
8146:
8147:
8148:
8149:
8150:
8151:
8152:
8153:
8154:
8155:
8156:
8157:
8158:
8159:
8160:
8161:
8162: public final EFP div2 () {
8163: return this.finish (this.flg, this.epp - 1, this.dvl, this.cvl, 0L);
8164: }
8165: public final EFP idiv2 () {
8166: this.epp--;
8167: return this;
8168: }
8169: public final EFP div2 (EFP x) {
8170: return this.finish (x.flg, x.epp - 1, x.dvl, x.cvl, 0L);
8171: }
8172: public final EFP idiv2 (EFP x) {
8173: this.flg = x.flg;
8174: this.epp = x.epp - 1;
8175: this.dvl = x.dvl;
8176: this.cvl = x.cvl;
8177: return this;
8178: }
8179:
8180:
8181:
8182:
8183:
8184:
8185:
8186:
8187:
8188:
8189:
8190:
8191:
8192:
8193:
8194:
8195:
8196:
8197:
8198:
8199:
8200:
8201:
8202:
8203:
8204:
8205:
8206:
8207:
8208:
8209:
8210:
8211:
8212:
8213:
8214:
8215:
8216:
8217:
8218:
8219:
8220:
8221:
8222:
8223:
8224:
8225:
8226:
8227:
8228:
8229:
8230:
8231:
8232:
8233:
8234:
8235:
8236:
8237:
8238: public final EFP div3 () {
8239: return this.div3 (this);
8240: }
8241: public final EFP div3 (EFP x) {
8242:
8243: int xf = x.flg;
8244: if (xf << 1 != 0) {
8245: this.flg = xf;
8246: return this;
8247: }
8248:
8249:
8250: int ze = x.epp;
8251: long zc = x.dvl;
8252: long zb = x.cvl;
8253: zb = (zc << -1 | zb >>> 1) >>> 3;
8254: zc >>>= 1;
8255: long zd = zc / 3L;
8256: zb |= zc - zd * 3L << -3;
8257: zc = zb / 3L;
8258: zb -= zc * 3L;
8259: zc <<= 3;
8260:
8261: if (zd << 2 < 0L) {
8262: ze--;
8263: zd = zd << 2 | zc >>> -2;
8264: zc <<= 2;
8265: } else {
8266: ze -= 2;
8267: zd = zd << 3 | zc >>> -3;
8268: zc <<= 3;
8269: }
8270: return this.finish (xf, ze, zd, zc, zb);
8271: }
8272:
8273:
8274:
8275:
8276:
8277:
8278:
8279:
8280: public final EFP divi (int n) {
8281: return this.divi (this, n);
8282: }
8283: public final EFP divi (EFP x, int n) {
8284:
8285: int xf = x.flg;
8286: if (n == 0) {
8287: if (xf << 1 != 0) {
8288: if (xf << 1 < 0) {
8289: epbFpsr |= EPB_FPSR_OE;
8290: epbExceptionOperandExponent = P;
8291: epbExceptionOperandMantissa = 0x0000000000000000L;
8292: this.flg = N;
8293: } else {
8294: this.flg = xf;
8295: }
8296: } else {
8297: epbFpsr |= EPB_FPSR_DZ;
8298: epbExceptionOperandExponent = P;
8299: epbExceptionOperandMantissa = 0x0000000000000000L;
8300: this.flg = (xf & M) | I;
8301: }
8302: return this;
8303: }
8304: if (xf << 1 != 0) {
8305: this.flg = xf << 3 < 0 ? N : xf ^ (n & M);
8306: return this;
8307: }
8308:
8309: int ze = x.epp;
8310: long zd = x.dvl;
8311: long zc = x.cvl;
8312: long zb = 0L;
8313: if (n < 0) {
8314: xf ^= M;
8315:
8316: if (n == 0x80000000) {
8317: ze -= 31;
8318: if ((short) ze != ze) {
8319: epbFpsr |= EPB_FPSR_UF;
8320: epbExceptionOperandExponent = xf;
8321: epbExceptionOperandMantissa = zd;
8322: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
8323: }
8324: this.flg = xf;
8325: this.epp = ze;
8326: this.dvl = zd;
8327: this.cvl = zc;
8328: return this;
8329: }
8330: n = -n;
8331: }
8332: if (n != 1) {
8333: long y = (long) n;
8334: if (n >>> 16 == 0) {
8335:
8336: zb = (zd << -1 | zc >>> 1) >>> 17;
8337: zc = zd >>> 1;
8338: zd = zc / y;
8339: zb |= zc - zd * y << 47;
8340: zc = zb / y;
8341: zb -= zc * y;
8342: zc <<= 17;
8343: } else {
8344:
8345: zb = (zd << -1 | zc >>> 1) >>> 33;
8346: zc = zd >>> 1;
8347: zd = zc / y;
8348: zb |= zc - zd * y << 31;
8349: zc = zb / y;
8350: zb = zb - zc * y << 31;
8351: long t = zb / y;
8352: zc = (zc << 31 | t) << 2;
8353: zb -= t * y;
8354: }
8355:
8356: int o = Long.numberOfLeadingZeros (zd);
8357: ze -= o - 1;
8358: zd = zd << o | zc >>> -o;
8359: zc <<= o;
8360: }
8361: return this.finish (xf, ze, zd, zc, zb);
8362: }
8363:
8364:
8365:
8366:
8367:
8368:
8369:
8370:
8371:
8372:
8373:
8374:
8375:
8376:
8377:
8378:
8379:
8380:
8381:
8382:
8383:
8384:
8385:
8386:
8387:
8388:
8389:
8390:
8391:
8392:
8393:
8394:
8395:
8396:
8397:
8398:
8399:
8400:
8401:
8402:
8403:
8404:
8405:
8406:
8407:
8408:
8409:
8410:
8411:
8412:
8413:
8414:
8415:
8416:
8417:
8418:
8419:
8420:
8421:
8422: public final EFP divpi () {
8423: return this.mul (this, ONE_PI);
8424: }
8425: public final EFP divpi (EFP x) {
8426: return this.mul (x, ONE_PI);
8427: }
8428:
8429:
8430:
8431:
8432:
8433:
8434:
8435:
8436: public final EFP divrz (EFP y) {
8437: return this.divrz (this, y);
8438: }
8439: public final EFP divrz (EFP x, EFP y) {
8440: int xf = x.flg;
8441: int yf = y.flg;
8442: if ((xf | yf) << 1 != 0) {
8443: if ((xf | yf) << 3 != 0) {
8444: this.flg = N;
8445: } else if ((xf & yf & (Z | I)) != 0) {
8446: epbFpsr |= EPB_FPSR_OE;
8447: if (yf << 1 < 0) {
8448: epbExceptionOperandExponent = yf & M;
8449: epbExceptionOperandMantissa = 0x0000000000000000L;
8450: } else {
8451: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
8452: epbExceptionOperandMantissa = 0x0000000000000000L;
8453: }
8454: this.flg = N;
8455: } else if (xf << 1 == 0 && yf << 1 < 0) {
8456: epbFpsr |= EPB_FPSR_DZ;
8457: epbExceptionOperandExponent = yf & M;
8458: epbExceptionOperandMantissa = 0x0000000000000000L;
8459: this.flg = (xf ^ yf) & M | I;
8460: } else {
8461: this.flg = (xf ^ yf) & M | ((xf & Z | yf & I) != 0 ? Z : I);
8462: }
8463: return this;
8464: }
8465:
8466: long r01 = x.dvl;
8467: long y01 = y.dvl;
8468: long r2 = (r01 << -2 | x.cvl >>> 2) >>> 33;
8469: long y2 = (y01 << -2 | y.cvl >>> 2) >>> 33;
8470: r01 >>>= 2;
8471: y01 >>>= 2;
8472: long y0 = y01 >>> 31;
8473: long y1 = y01 & 0x7fffffffL;
8474:
8475: boolean qq;
8476: if (r01 < y01 || (r01 == y01 && r2 < y2)) {
8477: qq = false;
8478: } else {
8479: qq = true;
8480: r2 -= y2;
8481: r01 -= y01;
8482: if (r2 < 0L) {
8483: r2 += 0x80000000L;
8484: r01--;
8485: }
8486: }
8487:
8488: long q0 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
8489: r01 = (r01 - q0 * y0 << 31) + r2 - q0 * y1;
8490: if (r01 < 0L) {
8491: q0--;
8492: r01 += y01;
8493: }
8494: r2 = q0 * y2 + 0x7fffffffL;
8495: r01 -= r2 >> 31;
8496: r2 = ~r2 & 0x7fffffffL;
8497: if (r01 < 0L) {
8498: q0--;
8499: r2 += y2;
8500: r01 += y01 + (r2 >> 31);
8501: r2 &= 0x7fffffffL;
8502: }
8503:
8504: long q1 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
8505: r01 = (r01 - q1 * y0 << 31) + r2 - q1 * y1;
8506: if (r01 < 0L) {
8507: q1--;
8508: r01 += y01;
8509: }
8510: r2 = q1 * y2 + 0x7fffffffL;
8511: r01 -= r2 >> 31;
8512: r2 = ~r2 & 0x7fffffffL;
8513: if (r01 < 0L) {
8514: q1--;
8515: r2 += y2;
8516: r01 += y01 + (r2 >> 31);
8517: r2 &= 0x7fffffffL;
8518: }
8519:
8520: long q2 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
8521: r01 = (r01 - q2 * y0 << 31) + r2 - q2 * y1;
8522: if (r01 < 0L) {
8523: q2--;
8524: r01 += y01;
8525: }
8526: r2 = q2 * y2 + 0x7fffffffL;
8527: r01 -= r2 >> 31;
8528: r2 = ~r2 & 0x7fffffffL;
8529: if (r01 < 0L) {
8530: q2--;
8531: r2 += y2;
8532: r01 += y01 + (r2 >> 31);
8533: r2 &= 0x7fffffffL;
8534: }
8535:
8536:
8537:
8538: int ze = x.epp - y.epp;
8539: if (qq) {
8540: q0 = MSB | q0 << 32 | q1 << 1 | q2 >>> 30;
8541: q2 <<= -30;
8542: } else {
8543: ze--;
8544: q0 = q0 << -31 | q1 << 2 | q2 >>> 29;
8545: q2 <<= -29;
8546: }
8547: return this.finish (xf ^ yf, ze, q0, q2, r01 | r2);
8548: }
8549:
8550:
8551:
8552:
8553:
8554:
8555:
8556:
8557:
8558:
8559:
8560: public boolean eq (EFP y) {
8561: int xf = this.flg;
8562: int yf = y.flg;
8563: return ((xf | yf) << 1 != 0 ?
8564: EFP_EQ_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0
8565: :
8566: xf == yf && this.epp == y.epp && this.dvl == y.dvl && this.cvl == y.cvl);
8567: }
8568:
8569:
8570:
8571:
8572:
8573:
8574:
8575:
8576:
8577:
8578:
8579:
8580: @Override public boolean equals (Object yo) {
8581: if (yo instanceof EFP) {
8582: EFP x = this;
8583: EFP y = (EFP) yo;
8584: return (x.flg == y.flg &&
8585: x.epp == y.epp &&
8586: x.dvl == y.dvl &&
8587: x.cvl == y.cvl);
8588: }
8589: return false;
8590: }
8591:
8592:
8593:
8594:
8595:
8596:
8597:
8598:
8599:
8600:
8601:
8602:
8603:
8604:
8605:
8606:
8607:
8608:
8609:
8610:
8611:
8612:
8613:
8614:
8615:
8616:
8617:
8618:
8619:
8620:
8621:
8622:
8623:
8624:
8625:
8626:
8627:
8628:
8629:
8630:
8631:
8632:
8633:
8634:
8635:
8636:
8637:
8638:
8639:
8640:
8641:
8642:
8643:
8644:
8645:
8646:
8647:
8648:
8649:
8650:
8651:
8652:
8653:
8654:
8655:
8656:
8657:
8658:
8659:
8660:
8661:
8662:
8663:
8664: public final EFP exp () {
8665: return this.exp (this);
8666: }
8667: public final EFP exp (EFP x) {
8668: int xf = x.flg;
8669: if (xf << 1 != 0) {
8670: if (xf << 1 < 0) {
8671:
8672: this.flg = P;
8673: this.epp = 0;
8674: this.dvl = MSB;
8675: this.cvl = 0L;
8676: } else {
8677: this.flg = (xf == (P | I) ? P | I :
8678: xf == (M | I) ? P | Z :
8679: N);
8680: }
8681: return this;
8682: }
8683:
8684: epbFpsr |= EPB_FPSR_X2;
8685: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
8686: epbExceptionOperandMantissa = x.dvl;
8687: if (15 <= x.epp) {
8688: if (xf < 0) {
8689: epbFpsr |= EPB_FPSR_UF;
8690: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
8691: } else {
8692: epbFpsr |= EPB_FPSR_OF;
8693: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
8694: }
8695: }
8696: if (false) {
8697: this.inner ();
8698: EFP s = new EFP (1);
8699: EFP t = new EFP (0);
8700: EFP u = new EFP (x);
8701:
8702: this.flg = s.flg;
8703: this.epp = s.epp;
8704: this.dvl = s.dvl;
8705: this.cvl = s.cvl;
8706: for (int k = 1; this.ne (t); k++) {
8707: s.imul (u).divi (k);
8708:
8709: t.flg = this.flg;
8710: t.epp = this.epp;
8711: t.dvl = this.dvl;
8712: t.cvl = this.cvl;
8713: this.iadd (s);
8714: }
8715: return this.outer ().finish ();
8716: } else if (false) {
8717: return this.pow (E, x);
8718: } else if (true) {
8719: this.inner ();
8720: if (this == x) {
8721: x = new EFP (x);
8722: }
8723: if (x.epp < -32) {
8724: this.imul (x, ONE_3).inc ().imul (x).idiv2 ().inc ().imul (x).outer ().inc ();
8725: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
8726: if (xf < 0) {
8727:
8728: if (this.flg << 1 == 0 && 0 <= this.epp) {
8729: this.set1 ().nextdown (epbRoundingPrec);
8730: }
8731: }
8732: } else if (epbRoundingMode == EPB_MODE_RP) {
8733:
8734: if (new EFP (this.flg, this.epp, this.dvl, this.cvl).dec ().le (x)) {
8735: this.inner ().inc(x).outer ().nextup (epbRoundingPrec);
8736: }
8737: }
8738: } else {
8739: this.imul (LOG2_E, x).outer ().exp2 ();
8740: }
8741: return this;
8742: } else if (false) {
8743: int xe = x.epp;
8744: if (xe < 0) {
8745: return this.inner ().imul (LOG2_E, x).outer ().exp2 ();
8746: }
8747:
8748: this.inner ();
8749: int o = (int) (x.dvl >>> ~xe);
8750: this.frac (x).imul (LOG2_E).exp2 ();
8751: EFP[] a = xf >= 0 ? EXP_P_I : EXP_M_I;
8752: for (int i = 0; o != 0; i++) {
8753: if ((o & 1) != 0) {
8754: this.imul (a[i]);
8755: }
8756: o >>>= 1;
8757: }
8758: return this.outer ().finish ();
8759: } else {
8760: int xe = x.epp;
8761: this.inner ();
8762: long xd = x.dvl;
8763: long xc = x.cvl;
8764: EFP u;
8765: if (false) {
8766: u = new EFP ().shl (x, 6).frac ().shr (6);
8767: } else {
8768: int uf = xf;
8769: int ue;
8770: long ud;
8771: long uc;
8772: int o = xe + 7;
8773: if (o <= 0) {
8774: ue = xe;
8775: ud = xd;
8776: uc = xc;
8777: } else if (o <= 63) {
8778: ue = -7;
8779: ud = xd << o | xc >>> -o;
8780: uc = xc << o;
8781: } else if (o <= LEN - 1) {
8782: ue = -7;
8783: ud = xc << o;
8784: uc = 0L;
8785: } else {
8786: ue = 0;
8787: ud = 0L;
8788: uc = 0L;
8789: }
8790: if (ud >= 0L) {
8791: if (ud != 0L) {
8792: o = Long.numberOfLeadingZeros (ud);
8793: ue -= o;
8794: ud = ud << o | uc >>> -o;
8795: uc <<= o;
8796: } else if (uc != 0L) {
8797: o = 64 + Long.numberOfLeadingZeros (uc);
8798: ue -= o;
8799: ud = uc << o;
8800: uc = 0L;
8801: } else {
8802: uf |= Z;
8803: }
8804: }
8805: u = new EFP (uf, ue, ud, uc);
8806: }
8807: this.imul (EXP_C10, u)
8808: .iadd (EXP_C9).imul (u)
8809: .iadd (EXP_C8).imul (u)
8810: .iadd (EXP_C7).imul (u)
8811: .iadd (EXP_C6).imul (u)
8812: .iadd (EXP_C5).imul (u)
8813: .iadd (EXP_C4).imul (u)
8814: .iadd (EXP_C3).imul (u)
8815: .iadd (EXP_C2).imul (u)
8816: .iadd (EXP_C1).imul (u)
8817:
8818: .inc ();
8819: if (xf >= 0) {
8820: if (xe >= 0) {
8821: this.imul (EXP_P_T[(int) (xd << xe + 1 >>> -6)]);
8822: int o = (int) (xd >>> ~xe);
8823: for (int i = 0; o != 0; i++) {
8824: if ((o & 1) != 0) {
8825: this.imul (EXP_P_I[i]);
8826: }
8827: o >>>= 1;
8828: }
8829: } else if (xe >= -6) {
8830: this.imul (EXP_P_T[(int) (xd >>> ~xe - 6)]);
8831: }
8832: } else {
8833: if (xe >= 0) {
8834: this.imul (EXP_M_T[(int) (xd << xe + 1 >>> -6)]);
8835: int o = (int) (xd >>> ~xe);
8836: for (int i = 0; o != 0; i++) {
8837: if ((o & 1) != 0) {
8838: this.imul (EXP_M_I[i]);
8839: }
8840: o >>>= 1;
8841: }
8842: } else if (xe >= -6) {
8843: this.imul (EXP_M_T[(int) (xd >>> ~xe - 6)]);
8844: }
8845: }
8846: return this.outer ().finish ();
8847: }
8848: }
8849:
8850:
8851:
8852:
8853:
8854:
8855:
8856:
8857:
8858:
8859:
8860:
8861:
8862:
8863:
8864:
8865:
8866:
8867:
8868:
8869:
8870:
8871:
8872:
8873:
8874:
8875:
8876:
8877:
8878:
8879:
8880:
8881:
8882:
8883:
8884:
8885:
8886:
8887:
8888:
8889:
8890:
8891:
8892:
8893:
8894:
8895:
8896:
8897:
8898:
8899:
8900:
8901:
8902:
8903:
8904:
8905:
8906:
8907:
8908:
8909:
8910:
8911:
8912:
8913:
8914:
8915:
8916:
8917:
8918:
8919:
8920:
8921:
8922:
8923:
8924:
8925:
8926:
8927:
8928:
8929:
8930:
8931:
8932: public final EFP exp10 () {
8933: return this.exp10 (this);
8934: }
8935: public final EFP exp10 (EFP x) {
8936: int xf = x.flg;
8937: if (xf << 1 != 0) {
8938: if (xf << 1 < 0) {
8939:
8940: this.flg = P;
8941: this.epp = 0;
8942: this.dvl = MSB;
8943: this.cvl = 0L;
8944: } else {
8945: this.flg = (xf == (P | I) ? P | I :
8946: xf == (M | I) ? P | Z :
8947: N);
8948: }
8949: return this;
8950: }
8951:
8952: epbFpsr |= EPB_FPSR_X2;
8953: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
8954: epbExceptionOperandMantissa = x.dvl;
8955: if (15 <= x.epp) {
8956: if (xf < 0) {
8957: epbFpsr |= EPB_FPSR_UF;
8958: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
8959: } else {
8960: epbFpsr |= EPB_FPSR_OF;
8961: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
8962: }
8963: }
8964: if (false) {
8965: return this.pow (TEN, x);
8966: } else if (false) {
8967: return this.inner ().imul (LOG_10, x).outer ().exp ();
8968: } else if (true) {
8969:
8970:
8971: return this.inner ().imul (LOG2_10, x).outer ().exp2 ();
8972: } else if (false) {
8973:
8974:
8975:
8976:
8977:
8978:
8979: this.inner ();
8980: EFP t = new EFP ().imul (LOG2_10A, x).exp2m1 ();
8981: this.imul (LOG2_10, x).exp2 ();
8982: t.imul (this);
8983: return this.outer ().add (t);
8984: } else if (false) {
8985: int xe = x.epp;
8986: this.inner ();
8987: if (xe < 0) {
8988: this.imul (LOG2_10, x).exp2 ();
8989: } else {
8990: int o = (int) (x.dvl >>> ~xe);
8991: this.frac (x).imul (LOG2_10).exp2 ();
8992: EFP[] a = xf >= 0 ? EXP10_P_I : EXP10_M_I;
8993: for (int i = 0; o != 0; i++) {
8994: if ((o & 1) != 0) {
8995: this.imul (a[i]);
8996: }
8997: o >>>= 1;
8998: }
8999: }
9000: return this.outer ().finish ();
9001: } else {
9002: int xe = x.epp;
9003: this.inner ();
9004: long xd = x.dvl;
9005: long xc = x.cvl;
9006: EFP u;
9007: if (false) {
9008: u = new EFP ().shl (x, 6).frac ().shr (6);
9009: } else {
9010: int uf = xf;
9011: int ue;
9012: long ud;
9013: long uc;
9014: int o = xe + 7;
9015: if (o <= 0) {
9016: ue = xe;
9017: ud = xd;
9018: uc = xc;
9019: } else if (o <= 63) {
9020: ue = -7;
9021: ud = xd << o | xc >>> -o;
9022: uc = xc << o;
9023: } else if (o <= LEN - 1) {
9024: ue = -7;
9025: ud = xc << o;
9026: uc = 0L;
9027: } else {
9028: ue = 0;
9029: ud = 0L;
9030: uc = 0L;
9031: }
9032: if (ud >= 0L) {
9033: if (ud != 0L) {
9034: o = Long.numberOfLeadingZeros (ud);
9035: ue -= o;
9036: ud = ud << o | uc >>> -o;
9037: uc <<= o;
9038: } else if (uc != 0L) {
9039: o = 64 + Long.numberOfLeadingZeros (uc);
9040: ue -= o;
9041: ud = uc << o;
9042: uc = 0L;
9043: } else {
9044: uf |= Z;
9045: }
9046: }
9047: u = new EFP (uf, ue, ud, uc);
9048: }
9049: this.imul (EXP10_C11, u)
9050: .iadd (EXP10_C10).imul (u)
9051: .iadd (EXP10_C9).imul (u)
9052: .iadd (EXP10_C8).imul (u)
9053: .iadd (EXP10_C7).imul (u)
9054: .iadd (EXP10_C6).imul (u)
9055: .iadd (EXP10_C5).imul (u)
9056: .iadd (EXP10_C4).imul (u)
9057: .iadd (EXP10_C3).imul (u)
9058: .iadd (EXP10_C2).imul (u)
9059: .iadd (EXP10_C1).imul (u)
9060:
9061: .inc ();
9062: if (xf >= 0) {
9063: if (xe >= 0) {
9064: this.imul (EXP10_P_T[(int) (xd << xe + 1 >>> -6)]);
9065: int o = (int) (xd >>> ~xe);
9066: for (int i = 0; o != 0; i++) {
9067: if ((o & 1) != 0) {
9068: this.imul (EXP10_P_I[i]);
9069: }
9070: o >>>= 1;
9071: }
9072: } else if (xe >= -6) {
9073: this.imul (EXP10_P_T[(int) (xd >>> ~xe - 6)]);
9074: }
9075: this.outer ().finish ();
9076: if (epbRoundingMode == EPB_MODE_RP) {
9077:
9078: if (this.flg << 1 == 0 && (this.epp < 0 ||
9079: this.epp == 0 && this.dvl == MSB && this.cvl == 0L)) {
9080: this.set1 ().nextup (epbRoundingPrec);
9081: }
9082: }
9083: } else {
9084: if (xe >= 0) {
9085: this.imul (EXP10_M_T[(int) (xd << xe + 1 >>> -6)]);
9086: int o = (int) (xd >>> ~xe);
9087: for (int i = 0; o != 0; i++) {
9088: if ((o & 1) != 0) {
9089: this.imul (EXP10_M_I[i]);
9090: }
9091: o >>>= 1;
9092: }
9093: } else if (xe >= -6) {
9094: this.imul (EXP10_M_T[(int) (xd >>> ~xe - 6)]);
9095: }
9096: this.outer ().finish ();
9097: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
9098:
9099: if (this.flg << 1 == 0 && 0 <= this.epp) {
9100: this.set1 ().nextdown (epbRoundingPrec);
9101: }
9102: }
9103: }
9104: return this;
9105: }
9106: }
9107:
9108:
9109:
9110:
9111:
9112:
9113:
9114:
9115:
9116:
9117:
9118:
9119:
9120:
9121:
9122:
9123:
9124:
9125:
9126:
9127:
9128:
9129:
9130:
9131:
9132:
9133:
9134:
9135:
9136:
9137:
9138:
9139:
9140:
9141:
9142:
9143:
9144:
9145:
9146:
9147:
9148:
9149:
9150:
9151:
9152:
9153:
9154:
9155:
9156:
9157:
9158:
9159:
9160:
9161:
9162:
9163:
9164:
9165:
9166:
9167:
9168:
9169:
9170:
9171:
9172:
9173:
9174:
9175:
9176:
9177:
9178:
9179:
9180:
9181:
9182:
9183:
9184:
9185:
9186:
9187:
9188:
9189:
9190:
9191:
9192:
9193:
9194:
9195:
9196:
9197:
9198:
9199:
9200:
9201:
9202:
9203:
9204:
9205:
9206:
9207:
9208:
9209:
9210:
9211:
9212:
9213:
9214:
9215:
9216:
9217:
9218:
9219:
9220:
9221: public final EFP exp2 () {
9222: return this.exp2 (this);
9223: }
9224: public final EFP exp2 (EFP x) {
9225: int xf = x.flg;
9226: if (xf << 1 != 0) {
9227: if (xf << 1 < 0) {
9228:
9229: this.flg = P;
9230: this.epp = 0;
9231: this.dvl = MSB;
9232: this.cvl = 0L;
9233: } else {
9234: this.flg = (xf == (P | I) ? P | I :
9235: xf == (M | I) ? P | Z :
9236: N);
9237: }
9238: return this;
9239: }
9240:
9241: epbFpsr |= EPB_FPSR_X2;
9242: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
9243: epbExceptionOperandMantissa = x.dvl;
9244: if (15 <= x.epp) {
9245: if (xf < 0) {
9246: epbFpsr |= EPB_FPSR_UF;
9247: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
9248: } else {
9249: epbFpsr |= EPB_FPSR_OF;
9250: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
9251: }
9252: }
9253: if (false) {
9254: return this.pow (TWO, x);
9255: } else if (false) {
9256: return this.inner ().imul (LOG_2, x).outer ().exp ();
9257: } else {
9258: int xe = x.epp;
9259: long xd = x.dvl;
9260: long xc = x.cvl;
9261: this.inner ();
9262: EFP u;
9263: if (false) {
9264: u = new EFP ().shl (x, 6).frac ().shr (6);
9265: } else {
9266: int uf = xf;
9267: int ue;
9268: long ud;
9269: long uc;
9270: int o = xe + 7;
9271: if (o <= 0) {
9272: ue = xe;
9273: ud = xd;
9274: uc = xc;
9275: } else if (o <= 63) {
9276: ue = -7;
9277: ud = xd << o | xc >>> -o;
9278: uc = xc << o;
9279: } else if (o <= LEN - 1) {
9280: ue = -7;
9281: ud = xc << o;
9282: uc = 0L;
9283: } else {
9284: ue = 0;
9285: ud = 0L;
9286: uc = 0L;
9287: }
9288: if (ud >= 0L) {
9289: if (ud != 0L) {
9290: o = Long.numberOfLeadingZeros (ud);
9291: ue -= o;
9292: ud = ud << o | uc >>> -o;
9293: uc <<= o;
9294: } else if (uc != 0L) {
9295: o = 64 + Long.numberOfLeadingZeros (uc);
9296: ue -= o;
9297: ud = uc << o;
9298: uc = 0L;
9299: } else {
9300: uf |= Z;
9301: }
9302: }
9303: u = new EFP (uf, ue, ud, uc);
9304: }
9305: if (xf >= 0) {
9306: this.imul (EXP2P_C8, u)
9307: .iadd (EXP2P_C7).imul (u)
9308: .iadd (EXP2P_C6).imul (u)
9309: .iadd (EXP2P_C5).imul (u)
9310: .iadd (EXP2P_C4).imul (u)
9311: .iadd (EXP2P_C3).imul (u)
9312: .iadd (EXP2P_C2).imul (u)
9313: .iadd (EXP2P_C1).imul (u)
9314:
9315: .inc ();
9316: if (xe >= 0) {
9317: this.imul (EXP2P_T[(int) (xd << xe + 1 >>> -6)]).shl ((int) (xd >>> ~xe));
9318: } else if (xe >= -6) {
9319: this.imul (EXP2P_T[(int) (xd >>> ~xe - 6)]);
9320: }
9321: this.outer ().finish ();
9322: if (epbRoundingMode == EPB_MODE_RP) {
9323:
9324: if (this.flg << 1 == 0 && (this.epp < 0 ||
9325: this.epp == 0 && this.dvl == MSB && this.cvl == 0L)) {
9326: this.set1 ().nextup (epbRoundingPrec);
9327: }
9328: }
9329: } else {
9330: this.imul (EXP2M_C8, u)
9331: .iadd (EXP2M_C7).imul (u)
9332: .iadd (EXP2M_C6).imul (u)
9333: .iadd (EXP2M_C5).imul (u)
9334: .iadd (EXP2M_C4).imul (u)
9335: .iadd (EXP2M_C3).imul (u)
9336: .iadd (EXP2M_C2).imul (u)
9337: .iadd (EXP2M_C1).imul (u)
9338:
9339: .inc ();
9340: if (xe >= 0) {
9341: this.imul (EXP2M_T[(int) (xd << xe + 1 >>> -6)]).shr ((int) (xd >>> ~xe));
9342: } else if (xe >= -6) {
9343: this.imul (EXP2M_T[(int) (xd >>> ~xe - 6)]);
9344: }
9345: this.outer ().finish ();
9346: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
9347:
9348: if (this.flg << 1 == 0 && 0 <= this.epp) {
9349: this.set1 ().nextdown (epbRoundingPrec);
9350: }
9351: }
9352: }
9353: return this;
9354: }
9355: }
9356:
9357:
9358:
9359:
9360:
9361:
9362:
9363:
9364:
9365:
9366:
9367:
9368:
9369:
9370:
9371:
9372:
9373:
9374:
9375:
9376:
9377:
9378:
9379:
9380:
9381:
9382:
9383:
9384:
9385:
9386:
9387:
9388:
9389:
9390:
9391:
9392:
9393:
9394:
9395:
9396:
9397:
9398:
9399:
9400:
9401:
9402:
9403:
9404:
9405:
9406:
9407:
9408:
9409:
9410:
9411:
9412:
9413:
9414:
9415:
9416:
9417:
9418:
9419:
9420:
9421:
9422:
9423:
9424:
9425:
9426:
9427:
9428:
9429:
9430:
9431:
9432:
9433:
9434:
9435:
9436:
9437:
9438:
9439:
9440:
9441:
9442:
9443:
9444:
9445:
9446:
9447:
9448:
9449:
9450:
9451: public final EFP exp2m1 () {
9452: return this.exp2m1 (this);
9453: }
9454: public final EFP exp2m1 (EFP x) {
9455: int xf = x.flg;
9456: if (xf << 1 != 0) {
9457: if (xf == (M | I)) {
9458: this.flg = M;
9459: this.epp = 0;
9460: this.dvl = MSB;
9461: this.cvl = 0L;
9462: } else {
9463: this.flg = xf;
9464: }
9465: return this;
9466: }
9467:
9468: epbFpsr |= EPB_FPSR_X2;
9469: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
9470: epbExceptionOperandMantissa = x.dvl;
9471: if (xf < 0) {
9472: if (8 <= x.epp) {
9473:
9474: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
9475: return this.sete (NEXTUP_MINUSONE[epbRoundingPrec]).finish ();
9476: } else {
9477: return this.negset1 ().finish ();
9478: }
9479: }
9480: } else {
9481: if (15 <= x.epp) {
9482: epbFpsr |= EPB_FPSR_OF;
9483: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
9484: }
9485: }
9486: int xe = x.epp;
9487: if (xe < -2) {
9488: this.inner ();
9489: if (this == x) {
9490: x = new EFP (x);
9491: }
9492: return this.imul (EXP2M1_C17, x)
9493: .iadd (EXP2M1_C16).imul (x)
9494: .iadd (EXP2M1_C15).imul (x)
9495: .iadd (EXP2M1_C14).imul (x)
9496: .iadd (EXP2M1_C13).imul (x)
9497: .iadd (EXP2M1_C12).imul (x)
9498: .iadd (EXP2M1_C11).imul (x)
9499: .iadd (EXP2M1_C10).imul (x)
9500: .iadd (EXP2M1_C9).imul (x)
9501: .iadd (EXP2M1_C8).imul (x)
9502: .iadd (EXP2M1_C7).imul (x)
9503: .iadd (EXP2M1_C6).imul (x)
9504: .iadd (EXP2M1_C5).imul (x)
9505: .iadd (EXP2M1_C4).imul (x)
9506: .iadd (EXP2M1_C3).imul (x)
9507: .iadd (EXP2M1_C2).imul (x)
9508: .iadd (EXP2M1_C1).outer ().mul (x);
9509: }
9510: int savedFpsr = epbFpsr;
9511: this.inner ().exp2 (x).outer ().dec ();
9512:
9513: if (this.flg << 1 == 0 && (this.flg < 0 && 0 <= this.epp)) {
9514: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
9515: this.sete (NEXTUP_MINUSONE[epbRoundingPrec]).finish ();
9516: }
9517: }
9518: return this.correctUnderflow (savedFpsr);
9519: }
9520:
9521:
9522:
9523:
9524:
9525:
9526:
9527:
9528:
9529:
9530:
9531:
9532:
9533:
9534:
9535:
9536:
9537:
9538:
9539:
9540:
9541:
9542:
9543:
9544:
9545:
9546:
9547:
9548:
9549:
9550:
9551:
9552:
9553:
9554:
9555:
9556:
9557:
9558:
9559:
9560:
9561:
9562:
9563:
9564:
9565:
9566:
9567:
9568:
9569:
9570:
9571:
9572:
9573:
9574:
9575:
9576:
9577:
9578:
9579:
9580:
9581:
9582:
9583:
9584:
9585:
9586:
9587:
9588:
9589:
9590:
9591:
9592:
9593:
9594:
9595:
9596:
9597:
9598:
9599:
9600: public final EFP expm1 () {
9601: return this.expm1 (this);
9602: }
9603: public final EFP expm1 (EFP x) {
9604: int xf = x.flg;
9605: if (xf << 1 != 0) {
9606: if (xf == (M | I)) {
9607: this.flg = M;
9608: this.epp = 0;
9609: this.dvl = MSB;
9610: this.cvl = 0L;
9611: } else {
9612: this.flg = xf;
9613: }
9614: return this;
9615: }
9616:
9617: epbFpsr |= EPB_FPSR_X2;
9618: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
9619: epbExceptionOperandMantissa = x.dvl;
9620: if (xf < 0) {
9621: if (8 <= x.epp) {
9622:
9623: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
9624: return this.sete (NEXTUP_MINUSONE[epbRoundingPrec]).finish ();
9625: } else {
9626: return this.negset1 ().finish ();
9627: }
9628: }
9629: } else {
9630: if (15 <= x.epp) {
9631: epbFpsr |= EPB_FPSR_OF;
9632: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1]).finish ();
9633: }
9634: }
9635: int savedFpsr = epbFpsr;
9636: this.inner ();
9637: if (x.epp < -2) {
9638: if (this == x) {
9639: x = new EFP (x);
9640: }
9641: this.imul (EXPM1_C18, x)
9642: .iadd (EXPM1_C17).imul (x)
9643: .iadd (EXPM1_C16).imul (x)
9644: .iadd (EXPM1_C15).imul (x)
9645: .iadd (EXPM1_C14).imul (x)
9646: .iadd (EXPM1_C13).imul (x)
9647: .iadd (EXPM1_C12).imul (x)
9648: .iadd (EXPM1_C11).imul (x)
9649: .iadd (EXPM1_C10).imul (x)
9650: .iadd (EXPM1_C9).imul (x)
9651: .iadd (EXPM1_C8).imul (x)
9652: .iadd (EXPM1_C7).imul (x)
9653: .iadd (EXPM1_C6).imul (x)
9654: .iadd (EXPM1_C5).imul (x)
9655: .iadd (EXPM1_C4).imul (x)
9656: .iadd (EXPM1_C3).imul (x)
9657: .iadd (EXPM1_C2).imul (x)
9658: .iadd (EXPM1_C1).outer ().mul (x);
9659: return this.originUpperUpper (x).correctUnderflow (savedFpsr);
9660: }
9661: return this.imul (LOG2_E, x).outer ().exp2m1 ();
9662: }
9663:
9664:
9665:
9666:
9667:
9668:
9669:
9670:
9671:
9672:
9673:
9674:
9675:
9676:
9677:
9678:
9679:
9680:
9681:
9682:
9683:
9684:
9685:
9686:
9687:
9688:
9689:
9690:
9691:
9692:
9693:
9694:
9695:
9696:
9697:
9698:
9699:
9700:
9701:
9702:
9703:
9704:
9705:
9706:
9707:
9708:
9709:
9710:
9711:
9712:
9713:
9714:
9715:
9716:
9717:
9718:
9719:
9720:
9721: public final EFP floor () {
9722: return this.floor (this);
9723: }
9724: public final EFP floor (EFP x) {
9725: int xf = x.flg;
9726: if (xf << 1 != 0) {
9727: this.flg = xf;
9728: return this;
9729: }
9730:
9731: int xe = x.epp;
9732: if (xe < 0) {
9733: epbFpsr |= EPB_FPSR_X2;
9734: if (xf >= 0) {
9735: this.flg = P | Z;
9736: } else {
9737: this.flg = M;
9738: this.epp = 0;
9739: this.dvl = MSB;
9740: this.cvl = 0L;
9741: }
9742: return this;
9743: }
9744:
9745: long xd = x.dvl;
9746: long xc = x.cvl;
9747: long m = MSB >> xe;
9748: if (xf >= 0) {
9749: if (xe <= 63) {
9750: if ((xd & ~m | xc) != 0L) {
9751: epbFpsr |= EPB_FPSR_X2;
9752: xd &= m;
9753: xc = 0L;
9754: }
9755: } else if (xe <= LEN - 2) {
9756: if ((xc & ~m) != 0L) {
9757: epbFpsr |= EPB_FPSR_X2;
9758: xc &= m;
9759: }
9760: }
9761:
9762: } else {
9763: if (xe <= 63) {
9764: long t = xd;
9765: xd &= m;
9766: if (((t ^ xd) | xc) != 0L) {
9767: epbFpsr |= EPB_FPSR_X2;
9768: xd -= m;
9769: if (xd >= 0L) {
9770: xd = MSB;
9771: xe++;
9772: if ((short) xe != xe) {
9773: epbFpsr |= EPB_FPSR_OF;
9774: epbExceptionOperandExponent = xf;
9775: epbExceptionOperandMantissa = xd;
9776: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | 1]).finish ();
9777: }
9778: }
9779: xc = 0L;
9780: }
9781:
9782: } else if (xe <= LEN - 2) {
9783: long t = xc;
9784: xc &= m;
9785: if ((t ^ xc) != 0L) {
9786: epbFpsr |= EPB_FPSR_X2;
9787: xc -= m;
9788: if ((t ^ xc) < 0L) {
9789: xd++;
9790: if (xd >= 0L) {
9791: xd = MSB;
9792: xe++;
9793: if ((short) xe != xe) {
9794: epbFpsr |= EPB_FPSR_OF;
9795: epbExceptionOperandExponent = xf;
9796: epbExceptionOperandMantissa = xd;
9797: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | 1]).finish ();
9798: }
9799: }
9800: }
9801: }
9802: }
9803:
9804: }
9805: return this.finish (xf, xe, xd, xc, 0L);
9806: }
9807:
9808:
9809:
9810:
9811:
9812:
9813:
9814:
9815:
9816:
9817:
9818:
9819:
9820:
9821:
9822:
9823:
9824:
9825:
9826:
9827:
9828:
9829:
9830:
9831:
9832:
9833:
9834:
9835:
9836:
9837:
9838:
9839:
9840:
9841:
9842:
9843:
9844:
9845:
9846:
9847:
9848:
9849:
9850:
9851:
9852:
9853:
9854:
9855:
9856:
9857:
9858:
9859:
9860:
9861:
9862:
9863:
9864:
9865:
9866:
9867:
9868:
9869:
9870:
9871:
9872: public final EFP frac () {
9873: return this.frac (this);
9874: }
9875: public final EFP frac (EFP x) {
9876: int xf = x.flg;
9877: if (xf << 1 != 0) {
9878: this.flg = xf << 2 != 0 ? N : xf;
9879: return this;
9880: }
9881:
9882: int xe = x.epp;
9883: if (xe >= LEN - 1) {
9884: this.flg = xf | Z;
9885: return this;
9886: }
9887: long xd = x.dvl;
9888: long xc = x.cvl;
9889: if (xe >= 0) {
9890: if (xe < 63) {
9891: xe++;
9892: xd = xd << xe | xc >>> -xe;
9893: xc <<= xe;
9894: if (xd != 0L) {
9895: xe = Long.numberOfLeadingZeros (xd);
9896: if (xe > 0) {
9897: xd = xd << xe | xc >>> -xe;
9898: xc <<= xe;
9899: }
9900: xe = ~xe;
9901: } else if (xc != 0L) {
9902: xe = Long.numberOfLeadingZeros (xc);
9903: xd = xc << xe;
9904: xc = 0L;
9905: xe = -65 - xe;
9906: } else {
9907: this.flg = xf | Z;
9908: return this;
9909: }
9910: } else {
9911: xe++;
9912: xc <<= xe;
9913: if (xc != 0L) {
9914: xe = Long.numberOfLeadingZeros (xc);
9915: xd = xc << xe;
9916: xc = 0L;
9917: xe = ~xe;
9918: } else {
9919: this.flg = xf | Z;
9920: return this;
9921: }
9922: }
9923: }
9924: this.flg = xf;
9925: this.epp = xe;
9926: this.dvl = xd;
9927: this.cvl = xc;
9928: return this;
9929: }
9930:
9931:
9932:
9933:
9934:
9935:
9936:
9937:
9938:
9939:
9940:
9941: public boolean ge (EFP y) {
9942: int xf = this.flg;
9943: int yf = y.flg;
9944: if ((xf | yf) << 1 != 0) {
9945: return EFP_GE_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
9946: }
9947:
9948: if (xf != yf) {
9949: return xf > yf;
9950: }
9951:
9952: int s;
9953: long t;
9954: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
9955: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
9956: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
9957: 0) >= 0;
9958: }
9959:
9960:
9961:
9962:
9963:
9964:
9965:
9966:
9967:
9968:
9969:
9970:
9971: public int getb () {
9972: int xf = this.flg;
9973: if (xf << 1 != 0) {
9974: if (xf << 1 < 0) {
9975: return 0;
9976: } else if (xf << 2 < 0) {
9977: epbFpsr |= EPB_FPSR_OE;
9978: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
9979: epbExceptionOperandMantissa = 0x0000000000000000L;
9980: return xf >> 31 ^ 0x0000007f;
9981: } else {
9982: epbFpsr |= EPB_FPSR_OE | EPB_FPSR_AV;
9983: epbExceptionOperandExponent = 0x7fff << 16;
9984: epbExceptionOperandMantissa = 0xffffffffffffffffL;
9985: return -1;
9986: }
9987: }
9988:
9989: int xe = this.epp;
9990: long xd = this.dvl;
9991: long xc = this.cvl;
9992: if (xe < 0) {
9993: if (false) {
9994: epbFpsr |= EPB_FPSR_X2;
9995: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
9996: epbExceptionOperandMantissa = xd;
9997: }
9998: return 0;
9999: }
10000:
10001: if (xe < 7) {
10002: if (false) {
10003: if ((xd << 1 + xe | xc) != 0L) {
10004: epbFpsr |= EPB_FPSR_X2;
10005: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10006: epbExceptionOperandMantissa = xd;
10007: }
10008: }
10009: return xf >= 0 ? (int) (xd >>> ~xe) : -(int) (xd >>> ~xe);
10010: }
10011:
10012: if (xf >= 0) {
10013: epbFpsr |= EPB_FPSR_OE;
10014: epbExceptionOperandExponent = 0x3fff + xe << 16;
10015: epbExceptionOperandMantissa = xd;
10016: return 0x0000007f;
10017: }
10018:
10019: if (xe != 7 || xd != MSB || xc != 0L) {
10020: epbFpsr |= EPB_FPSR_OE;
10021: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
10022: epbExceptionOperandMantissa = this.dvl;
10023: }
10024: return 0xffffff80;
10025: }
10026: public int getb (int roundingMode) {
10027: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().getb () :
10028: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().getb () :
10029: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().getb () :
10030: new EFP ().inner ().trunc (this).outer ().getb ());
10031: }
10032:
10033:
10034:
10035:
10036:
10037:
10038:
10039:
10040:
10041:
10042:
10043:
10044:
10045:
10046:
10047:
10048:
10049:
10050:
10051:
10052:
10053:
10054:
10055:
10056:
10057:
10058:
10059:
10060:
10061:
10062:
10063:
10064:
10065:
10066:
10067:
10068:
10069:
10070:
10071:
10072:
10073:
10074:
10075:
10076:
10077:
10078:
10079:
10080:
10081: public final double getd () {
10082: return getd (EPB_MODE_RN);
10083: }
10084: public final double getd (int roundingMode) {
10085: return Double.longBitsToDouble (getd01 (roundingMode));
10086: }
10087: public final byte[] getd01 (byte[] b, int a) {
10088: return getd01 (b, a, EPB_MODE_RN);
10089: }
10090: public final byte[] getd01 (byte[] b, int a, int roundingMode) {
10091: long l = getd01 (roundingMode);
10092: b[a] = (byte) (l >> 56);
10093: b[a + 1] = (byte) (l >> 48);
10094: b[a + 2] = (byte) (l >> 40);
10095: b[a + 3] = (byte) (l >> 32);
10096: b[a + 4] = (byte) (l >> 24);
10097: b[a + 5] = (byte) (l >> 16);
10098: b[a + 6] = (byte) (l >> 8);
10099: b[a + 7] = (byte) l;
10100: return b;
10101: }
10102: public final int[] getd01 (int[] ib, int ia) {
10103: return getd01 (ib, ia, EPB_MODE_RN);
10104: }
10105: public final int[] getd01 (int[] ib, int ia, int roundingMode) {
10106: long l = getd01 (roundingMode);
10107: ib[ia] = (int) (l >> 32);
10108: ib[ia + 1] = (int) l;
10109: return ib;
10110: }
10111: public final long getd01 () {
10112: return getd01 (EPB_MODE_RN);
10113: }
10114: public final long getd01 (int roundingMode) {
10115: int xf = this.flg;
10116: if (xf << 1 != 0) {
10117: return (xf << 1 < 0 ? 0 <= xf ? 0x0000000000000000L : 0x8000000000000000L :
10118: xf << 2 < 0 ? 0 <= xf ? 0x7ff0000000000000L : 0xfff0000000000000L :
10119: EFP_FPCP_NAN ? 0x7fffffffffffffffL : 0x7ff8000000000000L);
10120: }
10121:
10122: int xe = this.epp;
10123: long xd = this.dvl;
10124: long xc = this.cvl;
10125: if (xe < -1075) {
10126: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10127: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10128: epbExceptionOperandMantissa = xd;
10129: return (0 <= xf ?
10130: roundingMode == EPB_MODE_RP ? 0x0000000000000001L : 0x0000000000000000L :
10131: roundingMode == EPB_MODE_RM ? 0x8000000000000001L : 0x8000000000000000L);
10132: }
10133: if (1023 < xe) {
10134: if (true) {
10135: epbFpsr |= EPB_FPSR_OF;
10136: if ((xd << 53 | xc) != 0L) {
10137: epbFpsr |= EPB_FPSR_X2;
10138: }
10139: } else {
10140: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10141: }
10142: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10143: epbExceptionOperandMantissa = xd;
10144: return (0 <= xf ?
10145: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7fefffffffffffffL : 0x7ff0000000000000L :
10146: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xffefffffffffffffL : 0xfff0000000000000L);
10147: }
10148: long xb = 0L;
10149: int o = xe <= -1023 ? 11 + -1022 - xe : 11;
10150: if (o < 64) {
10151: xb = xc << -o;
10152: xc = xd << -o | xc >>> o;
10153: xd >>>= o;
10154: } else {
10155: xb = xc;
10156: xc = xd;
10157: xd = 0L;
10158: }
10159: if ((xc | xb) != 0L) {
10160: epbFpsr |= EPB_FPSR_X2;
10161: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
10162: roundingMode == EPB_MODE_RM && xf < 0 ||
10163: roundingMode == EPB_MODE_RP && 0 <= xf) {
10164: xd++;
10165: if (xd >>> 53 != 0L) {
10166: xd = 1L << 52;
10167: xe++;
10168: if (1023 < xe) {
10169: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10170: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10171: epbExceptionOperandMantissa = xd;
10172: return (0 <= xf ?
10173: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7fefffffffffffffL : 0x7ff0000000000000L :
10174: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xffefffffffffffffL : 0xfff0000000000000L);
10175: }
10176: } else if (11 < o) {
10177: if (xd << o - 1 < 0L) {
10178: xe++;
10179:
10180: if (xe == -1022) {
10181:
10182: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10183: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10184: epbExceptionOperandMantissa = xd;
10185: }
10186:
10187: }
10188: }
10189: }
10190:
10191: if (xe <= -1023) {
10192: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10193: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10194: epbExceptionOperandMantissa = xd;
10195: if (xd == 0L) {
10196: return (0 <= xf ?
10197: roundingMode == EPB_MODE_RP ? 0x0000000000000001L : 0x0000000000000000L :
10198: roundingMode == EPB_MODE_RM ? 0x8000000000000001L : 0x8000000000000000L);
10199: }
10200: }
10201: } else {
10202: if (xe <= -1023) {
10203: epbFpsr |= EPB_FPSR_UF;
10204: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10205: epbExceptionOperandMantissa = xd;
10206: if (xd == 0L) {
10207: return (0 <= xf ?
10208: roundingMode == EPB_MODE_RP ? 0x0000000000000001L : 0x0000000000000000L :
10209: roundingMode == EPB_MODE_RM ? 0x8000000000000001L : 0x8000000000000000L);
10210: }
10211: }
10212: }
10213: return ((long) (xf | Math.max (0, xe + 1023) << 52 - 32) << 32 |
10214: xd & ((1L << 52) - 1L));
10215: }
10216:
10217:
10218:
10219:
10220:
10221:
10222:
10223:
10224: public final EFP getexp () {
10225: return this.getexp (this);
10226: }
10227: public final EFP getexp (EFP x) {
10228: int xf = x.flg;
10229: if (xf << 1 != 0) {
10230: if (xf << 2 < 0) {
10231: epbFpsr |= EPB_FPSR_OE;
10232: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10233: epbExceptionOperandMantissa = 0x0000000000000000L;
10234: this.flg = N;
10235: } else {
10236: this.flg = xf;
10237: }
10238: return this;
10239: }
10240: return this.seti (x.epp);
10241: }
10242:
10243:
10244:
10245:
10246:
10247:
10248:
10249:
10250:
10251:
10252:
10253:
10254:
10255:
10256:
10257:
10258:
10259:
10260:
10261:
10262:
10263:
10264:
10265:
10266:
10267:
10268:
10269:
10270:
10271:
10272:
10273:
10274:
10275:
10276:
10277:
10278:
10279:
10280:
10281:
10282:
10283:
10284:
10285:
10286:
10287:
10288:
10289:
10290:
10291: public final float getf () {
10292: return getf (EPB_MODE_RN);
10293: }
10294: public final float getf (int roundingMode) {
10295: return Float.intBitsToFloat (getf0 (roundingMode));
10296: }
10297: public final byte[] getf0 (byte[] b, int a) {
10298: return getf0 (b, a, EPB_MODE_RN);
10299: }
10300: public final byte[] getf0 (byte[] b, int a, int roundingMode) {
10301: int i = getf0 (roundingMode);
10302: b[a] = (byte) (i >> 24);
10303: b[a + 1] = (byte) (i >> 16);
10304: b[a + 2] = (byte) (i >> 8);
10305: b[a + 3] = (byte) i;
10306: return b;
10307: }
10308: public final int[] getf0 (int[] ib, int ia) {
10309: return getf0 (ib, ia, EPB_MODE_RN);
10310: }
10311: public final int[] getf0 (int[] ib, int ia, int roundingMode) {
10312: ib[ia] = getf0 (roundingMode);
10313: return ib;
10314: }
10315: public final int getf0 () {
10316: return getf0 (EPB_MODE_RN);
10317: }
10318: public final int getf0 (int roundingMode) {
10319: int xf = this.flg;
10320: if (xf << 1 != 0) {
10321: return (xf << 1 < 0 ? xf & M :
10322: xf << 2 < 0 ? (xf & M) | 0x7f800000 :
10323: EFP_FPCP_NAN ? 0x7fffffff : 0x7fc00000);
10324: }
10325:
10326: int xe = this.epp;
10327: long xd = this.dvl;
10328: long xc = this.cvl;
10329: if (xe < -150) {
10330: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10331: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10332: epbExceptionOperandMantissa = xd;
10333: return (0 <= xf ?
10334: roundingMode == EPB_MODE_RP ? 0x00000001 : 0x00000000 :
10335: roundingMode == EPB_MODE_RM ? 0x80000001 : 0x80000000);
10336: }
10337: if (127 < xe) {
10338: if (true) {
10339: epbFpsr |= EPB_FPSR_OF;
10340: if ((xd << 24 | xc) != 0L) {
10341: epbFpsr |= EPB_FPSR_X2;
10342: }
10343: } else {
10344: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10345: }
10346: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10347: epbExceptionOperandMantissa = xd;
10348: return (0 <= xf ?
10349: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7f7fffff : 0x7f800000 :
10350: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xff7fffff : 0xff800000);
10351: }
10352: long xb = 0L;
10353: int o = xe <= -127 ? 40 + -126 - xe : 40;
10354: if (o < 64) {
10355: xb = xc << -o;
10356: xc = xd << -o | xc >>> o;
10357: xd >>>= o;
10358: } else {
10359: xb = xc;
10360: xc = xd;
10361: xd = 0L;
10362: }
10363: if ((xc | xb) != 0L) {
10364: epbFpsr |= EPB_FPSR_X2;
10365: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << -1 | xc << 1 | xb) != 0L ||
10366: roundingMode == EPB_MODE_RM && xf < 0 ||
10367: roundingMode == EPB_MODE_RP && 0 <= xf) {
10368: xd++;
10369: if (xd >>> 24 != 0L) {
10370: xd = 1L << 23;
10371: xe++;
10372: if (127 < xe) {
10373: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10374: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10375: epbExceptionOperandMantissa = xd;
10376: return (0 <= xf ?
10377: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7f7fffff : 0x7f800000 :
10378: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xff7fffff : 0xff800000);
10379: }
10380: } else if (40 < o) {
10381: if (xd << o - 1 < 0L) {
10382: xe++;
10383:
10384: if (xe == -126) {
10385:
10386: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10387: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10388: epbExceptionOperandMantissa = xd;
10389: }
10390:
10391: }
10392: }
10393: }
10394:
10395: if (xe <= -127) {
10396: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10397: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10398: epbExceptionOperandMantissa = xd;
10399: if (xd == 0L) {
10400: return (0 <= xf ?
10401: roundingMode == EPB_MODE_RP ? 0x00000001 : 0x00000000 :
10402: roundingMode == EPB_MODE_RM ? 0x80000001 : 0x80000000);
10403: }
10404: }
10405: } else {
10406: if (xe <= -127) {
10407: epbFpsr |= EPB_FPSR_UF;
10408: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10409: epbExceptionOperandMantissa = xd;
10410: if (xd == 0L) {
10411: return (0 <= xf ?
10412: roundingMode == EPB_MODE_RP ? 0x00000001 : 0x00000000 :
10413: roundingMode == EPB_MODE_RM ? 0x80000001 : 0x80000000);
10414: }
10415: }
10416: }
10417: return (xf | Math.max (0, xe + 127) << 23 |
10418: (int) xd & ((1 << 23) - 1));
10419: }
10420:
10421:
10422:
10423:
10424:
10425:
10426:
10427:
10428:
10429:
10430: public int geti () {
10431: int xf = this.flg;
10432: if (xf << 1 != 0) {
10433: if (xf << 1 < 0) {
10434: return 0;
10435: } else if (xf << 2 < 0) {
10436: epbFpsr |= EPB_FPSR_OE;
10437: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10438: epbExceptionOperandMantissa = 0x0000000000000000L;
10439: return xf >> 31 ^ 0x7fffffff;
10440: } else {
10441: epbFpsr |= EPB_FPSR_OE | EPB_FPSR_AV;
10442: epbExceptionOperandExponent = 0x7fff << 16;
10443: epbExceptionOperandMantissa = 0xffffffffffffffffL;
10444: return -1;
10445: }
10446: }
10447:
10448: int xe = this.epp;
10449: long xd = this.dvl;
10450: long xc = this.cvl;
10451: if (xe < 0) {
10452: if (false) {
10453: epbFpsr |= EPB_FPSR_X2;
10454: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10455: epbExceptionOperandMantissa = xd;
10456: }
10457: return 0;
10458: }
10459:
10460: if (xe < 31) {
10461: if (false) {
10462: if ((xd << 1 + xe | xc) != 0L) {
10463: epbFpsr |= EPB_FPSR_X2;
10464: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10465: epbExceptionOperandMantissa = xd;
10466: }
10467: }
10468: return xf >= 0 ? (int) (xd >>> ~xe) : -(int) (xd >>> ~xe);
10469: }
10470:
10471: if (xf >= 0) {
10472: epbFpsr |= EPB_FPSR_OE;
10473: epbExceptionOperandExponent = 0x3fff + xe << 16;
10474: epbExceptionOperandMantissa = xd;
10475: return 0x7fffffff;
10476: }
10477:
10478: if (xe != 31 || xd != MSB || xc != 0L) {
10479: epbFpsr |= EPB_FPSR_OE;
10480: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
10481: epbExceptionOperandMantissa = this.dvl;
10482: }
10483: return 0x80000000;
10484: }
10485: public int geti (int roundingMode) {
10486: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().geti () :
10487: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().geti () :
10488: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().geti () :
10489: new EFP ().inner ().trunc (this).outer ().geti ());
10490: }
10491:
10492:
10493:
10494:
10495:
10496:
10497: public int geti32 () {
10498: int xf = this.flg;
10499: if (xf << 1 != 0) {
10500: return 0;
10501: }
10502: int t = this.geti32abs ();
10503: return xf < 0 ? -t : t;
10504: }
10505:
10506:
10507:
10508:
10509:
10510:
10511: public int geti32abs () {
10512: int xf = this.flg;
10513: if (xf << 1 != 0) {
10514: return 0;
10515: }
10516:
10517:
10518:
10519:
10520:
10521:
10522:
10523:
10524:
10525:
10526:
10527:
10528:
10529:
10530:
10531:
10532:
10533:
10534:
10535:
10536:
10537:
10538:
10539: int xe = this.epp;
10540: long xd = this.dvl;
10541: long xc = this.cvl;
10542: return (xe <= -1 ? 0 :
10543: xe <= 63 ? (int) (xd >>> (63 - xe)) :
10544: xe <= 94 ? (int) (xd << (xe - 63) | xc >>> (127 - xe)) :
10545: xe <= 126 ? (int) (xc >>> (127 - xe)) :
10546: xe <= 158 ? (int) (xc << (xe - 127)) :
10547: 0);
10548: }
10549:
10550:
10551:
10552:
10553:
10554:
10555: public long geti64 () {
10556: int xf = this.flg;
10557: if (xf << 1 != 0) {
10558: return 0L;
10559: }
10560: long t = this.geti64abs ();
10561: return xf < 0 ? -t : t;
10562: }
10563:
10564:
10565:
10566:
10567:
10568:
10569: public long geti64abs () {
10570: int xf = this.flg;
10571: if (xf << 1 != 0) {
10572: return 0L;
10573: }
10574:
10575:
10576:
10577:
10578:
10579:
10580:
10581:
10582:
10583:
10584:
10585:
10586:
10587:
10588:
10589:
10590:
10591:
10592:
10593:
10594:
10595:
10596:
10597: int xe = this.epp;
10598: long xd = this.dvl;
10599: long xc = this.cvl;
10600: return (xe <= -1 ? 0L :
10601: xe <= 63 ? (xd >>> (63 - xe)) :
10602: xe <= 126 ? (xd << (xe - 63) | xc >>> (127 - xe)) :
10603: xe <= 190 ? (xc << (xe - 127)) :
10604: 0L);
10605: }
10606:
10607:
10608:
10609:
10610:
10611:
10612:
10613:
10614:
10615: public long getl () {
10616: int xf = this.flg;
10617: if (xf << 1 != 0) {
10618: if (xf << 1 < 0) {
10619: return 0L;
10620: } else if (xf << 2 < 0) {
10621: epbFpsr |= EPB_FPSR_OE;
10622: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10623: epbExceptionOperandMantissa = 0x0000000000000000L;
10624: return xf < 0 ? MSB : ~MSB;
10625: } else {
10626: epbFpsr |= EPB_FPSR_OE;
10627: epbExceptionOperandExponent = 0x7fff << 16;
10628: epbExceptionOperandMantissa = 0xffffffffffffffffL;
10629: return 0L;
10630: }
10631: }
10632:
10633: int xe = this.epp;
10634: if (xe < 0) {
10635: return 0L;
10636: }
10637:
10638: if (xe < 63) {
10639: return xf >= 0 ? this.dvl >>> ~xe : -(this.dvl >>> ~xe);
10640: }
10641:
10642: if (xf >= 0) {
10643: epbFpsr |= EPB_FPSR_OE;
10644: epbExceptionOperandExponent = 0x3fff + xe << 16;
10645: epbExceptionOperandMantissa = this.dvl;
10646: return 0x7fffffffffffffffL;
10647: }
10648:
10649: if (xe != 63 || this.dvl != MSB || this.cvl != 0L) {
10650: epbFpsr |= EPB_FPSR_OE;
10651: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
10652: epbExceptionOperandMantissa = this.dvl;
10653: }
10654: return 0x8000000000000000L;
10655: }
10656: public long getl (int roundingMode) {
10657: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().getl () :
10658: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().getl () :
10659: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().getl () :
10660: this.getl ());
10661: }
10662:
10663:
10664:
10665:
10666:
10667:
10668:
10669:
10670: public final EFP getman () {
10671: return this.getman (this);
10672: }
10673: public final EFP getman (EFP x) {
10674: int xf = x.flg;
10675: if (xf << 1 != 0) {
10676: if (xf << 2 < 0) {
10677: epbFpsr |= EPB_FPSR_OE;
10678: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10679: epbExceptionOperandMantissa = 0x0000000000000000L;
10680: this.flg = N;
10681: } else {
10682: this.flg = xf;
10683: }
10684: return this;
10685: }
10686: this.flg = xf;
10687: this.epp = 0;
10688: this.dvl = x.dvl;
10689: this.cvl = x.cvl;
10690: return this;
10691: }
10692:
10693:
10694:
10695:
10696:
10697:
10698:
10699:
10700:
10701:
10702:
10703:
10704:
10705:
10706:
10707:
10708:
10709:
10710:
10711:
10712:
10713:
10714:
10715:
10716: public byte[] getp012 (byte[] b, int a) {
10717: return getp012 (b, a, 17);
10718: }
10719: public byte[] getp012 (byte[] b, int a, int k) {
10720: int[] ib = getp012 (new int[3], 0, k);
10721: int i = ib[0];
10722: b[a] = (byte) (i >> 24);
10723: b[a + 1] = (byte) (i >> 16);
10724: b[a + 2] = (byte) (i >> 8);
10725: b[a + 3] = (byte) i;
10726: i = ib[1];
10727: b[a + 4] = (byte) (i >> 24);
10728: b[a + 5] = (byte) (i >> 16);
10729: b[a + 6] = (byte) (i >> 8);
10730: b[a + 7] = (byte) i;
10731: i = ib[2];
10732: b[a + 8] = (byte) (i >> 24);
10733: b[a + 9] = (byte) (i >> 16);
10734: b[a + 10] = (byte) (i >> 8);
10735: b[a + 11] = (byte) i;
10736: return b;
10737: }
10738: public int[] getp012 (int[] ib, int ia) {
10739: return getp012 (ib, ia, 17);
10740: }
10741: public int[] getp012 (int[] ib, int ia, int k) {
10742: k = k << -7 >> -7;
10743: int u;
10744: long v;
10745: int xf = this.flg;
10746: if (xf << 1 != 0) {
10747: if (xf << 1 < 0) {
10748: u = xf & M;
10749: v = 0L;
10750: } else if (xf << 2 < 0) {
10751: u = (xf & M) | 0x7fff0000;
10752: v = 0L;
10753: } else {
10754: u = 0x7fff0000;
10755: v = 0xffffffffffffffffL;
10756: }
10757: } else {
10758: if (k > 17) {
10759: epbFpsr |= EPB_FPSR_OE;
10760: epbExceptionOperandExponent = this.flg & M | 0x3fff + this.epp << 16;
10761: epbExceptionOperandMantissa = this.dvl;
10762: k = 17;
10763: }
10764:
10765:
10766:
10767:
10768:
10769:
10770:
10771:
10772:
10773:
10774: int xe = this.epp;
10775: long xd = this.dvl;
10776: long xc = this.cvl;
10777: EFP x = new EFP (P, xe, xd, xc);
10778: int savedFpsr = epbFpsr;
10779: this.inner ();
10780:
10781:
10782:
10783:
10784:
10785:
10786: int e = (int) Math.floor (0.30102999566398119521373889472449302677 * xe);
10787:
10788:
10789: if (e < 0) {
10790: int o = -e;
10791: EFP t = new EFP (ONE);
10792: for (int i = 0; o != 0; i++, o >>>= 1) {
10793: if ((o & 1) != 0) {
10794: t.imul (EFP_TEN_POWER_P[i]);
10795: }
10796: }
10797: x.imul (t);
10798: } else if (e <= 18) {
10799: e = 0;
10800: } else {
10801: int o = e -= 18;
10802: EFP t = new EFP (ONE);
10803: for (int i = 0; o != 0; i++, o >>>= 1) {
10804: if ((o & 1) != 0) {
10805: t.imul (EFP_TEN_POWER_P[i]);
10806: }
10807: }
10808: x.div (t);
10809: }
10810:
10811:
10812:
10813: u = 0;
10814: v = 0L;
10815: if (0 <= x.epp) {
10816:
10817: long s, t;
10818: if (x.epp <= 63) {
10819: s = 0L;
10820: t = x.dvl >>> ~x.epp;
10821: } else {
10822: s = 1L;
10823: t = x.dvl << 1 | x.cvl >>> -1;
10824: }
10825:
10826: long r = s << 32 | t >>> 32;
10827: s = r / 10000L;
10828: r = r - s * 10000L << 32 | t & 0xffffffffL;
10829: t = r / 10000L;
10830: v = XEiJ.FMT_BCD4[(int) (r - t * 10000L)];
10831: t = XEiJ.fmtBcd16 (s << 32 | t);
10832: u = (int) (t >>> 48);
10833: v |= t << 16;
10834: }
10835:
10836:
10837: while ((u & 0xfffffff0) == 0) {
10838: u = u << 16 | (int) (v >>> -16);
10839: v = v << 16 | XEiJ.FMT_BCD4[x.frac ().muli (10000).geti32abs ()];
10840: e -= 4;
10841: }
10842: long rest = x.frac ().iszero () ? 0L : 1L;
10843: this.outer ();
10844: epbFpsr = savedFpsr;
10845:
10846:
10847:
10848:
10849:
10850:
10851: int w = 24 - (Integer.numberOfLeadingZeros (u) >>> 2);
10852:
10853:
10854: if (k <= 0) {
10855:
10856:
10857:
10858:
10859: k = Math.max (1, Math.min (17, w + e - k));
10860: }
10861:
10862: int i = w - k - 1 << 2;
10863: if (0 < i) {
10864: if (i < 64) {
10865: long mask = -1L << i;
10866: rest |= v & ~mask;
10867: v &= mask;
10868: } else {
10869: int mask = -1 << i - 64;
10870: rest |= (long) (u & ~mask) | v;
10871: u &= mask;
10872: v = 0L;
10873: }
10874: }
10875:
10876: int d = (i < 64 ? (int) (v >>> i) : u >>> i - 64) & 15;
10877: if (d != 0 || rest != 0L) {
10878: epbFpsr |= EPB_FPSR_X2;
10879: epbExceptionOperandExponent = xf & M | 0x3fff + xe << 16;
10880: epbExceptionOperandMantissa = xd;
10881: if (i < 64) {
10882: v &= ~(15L << i);
10883: } else {
10884: u &= ~(15 << i);
10885: }
10886: i += 4;
10887: if ((epbRoundingMode == EPB_MODE_RN &&
10888: (5 < d ||
10889: (d == 5 && (rest != 0L ||
10890: ((i < 64 ? (int) (v >>> i) : u >>> i - 64) & 1) != 0)))) ||
10891: (epbRoundingMode == EPB_MODE_RM && xf < 0) ||
10892: (epbRoundingMode == EPB_MODE_RP && 0 <= xf)) {
10893:
10894:
10895:
10896: while (((i < 64 ? (int) (v >>> i) : u >>> i - 64) & 15) == 9) {
10897: if (i < 64) {
10898: v &= ~(15L << i);
10899: } else {
10900: u &= ~(15 << i);
10901: }
10902: i += 4;
10903: }
10904:
10905:
10906: if (i < 64) {
10907: v += 1L << i;
10908: } else {
10909: u += 1 << i;
10910: }
10911: }
10912: }
10913:
10914: w = 7 - (Integer.numberOfLeadingZeros (u) >>> 2);
10915: e += 16 + w;
10916: i = w << 2;
10917: v = (long) u << -i | v >>> i;
10918: u >>>= i - 64;
10919:
10920: if (e < 0) {
10921: u |= 0x40000000;
10922: e = -e;
10923: }
10924: e = XEiJ.fmtBcd8 (e);
10925: if ((e & ~0xfff) != 0) {
10926: epbFpsr |= EPB_FPSR_OE;
10927: epbExceptionOperandExponent = xf & M | 0x3fff + xe << 16;
10928: epbExceptionOperandMantissa = xd;
10929: }
10930: u |= (e & 0xfff) << 16 | (e & 0xf000);
10931:
10932: u |= xf & M;
10933: }
10934: ib[ia] = u;
10935: ib[ia + 1] = (int) (v >> 32);
10936: ib[ia + 2] = (int) v;
10937: return ib;
10938: }
10939:
10940:
10941:
10942:
10943:
10944:
10945:
10946:
10947:
10948:
10949:
10950:
10951: public int gets () {
10952: int xf = this.flg;
10953: if (xf << 1 != 0) {
10954: if (xf << 1 < 0) {
10955: return 0;
10956: } else if (xf << 2 < 0) {
10957: epbFpsr |= EPB_FPSR_OE;
10958: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10959: epbExceptionOperandMantissa = 0x0000000000000000L;
10960: return xf >> 31 ^ 0x00007fff;
10961: } else {
10962: epbFpsr |= EPB_FPSR_OE | EPB_FPSR_AV;
10963: epbExceptionOperandExponent = 0x7fff << 16;
10964: epbExceptionOperandMantissa = 0xffffffffffffffffL;
10965: return -1;
10966: }
10967: }
10968:
10969: int xe = this.epp;
10970: long xd = this.dvl;
10971: long xc = this.cvl;
10972: if (xe < 0) {
10973: if (false) {
10974: epbFpsr |= EPB_FPSR_X2;
10975: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10976: epbExceptionOperandMantissa = xd;
10977: }
10978: return 0;
10979: }
10980:
10981: if (xe < 15) {
10982: if (false) {
10983: if ((xd << 1 + xe | xc) != 0L) {
10984: epbFpsr |= EPB_FPSR_X2;
10985: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10986: epbExceptionOperandMantissa = xd;
10987: }
10988: }
10989: return xf >= 0 ? (int) (xd >>> ~xe) : -(int) (xd >>> ~xe);
10990: }
10991:
10992: if (xf >= 0) {
10993: epbFpsr |= EPB_FPSR_OE;
10994: epbExceptionOperandExponent = 0x3fff + xe << 16;
10995: epbExceptionOperandMantissa = xd;
10996: return 0x00007fff;
10997: }
10998:
10999: if (xe != 15 || xd != MSB || xc != 0L) {
11000: epbFpsr |= EPB_FPSR_OE;
11001: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
11002: epbExceptionOperandMantissa = this.dvl;
11003: }
11004: return 0xffff8000;
11005: }
11006: public int gets (int roundingMode) {
11007: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().gets () :
11008: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().gets () :
11009: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().gets () :
11010: new EFP ().inner ().trunc (this).outer ().gets ());
11011: }
11012:
11013:
11014:
11015:
11016:
11017:
11018:
11019:
11020:
11021:
11022:
11023:
11024:
11025:
11026:
11027:
11028:
11029:
11030:
11031:
11032:
11033:
11034:
11035:
11036:
11037:
11038:
11039:
11040:
11041:
11042:
11043:
11044:
11045:
11046:
11047:
11048: public final int getx0 () {
11049: int[] ib = getx012 (new int[3], 0, EPB_MODE_RN);
11050: return ib[0];
11051: }
11052: public final int getx0 (int roundingMode) {
11053: int[] ib = getx012 (new int[3], 0, roundingMode);
11054: return ib[0];
11055: }
11056: public final long getx12 () {
11057: int[] ib = getx012 (new int[3], 0, EPB_MODE_RN);
11058: return (long) ib[1] << 32 | (0xffffffffL & ib[2]);
11059: }
11060: public final long getx12 (int roundingMode) {
11061: int[] ib = getx012 (new int[3], 0, roundingMode);
11062: return (long) ib[1] << 32 | (0xffffffffL & ib[2]);
11063: }
11064: public final byte[] getx012 (byte[] b, int a) {
11065: return getx012 (b, a, EPB_MODE_RN);
11066: }
11067: public final byte[] getx012 (byte[] b, int a, int roundingMode) {
11068: int[] ib = getx012 (new int[3], 0, roundingMode);
11069: int i = ib[0];
11070: b[a] = (byte) (i >> 24);
11071: b[a + 1] = (byte) (i >> 16);
11072: b[a + 2] = (byte) (i >> 8);
11073: b[a + 3] = (byte) i;
11074: i = ib[1];
11075: b[a + 4] = (byte) (i >> 24);
11076: b[a + 5] = (byte) (i >> 16);
11077: b[a + 6] = (byte) (i >> 8);
11078: b[a + 7] = (byte) i;
11079: i = ib[2];
11080: b[a + 8] = (byte) (i >> 24);
11081: b[a + 9] = (byte) (i >> 16);
11082: b[a + 10] = (byte) (i >> 8);
11083: b[a + 11] = (byte) i;
11084: return b;
11085: }
11086: public final int[] getx012 (int[] ib, int ia) {
11087: return this.getx012 (ib, ia, EPB_MODE_RN);
11088: }
11089: public final int[] getx012 (int[] ib, int ia, int roundingMode) {
11090: int xf = this.flg;
11091: int xe = this.epp;
11092: long xd = this.dvl;
11093: long xc = this.cvl;
11094: xfxd:
11095: {
11096: if (xf << 1 != 0) {
11097: if (xf << 1 < 0) {
11098: xf &= M;
11099: xd = 0x0000000000000000L;
11100: } else if (xf << 2 < 0) {
11101: xf = (xf & M) | 0x7fff0000;
11102: xd = 0x0000000000000000L;
11103: } else {
11104: xf = 0x7fff0000;
11105: xd = 0xffffffffffffffffL;
11106: }
11107: break xfxd;
11108: }
11109:
11110: if (xe < -16447) {
11111: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11112: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11113: epbExceptionOperandMantissa = xd;
11114: if (0 <= xf) {
11115: if (roundingMode == EPB_MODE_RP) {
11116: xf = 0x00000000;
11117: xd = 0x0000000000000001L;
11118: } else {
11119: xf = 0x00000000;
11120: xd = 0x0000000000000000L;
11121: }
11122: } else {
11123: if (roundingMode == EPB_MODE_RM) {
11124: xf = 0x80000000;
11125: xd = 0x0000000000000001L;
11126: } else {
11127: xf = 0x80000000;
11128: xd = 0x0000000000000000L;
11129: }
11130: }
11131: break xfxd;
11132: }
11133: if (16383 < xe) {
11134: if (true) {
11135: epbFpsr |= EPB_FPSR_OF;
11136: if (xc != 0L) {
11137: epbFpsr |= EPB_FPSR_X2;
11138: }
11139: } else {
11140: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11141: }
11142: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11143: epbExceptionOperandMantissa = xd;
11144: if (0 <= xf) {
11145: if (roundingMode == EPB_MODE_RM) {
11146: xf = 0x7ffe0000;
11147: xd = 0xffffffffffffffffL;
11148: } else {
11149: xf = 0x7fff0000;
11150: xd = 0x0000000000000000L;
11151: }
11152: } else {
11153: if (roundingMode == EPB_MODE_RP) {
11154: xf = 0xfffe0000;
11155: xd = 0xffffffffffffffffL;
11156: } else {
11157: xf = 0xffff0000;
11158: xd = 0x0000000000000000L;
11159: }
11160: }
11161: break xfxd;
11162: }
11163: long xb = 0L;
11164: int o = xe <= -16384 ? 0 + -16383 - xe : 0;
11165: if (o == 0) {
11166: } else if (o < 64) {
11167: xb = xc << -o;
11168: xc = xd << -o | xc >>> o;
11169: xd >>>= o;
11170: } else {
11171: xb = xc;
11172: xc = xd;
11173: xd = 0L;
11174: }
11175: if ((xc | xb) != 0L) {
11176: epbFpsr |= EPB_FPSR_X2;
11177: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
11178: roundingMode == EPB_MODE_RM && xf < 0 ||
11179: roundingMode == EPB_MODE_RP && 0 <= xf) {
11180: xd++;
11181: if (xd == 0L) {
11182: xd = MSB;
11183: xe++;
11184: if (16383 < xe) {
11185: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11186: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11187: epbExceptionOperandMantissa = xd;
11188: if (0 <= xf) {
11189: if (roundingMode == EPB_MODE_RM) {
11190: xf = 0x7ffe0000;
11191: xd = 0xffffffffffffffffL;
11192: } else {
11193: xf = 0x7fff0000;
11194: xd = 0x0000000000000000L;
11195: }
11196: } else {
11197: if (roundingMode == EPB_MODE_RP) {
11198: xf = 0xfffe0000;
11199: xd = 0xffffffffffffffffL;
11200: } else {
11201: xf = 0xffff0000;
11202: xd = 0x0000000000000000L;
11203: }
11204: }
11205: break xfxd;
11206: }
11207: } else if (0 < o) {
11208: if (xd << o - 1 < 0L) {
11209: xe++;
11210:
11211:
11212:
11213:
11214:
11215:
11216:
11217:
11218: }
11219: }
11220: }
11221:
11222: if (xe <= -16384) {
11223: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11224: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11225: epbExceptionOperandMantissa = xd;
11226: if (xd == 0L) {
11227: if (0 <= xf) {
11228: if (roundingMode == EPB_MODE_RP) {
11229: xf = 0x00000000;
11230: xd = 0x0000000000000001L;
11231: } else {
11232: xf = 0x00000000;
11233: xd = 0x0000000000000000L;
11234: }
11235: } else {
11236: if (roundingMode == EPB_MODE_RM) {
11237: xf = 0x80000000;
11238: xd = 0x0000000000000001L;
11239: } else {
11240: xf = 0x80000000;
11241: xd = 0x0000000000000000L;
11242: }
11243: }
11244: break xfxd;
11245: }
11246: }
11247: } else {
11248: if (xe <= -16384) {
11249: epbFpsr |= EPB_FPSR_UF;
11250: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11251: epbExceptionOperandMantissa = xd;
11252: if (xd == 0L) {
11253: if (0 <= xf) {
11254: if (roundingMode == EPB_MODE_RP) {
11255: xf = 0x00000000;
11256: xd = 0x0000000000000001L;
11257: } else {
11258: xf = 0x00000000;
11259: xd = 0x0000000000000000L;
11260: }
11261: } else {
11262: if (roundingMode == EPB_MODE_RM) {
11263: xf = 0x80000000;
11264: xd = 0x0000000000000001L;
11265: } else {
11266: xf = 0x80000000;
11267: xd = 0x0000000000000000L;
11268: }
11269: }
11270: break xfxd;
11271: }
11272: }
11273: }
11274: xf |= Math.max (0, 16383 + xe) << 16;
11275: }
11276:
11277: ib[ia] = xf;
11278: ib[ia + 1] = (int) (xd >> 32);
11279: ib[ia + 2] = (int) xd;
11280: return ib;
11281: }
11282:
11283:
11284:
11285:
11286:
11287:
11288:
11289:
11290:
11291:
11292:
11293:
11294:
11295:
11296:
11297:
11298:
11299:
11300:
11301:
11302:
11303:
11304:
11305:
11306:
11307:
11308:
11309:
11310:
11311:
11312:
11313:
11314:
11315: public final int gety0 () {
11316: int[] ib = gety012 (new int[3], 0, EPB_MODE_RN);
11317: return ib[0];
11318: }
11319: public final int gety0 (int roundingMode) {
11320: int[] ib = gety012 (new int[3], 0, roundingMode);
11321: return ib[0];
11322: }
11323: public final long gety12 () {
11324: int[] ib = gety012 (new int[3], 0, EPB_MODE_RN);
11325: return (long) ib[1] << 32 | (0xffffffffL & ib[2]);
11326: }
11327: public final long gety12 (int roundingMode) {
11328: int[] ib = gety012 (new int[3], 0, roundingMode);
11329: return (long) ib[1] << 32 | (0xffffffffL & ib[2]);
11330: }
11331: public final byte[] gety012 (byte[] b, int a) {
11332: return gety012 (b, a, EPB_MODE_RN);
11333: }
11334: public final byte[] gety012 (byte[] b, int a, int roundingMode) {
11335: int[] ib = gety012 (new int[3], 0, roundingMode);
11336: int i = ib[0];
11337: b[a] = (byte) (i >> 24);
11338: b[a + 1] = (byte) (i >> 16);
11339: b[a + 2] = (byte) (i >> 8);
11340: b[a + 3] = (byte) i;
11341: i = ib[1];
11342: b[a + 4] = (byte) (i >> 24);
11343: b[a + 5] = (byte) (i >> 16);
11344: b[a + 6] = (byte) (i >> 8);
11345: b[a + 7] = (byte) i;
11346: i = ib[2];
11347: b[a + 8] = (byte) (i >> 24);
11348: b[a + 9] = (byte) (i >> 16);
11349: b[a + 10] = (byte) (i >> 8);
11350: b[a + 11] = (byte) i;
11351: return b;
11352: }
11353: public final int[] gety012 (int[] ib, int ia) {
11354: return this.gety012 (ib, ia, EPB_MODE_RN);
11355: }
11356: public final int[] gety012 (int[] ib, int ia, int roundingMode) {
11357: int xf = this.flg;
11358: int xe = this.epp;
11359: long xd = this.dvl;
11360: long xc = this.cvl;
11361: xfxd:
11362: {
11363: if (xf << 1 != 0) {
11364: if (xf << 1 < 0) {
11365: xf &= M;
11366: xd = 0x0000000000000000L;
11367: } else if (xf << 2 < 0) {
11368: xf = (xf & M) | 0x7fff0000;
11369: xd = 0x0000000000000000L;
11370: } else {
11371: xf = 0x7fffffff;
11372: xd = 0xffffffffffffffffL;
11373: }
11374: break xfxd;
11375: }
11376:
11377: if (xe < -16463) {
11378: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11379: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11380: epbExceptionOperandMantissa = xd;
11381: if (0 <= xf) {
11382: if (roundingMode == EPB_MODE_RP) {
11383: xf = 0x00000001;
11384: xd = 0x0000000000000000L;
11385: } else {
11386: xf = 0x00000000;
11387: xd = 0x0000000000000000L;
11388: }
11389: } else {
11390: if (roundingMode == EPB_MODE_RM) {
11391: xf = 0x80000001;
11392: xd = 0x0000000000000000L;
11393: } else {
11394: xf = 0x80000000;
11395: xd = 0x0000000000000000L;
11396: }
11397: }
11398: break xfxd;
11399: }
11400: if (16383 < xe) {
11401: if (true) {
11402: epbFpsr |= EPB_FPSR_OF;
11403: if (xc << 16 != 0L) {
11404: epbFpsr |= EPB_FPSR_X2;
11405: }
11406: } else {
11407: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11408: }
11409: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11410: epbExceptionOperandMantissa = xd;
11411: if (0 <= xf) {
11412: if (roundingMode == EPB_MODE_RM) {
11413: xf = 0x7ffeffff;
11414: xd = 0xffffffffffffffffL;
11415: } else {
11416: xf = 0x7fff0000;
11417: xd = 0x0000000000000000L;
11418: }
11419: } else {
11420: if (roundingMode == EPB_MODE_RP) {
11421: xf = 0xfffeffff;
11422: xd = 0xffffffffffffffffL;
11423: } else {
11424: xf = 0xffff0000;
11425: xd = 0x0000000000000000L;
11426: }
11427: }
11428: break xfxd;
11429: }
11430: long xb = 0L;
11431: long xa = 0L;
11432: int o = xe <= -16384 ? 48 + -16383 - xe : 48;
11433: if (o < 64) {
11434: xb = xc << -o;
11435: xc = xd << -o | xc >>> o;
11436: xd >>>= o;
11437: } else if (o == 64) {
11438: xb = xc;
11439: xc = xd;
11440: xd = 0L;
11441: } else if (o < 128) {
11442: xa = xc << -o;
11443: xb = xd << -o | xc >>> o;
11444: xc = xd >>> o;
11445: xd = 0L;
11446: } else {
11447: xa = xc;
11448: xb = xd;
11449: xc = 0L;
11450: xd = 0L;
11451: }
11452: if ((xb | xa) != 0L) {
11453: epbFpsr |= EPB_FPSR_X2;
11454: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1 | xa) != 0L ||
11455: roundingMode == EPB_MODE_RM && xf < 0 ||
11456: roundingMode == EPB_MODE_RP && 0 <= xf) {
11457: xc++;
11458: if (xc == 0L) {
11459: xd++;
11460: if (xd >>> 16 != 0L) {
11461:
11462: xe++;
11463: if (16383 < xe) {
11464: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11465: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11466: epbExceptionOperandMantissa = xd;
11467: if (0 <= xf) {
11468: if (roundingMode == EPB_MODE_RM) {
11469: xf = 0x7ffeffff;
11470: xd = 0xffffffffffffffffL;
11471: } else {
11472: xf = 0x7fff0000;
11473: xd = 0x0000000000000000L;
11474: }
11475: } else {
11476: if (roundingMode == EPB_MODE_RP) {
11477: xf = 0xfffeffff;
11478: xd = 0xffffffffffffffffL;
11479: } else {
11480: xf = 0xffff0000;
11481: xd = 0x0000000000000000L;
11482: }
11483: }
11484: break xfxd;
11485: }
11486: } else if (48 < o) {
11487: if (xd << o - 1 < 0L) {
11488: xe++;
11489:
11490:
11491:
11492:
11493:
11494:
11495:
11496:
11497: }
11498: }
11499: }
11500: }
11501:
11502: if (xe <= -16384) {
11503: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11504: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11505: epbExceptionOperandMantissa = xd;
11506: if ((xd | xc) == 0L) {
11507: if (0 <= xf) {
11508: if (roundingMode == EPB_MODE_RP) {
11509: xf = 0x00000001;
11510: xd = 0x0000000000000000L;
11511: } else {
11512: xf = 0x00000000;
11513: xd = 0x0000000000000000L;
11514: }
11515: } else {
11516: if (roundingMode == EPB_MODE_RM) {
11517: xf = 0x80000001;
11518: xd = 0x0000000000000000L;
11519: } else {
11520: xf = 0x80000000;
11521: xd = 0x0000000000000000L;
11522: }
11523: }
11524: break xfxd;
11525: }
11526: }
11527: } else {
11528: if (xe <= -16384) {
11529: epbFpsr |= EPB_FPSR_UF;
11530: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11531: epbExceptionOperandMantissa = xd;
11532: if ((xd | xc) == 0L) {
11533: if (0 <= xf) {
11534: if (roundingMode == EPB_MODE_RP) {
11535: xf = 0x00000001;
11536: xd = 0x0000000000000000L;
11537: } else {
11538: xf = 0x00000000;
11539: xd = 0x0000000000000000L;
11540: }
11541: } else {
11542: if (roundingMode == EPB_MODE_RM) {
11543: xf = 0x80000001;
11544: xd = 0x0000000000000000L;
11545: } else {
11546: xf = 0x80000000;
11547: xd = 0x0000000000000000L;
11548: }
11549: }
11550: break xfxd;
11551: }
11552: }
11553: }
11554: xd = xd << 48 | xc >>> -48;
11555: xc <<= 48;
11556: xf |= Math.max (0, 16383 + xe) << 16;
11557: }
11558:
11559: ib[ia] = xf | (int) (xc >> 48);
11560: ib[ia + 1] = (int) (xd >> 32);
11561: ib[ia + 2] = (int) xd;
11562: return ib;
11563: }
11564:
11565:
11566:
11567:
11568:
11569:
11570:
11571:
11572:
11573:
11574:
11575: public boolean gt (EFP y) {
11576: int xf = this.flg;
11577: int yf = y.flg;
11578: if ((xf | yf) << 1 != 0) {
11579: return EFP_GT_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
11580: }
11581:
11582: if (xf != yf) {
11583: return xf > yf;
11584: }
11585:
11586: int s;
11587: long t;
11588: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
11589: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
11590: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
11591: 0) > 0;
11592: }
11593:
11594:
11595:
11596:
11597:
11598:
11599:
11600:
11601: public int hashCode () {
11602: return (this.flg ^
11603: this.epp ^
11604: (int) (this.dvl >> 32) ^
11605: (int) this.dvl ^
11606: (int) (this.cvl >> 32));
11607: }
11608:
11609:
11610:
11611:
11612:
11613:
11614:
11615:
11616:
11617:
11618:
11619:
11620:
11621:
11622:
11623:
11624:
11625: public final EFP ieeerem (EFP y) {
11626: return this.ieeerem (this, y);
11627: }
11628: public final EFP ieeerem (EFP x, EFP y) {
11629: int xf = x.flg;
11630: int yf = y.flg;
11631: epbFpsr &= 0xff00ffff;
11632: if ((xf | yf) << 1 != 0) {
11633: if ((xf | yf) << 3 < 0) {
11634: this.flg = N;
11635: } else if (xf << 2 < 0 ||
11636: yf << 1 < 0) {
11637:
11638: epbFpsr |= EPB_FPSR_OE;
11639: if (yf << 1 < 0) {
11640: epbExceptionOperandExponent = yf & M;
11641: epbExceptionOperandMantissa = 0x0000000000000000L;
11642: } else if (yf << 2 < 0) {
11643: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
11644: epbExceptionOperandMantissa = 0x0000000000000000L;
11645: } else {
11646: epbExceptionOperandExponent = yf & M | 0x3fff + y.epp << 16;
11647: epbExceptionOperandMantissa = y.dvl;
11648: }
11649: this.flg = N;
11650: } else if (xf << 1 < 0) {
11651: epbFpsr |= ((xf ^ yf) & M) >>> 8;
11652: this.flg = xf;
11653: } else {
11654: epbFpsr |= ((xf ^ yf) & M) >>> 8;
11655: this.finish (xf, x.epp, x.dvl, x.cvl, 0L);
11656: }
11657: return this;
11658: }
11659:
11660: epbFpsr |= ((xf ^ yf) & M) >>> 8;
11661: if (false) {
11662: this.inner ();
11663:
11664: EFP q = new EFP ().quo (x, y);
11665: int qi = q.geti32abs ();
11666: EFP w = new EFP ();
11667: this.imulw (w, q, y).negsub (x).sub (w);
11668: int k = w.imul2 (this).cmpabs (y);
11669: if (k > 0 || k == 0 && (qi & 1) != 0) {
11670: qi++;
11671: if ((xf ^ yf) >= 0) {
11672: this.sub (y);
11673: } else {
11674: this.iadd (y);
11675: }
11676: }
11677: epbQuotient = qi;
11678: epbFpsr |= (qi & 127) << 16;
11679: if (this.flg << 1 < 0) {
11680: this.flg = xf | Z;
11681: }
11682: return this.outer ().finish ();
11683: } else {
11684: this.inner ();
11685: int ye = y.epp;
11686: long yd = y.dvl;
11687: long yc = y.cvl;
11688: long yc1 = yc >>> 1;
11689: this.epp = x.epp;
11690: this.dvl = x.dvl;
11691: this.cvl = x.cvl;
11692: int i;
11693: long l;
11694: int q = 0;
11695: if ((i = this.epp - ye) > 0 ||
11696: i == 0 && ((l = this.dvl - yd) > 0L ||
11697: l == 0L && this.cvl >>> 1 >= yc1)) {
11698: this.flg = P;
11699: EFP t = new EFP (P, 0, yd, yc);
11700: do {
11701: t.epp = i = (l = this.dvl - yd) > 0L || l == 0L && this.cvl >>> 1 >= yc1 ? this.epp : this.epp - 1;
11702: if ((i -= ye) <= 31) {
11703: q |= 1 << i;
11704: }
11705: this.sub (t);
11706: } while (this.flg == 0 &&
11707: ((i = this.epp - ye) > 0 ||
11708: i == 0 && ((l = this.dvl - yd) > 0L ||
11709: l == 0L && this.cvl >>> 1 >= yc1)));
11710: this.flg |= xf;
11711: } else {
11712: this.flg = xf;
11713: }
11714: if (this.flg << 1 >= 0) {
11715: if ((i = this.epp - ye + 1) > 0 ||
11716: i == 0 && ((l = this.dvl - yd) > 0L ||
11717: l == 0L && ((l = (this.cvl >>> 1) - yc1) > 0L ||
11718: l == 0L && (q & 1) != 0))) {
11719: this.sub (new EFP (this.flg, ye, yd, yc));
11720: q++;
11721: }
11722: if ((short) this.epp != this.epp) {
11723: this.outer ();
11724: epbFpsr |= EPB_FPSR_UF;
11725: epbExceptionOperandExponent = this.flg & M;
11726: epbExceptionOperandMantissa = this.dvl;
11727: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
11728: }
11729: }
11730: epbQuotient = q;
11731: epbFpsr |= (q & 127) << 16;
11732: return this.outer ().finish ();
11733: }
11734: }
11735:
11736:
11737:
11738:
11739:
11740:
11741:
11742:
11743:
11744:
11745:
11746:
11747:
11748:
11749:
11750:
11751:
11752:
11753:
11754:
11755:
11756:
11757:
11758:
11759:
11760:
11761:
11762:
11763:
11764:
11765:
11766:
11767:
11768:
11769:
11770:
11771:
11772:
11773:
11774:
11775:
11776:
11777:
11778: public int ieeerempi2 () {
11779: return this.ieeerempi2 (this);
11780: }
11781: public int ieeerempi2 (EFP x) {
11782: int xf = x.flg;
11783: if (xf << 1 != 0) {
11784: this.flg = xf;
11785: return 0;
11786: }
11787:
11788: int xe = x.epp;
11789: long xd = x.dvl;
11790: long xc = x.cvl;
11791: int o;
11792: long t;
11793: if ((o = xe + 1) < 0 || o == 0 && ((t = xd - 0xc90fdaa22168c234L) < 0L ||
11794: t == 0L && xc >>> 1 <= 0xc4c6629L >>> 1)) {
11795: this.flg = xf;
11796: this.epp = xe;
11797: this.dvl = xd;
11798: this.cvl = xc;
11799: return 0;
11800: }
11801: if ((o = xe - 1) < 0 || o == 0 && ((t = xd - 0x96cbe3f9990e91a7L) < 0L ||
11802: t == 0L && xc >>> 1 <= 0x9394c9fL >>> 1)) {
11803: if (xf >= 0) {
11804: this.inner ().sub (x, PI_2).outer ().sub (PI_2A);
11805: return 1;
11806: } else {
11807: this.inner ().iadd (x, PI_2).outer ().add (PI_2A);
11808: return 3;
11809: }
11810: }
11811:
11812:
11813: long x0 = xd >>> -30;
11814: long x1 = xd >>> 3 & 0x7fffffffL;
11815: long x2 = (xd << 28 | xc >>> -28) & 0x7fffffffL;
11816:
11817:
11818: o = xe * 16913 >>> 19;
11819: long y0 = TWO_PI_ARRAY[o ];
11820: long y1 = TWO_PI_ARRAY[o + 1];
11821: long y2 = TWO_PI_ARRAY[o + 2];
11822: long y3 = TWO_PI_ARRAY[o + 3];
11823: long y4 = TWO_PI_ARRAY[o + 4];
11824: long y5 = TWO_PI_ARRAY[o + 5];
11825: long y6 = TWO_PI_ARRAY[o + 6];
11826: long y7 = TWO_PI_ARRAY[o + 7];
11827: long y8 = TWO_PI_ARRAY[o + 8];
11828:
11829:
11830:
11831:
11832:
11833:
11834:
11835:
11836:
11837:
11838:
11839:
11840:
11841:
11842:
11843:
11844:
11845:
11846:
11847:
11848:
11849:
11850:
11851:
11852:
11853:
11854:
11855:
11856:
11857:
11858:
11859:
11860:
11861: long z3 = (x2 * y8 >>> 31) + x1 * y8 + x2 * y7;
11862: long z2 = (z3 >>> 31) + x0 * y8 + x1 * y7 + x2 * y6;
11863: z3 = (z3 & 0x7fffffffL) + (z2 << 33 >>> 2) << 2;
11864: z2 = (z2 >>> 31) + x0 * y7 + x1 * y6 + x2 * y5;
11865: long z1 = (z2 >>> 31) + x0 * y6 + x1 * y5 + x2 * y4;
11866: z2 = (z2 & 0x7fffffffL) + (z1 << 33 >>> 2) << 2;
11867: z1 = (z1 >>> 31) + x0 * y5 + x1 * y4 + x2 * y3;
11868: long z0 = (z1 >>> 31) + x0 * y4 + x1 * y3 + x2 * y2;
11869: z1 = (z1 & 0x7fffffffL) + (z0 << 33 >>> 2) << 2;
11870: z0 = (z0 >>> 31) + x0 * y3 + x1 * y2 + x2 * y1 + (x0 * y2 + x1 * y1 + x2 * y0 << 31) << 2;
11871:
11872: z0 |= z1 >>> -2;
11873: z1 = z1 << 2 | z2 >>> -4;
11874: z2 = z2 << 4 | z3 >>> -6;
11875: z3 <<= 6;
11876:
11877: o = xe - o * 31;
11878: if (o != 0) {
11879: z0 = z0 << o | z1 >>> -o;
11880: z1 = z1 << o | z2 >>> -o;
11881: z2 = z2 << o | z3 >>> -o;
11882: z3 <<= o;
11883: }
11884:
11885: o = (int) (z0 >>> -2);
11886: if (xf < 0) {
11887: o = -o;
11888: }
11889:
11890: z0 = z0 << 2 | z1 >>> -2;
11891: z1 = z1 << 2 | z2 >>> -2;
11892: z2 = z2 << 2 | z3 >>> -2;
11893: z3 <<= 2;
11894:
11895:
11896: if (z0 < 0L) {
11897: o = xf >= 0 ? o + 1 : o - 1;
11898: t = z3 = -z3;
11899: t |= z2 = t == 0L ? -z2 : ~z2;
11900: t |= z1 = t == 0L ? -z1 : ~z1;
11901: z0 = t == 0L ? -z0 : ~z0;
11902: xf ^= M;
11903: }
11904: o &= 3;
11905:
11906: if (z0 < 0L) {
11907: xe = -1;
11908: } else if (z0 != 0L) {
11909: xe = Long.numberOfLeadingZeros (z0);
11910: z0 = z0 << xe | z1 >>> -xe;
11911: z1 = z1 << xe | z2 >>> -xe;
11912: z2 = z2 << xe | z3 >>> -xe;
11913: z3 <<= xe;
11914: xe = ~xe;
11915: } else if (z1 < 0L) {
11916: xe = -65;
11917: z0 = z1;
11918: z1 = z2;
11919: z2 = z3;
11920: z3 = 0L;
11921: } else if (z1 != 0L) {
11922: xe = Long.numberOfLeadingZeros (z1) + 64;
11923: z0 = z1 << xe | z2 >>> -xe;
11924: z1 = z2 << xe | z3 >>> -xe;
11925: z2 = z3 << xe;
11926: z3 = 0L;
11927: xe = ~xe;
11928: } else if (z2 < 0L) {
11929: xe = -129;
11930: z0 = z2;
11931: z1 = z3;
11932: z2 = 0L;
11933: z3 = 0L;
11934: } else if (z2 != 0L) {
11935: xe = Long.numberOfLeadingZeros (z2) + 128;
11936: z0 = z2 << xe | z3 >>> -xe;
11937: z1 = z3 << xe;
11938: z2 = 0L;
11939: z3 = 0L;
11940: xe = ~xe;
11941: } else if (z3 != 0L) {
11942: xe = Long.numberOfLeadingZeros (z3) + 192;
11943: z0 = z3 << xe;
11944: z1 = 0L;
11945: z2 = 0L;
11946: z3 = 0L;
11947: xe = ~xe;
11948: } else {
11949: this.flg = xf | Z;
11950: return o;
11951: }
11952:
11953: this.ifinish (xf, xe, z0, z1, z2 | z3);
11954:
11955: this.mul (PI_2);
11956:
11957: return o;
11958: }
11959:
11960:
11961:
11962:
11963:
11964:
11965:
11966:
11967:
11968:
11969:
11970:
11971:
11972:
11973:
11974:
11975:
11976:
11977:
11978:
11979:
11980:
11981:
11982:
11983:
11984:
11985:
11986:
11987:
11988:
11989:
11990:
11991:
11992:
11993:
11994:
11995:
11996:
11997:
11998:
11999:
12000:
12001:
12002:
12003:
12004:
12005:
12006:
12007:
12008:
12009:
12010:
12011:
12012: public final EFP inc () {
12013: return this.inc (this);
12014: }
12015: public final EFP inc (EFP x) {
12016:
12017:
12018: int xf = x.flg;
12019: if (xf << 1 != 0) {
12020: if (xf << 1 < 0) {
12021: this.flg = P;
12022: this.epp = 0;
12023: this.dvl = MSB;
12024: this.cvl = 0L;
12025: } else {
12026: this.flg = xf;
12027: }
12028: return this;
12029: }
12030:
12031: int xe = x.epp;
12032: if (xe < -LEN) {
12033:
12034: epbFpsr |= EPB_FPSR_X2;
12035: this.flg = P;
12036: this.epp = 0;
12037: this.dvl = MSB;
12038: this.cvl = 0L;
12039: return this;
12040: }
12041: long xd = x.dvl;
12042: long xc = x.cvl;
12043: if (LEN < xe) {
12044:
12045: epbFpsr |= EPB_FPSR_X2;
12046: return this.finish (xf, xe, xd, xc, 0L);
12047: }
12048: long xb = 0L;
12049: if (xe == 0) {
12050:
12051: if (xf < 0) {
12052:
12053: xd -= MSB;
12054: } else {
12055:
12056: xb = xc << -1;
12057: xc = xd << -1 | xc >>> 1;
12058: xd = (xd >>> 1) + (MSB >>> 1);
12059: xe++;
12060: }
12061: } else if (0 < xe) {
12062:
12063: if (xf < 0) {
12064:
12065: if (xe <= 63) {
12066: xd -= MSB >>> xe;
12067: } else {
12068: if (xc >>> ~xe != 0L) {
12069: xc -= MSB >>> xe;
12070: } else {
12071: xc |= MSB >> xe;
12072: xd--;
12073: }
12074: }
12075: } else {
12076:
12077: if (xe <= 63) {
12078: if ((xd += MSB >>> xe) >>> ~xe == 0L) {
12079: xb = xc << -1;
12080: xc = xd << -1 | xc >>> 1;
12081: xd = MSB | xd >>> 1;
12082: xe++;
12083: }
12084: } else {
12085: if ((xc += MSB >>> xe) >>> ~xe == 0L && ++xd == 0L) {
12086: xb = xc << -1;
12087: xc = xc >>> 1;
12088: xd = MSB;
12089: xe++;
12090: }
12091: }
12092: }
12093: } else {
12094:
12095: if (-63 <= xe) {
12096: xb = xc << xe;
12097: xc = xd << xe | xc >>> -xe;
12098: xd >>>= -xe;
12099: } else if (-64 == xe) {
12100: xb = xc;
12101: xc = xd;
12102: xd = 0L;
12103: } else {
12104: xb = xd << xe | xc >>> -xe;
12105: xc = xd >>> -xe;
12106: xd = 0L;
12107: }
12108: xe = 0;
12109: if (xf < 0) {
12110:
12111: if (xb != 0L) {
12112: xb = -xb;
12113: xc = -1L - xc;
12114: xd = MSB - 1L - xd;
12115: } else if (xc != 0L) {
12116: xc = -xc;
12117: xd = MSB - 1L - xd;
12118: } else {
12119: xd = MSB - xd;
12120: }
12121: xf ^= M;
12122: } else {
12123:
12124: xd |= MSB;
12125: }
12126: }
12127:
12128: if (xd >= 0L) {
12129: if (xd != 0L) {
12130: int o = Long.numberOfLeadingZeros (xd);
12131: xe -= o;
12132: xd = xd << o | xc >>> -o;
12133: xc = xc << o | xb >>> -o;
12134: xb <<= o;
12135: } else if (xc < 0L) {
12136: xe -= 64;
12137: xd = xc;
12138: xc = xb;
12139: xb = 0L;
12140: } else if (xc != 0L) {
12141: int o = 64 + Long.numberOfLeadingZeros (xc);
12142: xe -= o;
12143: xd = xc << o | xb >>> -o;
12144: xc = xb << o;
12145: xb = 0L;
12146: } else if (xb < 0L) {
12147: xe -= 128;
12148: xd = xb;
12149: xc = 0L;
12150: xb = 0L;
12151: } else if (xb != 0L) {
12152: int o = 128 + Long.numberOfLeadingZeros (xb);
12153: xe -= o;
12154: xd = xb << o;
12155: xc = 0L;
12156: xb = 0L;
12157: } else {
12158: this.flg = P | Z;
12159: return this;
12160: }
12161: }
12162: return this.finish (xf, xe, xd, xc, xb);
12163: }
12164:
12165:
12166:
12167:
12168:
12169:
12170:
12171:
12172:
12173: public boolean iseven () {
12174: int xf = this.flg;
12175: int xe = this.epp;
12176: return (xf << 1 != 0 ? xf << 3 >= 0 :
12177: xe < 0 ? false :
12178: xe > LEN - 1 ? true :
12179: xe <= 63 ? this.dvl << xe == 0L && this.cvl == 0L : this.cvl << xe == 0L);
12180: }
12181:
12182:
12183:
12184:
12185:
12186: public boolean isinf () {
12187: return this.flg << 2 < 0;
12188: }
12189:
12190:
12191:
12192:
12193:
12194:
12195:
12196:
12197:
12198: public boolean isint () {
12199: int xf = this.flg;
12200: int xe = this.epp;
12201: return (xf << 1 != 0 ? xf << 3 >= 0 :
12202: xe < 0 ? false :
12203: xe >= LEN - 1 ? true :
12204: xe <= 63 ? this.dvl << 1 << xe == 0L && this.cvl == 0L : this.cvl << xe == 0L);
12205: }
12206:
12207:
12208:
12209:
12210:
12211: public boolean isnan () {
12212: return this.flg << 3 < 0;
12213: }
12214:
12215:
12216:
12217:
12218:
12219:
12220:
12221:
12222:
12223: public boolean isodd () {
12224: int xf = this.flg;
12225: int xe = this.epp;
12226: return (xf << 1 != 0 ? false :
12227: xe < 0 ? false :
12228: xe > LEN - 1 ? false :
12229: xe <= 63 ? this.dvl << xe == MSB && this.cvl == 0L : this.cvl << xe == MSB);
12230: }
12231:
12232:
12233:
12234:
12235:
12236: public boolean isone () {
12237: return (this.flg == P &&
12238: this.epp == 0 &&
12239: this.dvl == MSB &&
12240: this.cvl == 0L);
12241: }
12242:
12243:
12244:
12245:
12246:
12247: public boolean iszero () {
12248: return this.flg << 1 < 0;
12249: }
12250:
12251:
12252:
12253:
12254:
12255:
12256:
12257:
12258:
12259:
12260:
12261: public boolean le (EFP y) {
12262: int xf = this.flg;
12263: int yf = y.flg;
12264: if ((xf | yf) << 1 != 0) {
12265: return EFP_LE_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
12266: }
12267:
12268: if (xf != yf) {
12269: return xf < yf;
12270: }
12271:
12272: int s;
12273: long t;
12274: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
12275: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
12276: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
12277: 0) <= 0;
12278: }
12279:
12280:
12281:
12282:
12283:
12284:
12285:
12286:
12287:
12288:
12289:
12290:
12291:
12292:
12293:
12294:
12295:
12296:
12297:
12298:
12299:
12300:
12301:
12302:
12303:
12304:
12305:
12306:
12307:
12308:
12309:
12310:
12311:
12312:
12313:
12314:
12315:
12316:
12317:
12318:
12319:
12320:
12321:
12322:
12323:
12324:
12325:
12326:
12327:
12328:
12329:
12330:
12331:
12332:
12333:
12334:
12335:
12336:
12337:
12338:
12339:
12340:
12341:
12342:
12343:
12344:
12345:
12346:
12347:
12348:
12349:
12350:
12351:
12352:
12353:
12354:
12355:
12356:
12357:
12358:
12359:
12360:
12361:
12362:
12363:
12364:
12365:
12366:
12367:
12368:
12369:
12370:
12371:
12372:
12373:
12374:
12375:
12376:
12377:
12378:
12379:
12380:
12381:
12382:
12383:
12384:
12385:
12386:
12387:
12388:
12389:
12390:
12391:
12392:
12393:
12394:
12395:
12396:
12397:
12398:
12399:
12400:
12401:
12402:
12403:
12404:
12405:
12406:
12407:
12408:
12409:
12410:
12411:
12412:
12413:
12414:
12415:
12416:
12417:
12418:
12419:
12420:
12421:
12422:
12423:
12424:
12425:
12426:
12427:
12428:
12429:
12430:
12431:
12432:
12433:
12434:
12435:
12436:
12437:
12438:
12439:
12440:
12441:
12442:
12443:
12444:
12445:
12446:
12447:
12448:
12449:
12450:
12451:
12452:
12453:
12454:
12455:
12456:
12457:
12458:
12459:
12460:
12461:
12462:
12463:
12464:
12465:
12466:
12467:
12468:
12469:
12470:
12471:
12472:
12473:
12474:
12475:
12476:
12477:
12478:
12479:
12480:
12481:
12482:
12483:
12484:
12485:
12486:
12487:
12488:
12489:
12490:
12491:
12492:
12493:
12494:
12495:
12496:
12497:
12498:
12499:
12500:
12501:
12502:
12503:
12504:
12505:
12506:
12507:
12508:
12509:
12510:
12511:
12512:
12513:
12514:
12515:
12516:
12517:
12518:
12519:
12520:
12521:
12522:
12523:
12524:
12525:
12526:
12527:
12528:
12529:
12530:
12531:
12532:
12533:
12534:
12535:
12536:
12537:
12538:
12539:
12540:
12541:
12542:
12543:
12544:
12545:
12546:
12547:
12548:
12549:
12550:
12551: public final EFP log () {
12552: return this.log (this);
12553: }
12554: public final EFP log (EFP x) {
12555: int xf = x.flg;
12556: if (xf != 0) {
12557: if (xf << 3 < 0) {
12558: this.flg = N;
12559: } else if (xf << 1 < 0) {
12560: epbFpsr |= EPB_FPSR_DZ;
12561: epbExceptionOperandExponent = xf & M;
12562: epbExceptionOperandMantissa = 0x0000000000000000L;
12563: this.flg = M | I;
12564: } else if (xf >= 0) {
12565: this.flg = P | I;
12566: } else {
12567: epbFpsr |= EPB_FPSR_OE;
12568: if (xf << 2 < 0) {
12569: epbExceptionOperandExponent = M | 0x7fff << 16;
12570: epbExceptionOperandMantissa = 0x0000000000000000L;
12571: } else {
12572: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12573: epbExceptionOperandMantissa = x.dvl;
12574: }
12575: this.flg = N;
12576: }
12577: return this;
12578: }
12579:
12580: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
12581: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
12582: return this;
12583: }
12584:
12585: this.inner ();
12586: if (true) {
12587:
12588: if ((x.epp == -1 && x.dvl >>> 32 == 0xffffffff00000000L >>> 32) ||
12589: (x.epp == 0 && x.dvl >>> 31 == 0x8000000000000000L >>> 31)) {
12590:
12591:
12592: EFP t = new EFP ().dec (x);
12593: return this.cub (t).div3 ().sub (new EFP ().squ (t).div2 ()).outer ().add (t);
12594: }
12595: }
12596: epbFpsr |= EPB_FPSR_X2;
12597: EFP v = new EFP (x);
12598: v.epp = v.dvl >= 0xb504f333f9de6484L ? -1 : 0;
12599: int k = x.epp - v.epp;
12600: if (true) {
12601: EFP u = new EFP ().dec (v).div (v.inc ());
12602: v.isqu (u);
12603:
12604:
12605:
12606:
12607:
12608:
12609:
12610:
12611:
12612:
12613:
12614:
12615:
12616:
12617:
12618:
12619: this.imul (LOG_C27, v)
12620: .iadd (LOG_C25).imul (v)
12621: .iadd (LOG_C23).imul (v)
12622: .iadd (LOG_C21).imul (v)
12623: .iadd (LOG_C19).imul (v)
12624: .iadd (LOG_C17).imul (v)
12625: .iadd (LOG_C15).imul (v)
12626: .iadd (LOG_C13).imul (v)
12627: .iadd (LOG_C11).imul (v)
12628: .iadd (LOG_C9).imul (v)
12629: .iadd (LOG_C7).imul (v)
12630: .iadd (LOG_C5).imul (v)
12631: .iadd (LOG_C3).imul (v)
12632: .iadd (LOG_C1).imul (u)
12633: .iadd (v.muli (LOG_2, k)).iadd (v.muli (LOG_2A, k));
12634: } else {
12635: EFP vv1 = new EFP ().dec (v);
12636: if (vv1.flg << 1 < 0) {
12637: this.muli (LOG_2, k);
12638: } else {
12639: EFP yy = ZERO;
12640: if (-1023 < vv1.epp) {
12641:
12642: long s = Double.doubleToLongBits (Math.log1p (Double.longBitsToDouble ((long) (vv1.flg | 1023 + vv1.epp << 20) << 32 | vv1.dvl << 1 >>> 12)));
12643: if (s != 0L) {
12644: int sh = (int) (s >>> 32);
12645: yy = new EFP (sh & M, (sh >>> 20 & 2047) - 1023, MSB | s << 12 >>> 1, 0L);
12646: }
12647: }
12648:
12649: vv1.expm1 (yy);
12650:
12651:
12652: v.dec ().sub (vv1);
12653: this.rcp (vv1.inc ()).imul (v).iadd (yy)
12654: .iadd (v.muli (LOG_2, k)).iadd (v.muli (LOG_2A, k));
12655: }
12656: }
12657: return outer ().finish ();
12658: }
12659:
12660:
12661:
12662:
12663:
12664:
12665:
12666:
12667:
12668:
12669:
12670:
12671:
12672:
12673:
12674:
12675:
12676:
12677:
12678:
12679:
12680:
12681:
12682:
12683:
12684:
12685:
12686:
12687:
12688:
12689:
12690:
12691:
12692:
12693:
12694:
12695:
12696:
12697:
12698:
12699:
12700:
12701:
12702:
12703:
12704:
12705:
12706:
12707:
12708:
12709:
12710:
12711:
12712:
12713:
12714:
12715: public final EFP log10 () {
12716: return this.log10 (this);
12717: }
12718: public final EFP log10 (EFP x) {
12719:
12720: int xf = x.flg;
12721: if (xf != 0) {
12722: if (xf << 3 < 0) {
12723: this.flg = N;
12724: } else if (xf << 1 < 0) {
12725: epbFpsr |= EPB_FPSR_DZ;
12726: epbExceptionOperandExponent = xf & M;
12727: epbExceptionOperandMantissa = 0x0000000000000000L;
12728: this.flg = M | I;
12729: } else if (xf >= 0) {
12730: epbExceptionOperandExponent = 0x7fff << 16;
12731: epbExceptionOperandMantissa = 0x0000000000000000L;
12732: this.flg = P | I;
12733: } else {
12734: epbFpsr |= EPB_FPSR_OE;
12735: if (xf << 2 < 0) {
12736: epbExceptionOperandExponent = M | 0x7fff << 16;
12737: epbExceptionOperandMantissa = 0x0000000000000000L;
12738: } else {
12739: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12740: epbExceptionOperandMantissa = x.dvl;
12741: }
12742: this.flg = N;
12743: }
12744: return this;
12745: }
12746:
12747: int xe = x.epp;
12748:
12749: if (xe == 0 && x.dvl == MSB && x.cvl == 0L) {
12750: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
12751: return this;
12752: }
12753:
12754: if (3 <= xe && xe <= 129) {
12755: EFP t = ACCURATE_LOG10_BASE[xe];
12756: if (t != null && x.dvl == t.dvl && x.cvl == t.cvl) {
12757:
12758: epbFpsr |= EPB_FPSR_X2;
12759:
12760:
12761: return this.seti ((xe + 1) * 617 >> 11);
12762: }
12763: }
12764:
12765: this.inner ();
12766: epbFpsr |= EPB_FPSR_X2;
12767: EFP v = new EFP (x);
12768: v.epp = v.dvl >= 0xb504f333f9de6484L ? -1 : 0;
12769: int k = x.epp - v.epp;
12770: EFP u = new EFP ().dec (v).div (v.inc ());
12771: v.isqu (u);
12772: this.imul (LOG10_C27, v)
12773: .iadd (LOG10_C25).imul (v)
12774: .iadd (LOG10_C23).imul (v)
12775: .iadd (LOG10_C21).imul (v)
12776: .iadd (LOG10_C19).imul (v)
12777: .iadd (LOG10_C17).imul (v)
12778: .iadd (LOG10_C15).imul (v)
12779: .iadd (LOG10_C13).imul (v)
12780: .iadd (LOG10_C11).imul (v)
12781: .iadd (LOG10_C9).imul (v)
12782: .iadd (LOG10_C7).imul (v)
12783: .iadd (LOG10_C5).imul (v)
12784: .iadd (LOG10_C3).imul (v)
12785: .iadd (LOG10_C1).imul (u)
12786: .iadd (u.muli (LOG10_2, k));
12787: u.muli (LOG10_2A, k);
12788: return this.outer ().add (u);
12789: }
12790:
12791:
12792:
12793:
12794:
12795:
12796:
12797:
12798:
12799:
12800:
12801:
12802:
12803:
12804:
12805:
12806:
12807:
12808:
12809:
12810:
12811:
12812:
12813:
12814:
12815:
12816:
12817:
12818:
12819:
12820:
12821:
12822:
12823:
12824:
12825:
12826:
12827:
12828:
12829:
12830:
12831:
12832:
12833:
12834:
12835:
12836:
12837:
12838:
12839:
12840:
12841:
12842:
12843:
12844:
12845:
12846:
12847:
12848:
12849:
12850:
12851:
12852:
12853:
12854:
12855:
12856:
12857:
12858:
12859:
12860:
12861:
12862:
12863:
12864:
12865: public final EFP log1p () {
12866: return this.log1p (this);
12867: }
12868: public final EFP log1p (EFP x) {
12869: int xf = x.flg;
12870: if (xf << 1 != 0) {
12871: if (xf << 3 < 0) {
12872: this.flg = N;
12873: } else if (xf << 1 < 0) {
12874: this.flg = xf;
12875: } else if (xf >= 0) {
12876: this.flg = P | I;
12877: } else {
12878: epbFpsr |= EPB_FPSR_OE;
12879: epbExceptionOperandExponent = M | 0x7fff << 16;
12880: epbExceptionOperandMantissa = 0x0000000000000000L;
12881: this.flg = N;
12882: }
12883: return this;
12884: }
12885:
12886: if (xf < 0) {
12887: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
12888: epbFpsr |= EPB_FPSR_DZ;
12889: epbExceptionOperandExponent = M | 0x3fff << 16;
12890: epbExceptionOperandMantissa = 0x8000000000000000L;
12891: this.flg = M | I;
12892: return this;
12893: } else if (x.epp >= 0) {
12894: epbFpsr |= EPB_FPSR_OE;
12895: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12896: epbExceptionOperandMantissa = x.dvl;
12897: this.flg = N;
12898: return this;
12899: }
12900: }
12901: epbFpsr |= EPB_FPSR_X2;
12902:
12903: if (LOG1P_A.le (x) && x.le (LOG1P_B)) {
12904: int savedFpsr = epbFpsr;
12905: this.inner ();
12906: if (this == x) {
12907: x = new EFP (x);
12908: }
12909: EFP u = new EFP ().iadd (x, TWO).rcpdiv (x);
12910: EFP v = new EFP ().isqu (u);
12911:
12912:
12913:
12914:
12915:
12916:
12917:
12918:
12919:
12920:
12921:
12922:
12923:
12924:
12925:
12926: this.imul (LOG_C27, v)
12927: .iadd (LOG_C25).imul (v)
12928: .iadd (LOG_C23).imul (v)
12929: .iadd (LOG_C21).imul (v)
12930: .iadd (LOG_C19).imul (v)
12931: .iadd (LOG_C17).imul (v)
12932: .iadd (LOG_C15).imul (v)
12933: .iadd (LOG_C13).imul (v)
12934: .iadd (LOG_C11).imul (v)
12935: .iadd (LOG_C9).imul (v)
12936: .iadd (LOG_C7).imul (v)
12937: .iadd (LOG_C5).imul (v)
12938: .iadd (LOG_C3).imul (v)
12939: .iadd (LOG_C1).outer ().mul (u);
12940: return this.originLowerLower (x).correctUnderflow (savedFpsr);
12941: }
12942: return this.inner ().inc (x).outer ().log ();
12943: }
12944:
12945:
12946:
12947:
12948:
12949:
12950:
12951:
12952:
12953:
12954:
12955:
12956:
12957:
12958:
12959:
12960:
12961:
12962:
12963:
12964:
12965:
12966:
12967:
12968:
12969:
12970:
12971:
12972:
12973:
12974:
12975:
12976:
12977:
12978:
12979:
12980:
12981:
12982:
12983:
12984:
12985:
12986:
12987:
12988:
12989:
12990:
12991:
12992:
12993:
12994:
12995:
12996:
12997:
12998:
12999:
13000:
13001:
13002:
13003:
13004:
13005:
13006:
13007:
13008:
13009:
13010:
13011:
13012:
13013:
13014:
13015:
13016:
13017:
13018:
13019:
13020:
13021:
13022:
13023:
13024:
13025:
13026:
13027:
13028:
13029:
13030:
13031:
13032:
13033:
13034:
13035:
13036:
13037:
13038:
13039:
13040:
13041:
13042:
13043:
13044:
13045:
13046:
13047:
13048:
13049:
13050:
13051:
13052:
13053:
13054:
13055:
13056:
13057: public final EFP log2 () {
13058: return this.log2 (this);
13059: }
13060: public final EFP log2 (EFP x) {
13061:
13062: int xf = x.flg;
13063: if (xf != 0) {
13064: if (xf << 3 < 0) {
13065: this.flg = N;
13066: } else if (xf << 1 < 0) {
13067: epbFpsr |= EPB_FPSR_DZ;
13068: epbExceptionOperandExponent = xf & M;
13069: epbExceptionOperandMantissa = 0x0000000000000000L;
13070: this.flg = M | I;
13071: } else if (xf >= 0) {
13072: this.flg = P | I;
13073: } else {
13074: epbFpsr |= EPB_FPSR_OE;
13075: if (xf << 2 < 0) {
13076: epbExceptionOperandExponent = M | 0x7fff << 16;
13077: epbExceptionOperandMantissa = 0x0000000000000000L;
13078: } else {
13079: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
13080: epbExceptionOperandMantissa = x.dvl;
13081: }
13082: this.flg = N;
13083: }
13084: return this;
13085: }
13086:
13087:
13088: if (x.dvl == MSB && x.cvl == 0L) {
13089: if (x.epp == 0) {
13090: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
13091: } else {
13092:
13093: epbFpsr |= EPB_FPSR_X2;
13094: this.seti (x.epp);
13095: }
13096: return this;
13097: }
13098:
13099: this.inner ();
13100: epbFpsr |= EPB_FPSR_X2;
13101: EFP v = new EFP (x);
13102: v.epp = v.dvl >= 0xb504f333f9de6484L ? -1 : 0;
13103: int k = x.epp - v.epp;
13104: EFP u = new EFP ().dec (v).div (v.inc ());
13105: v.isqu (u);
13106: this.imul (LOG2_C27, v)
13107: .iadd (LOG2_C25).imul (v)
13108: .iadd (LOG2_C23).imul (v)
13109: .iadd (LOG2_C21).imul (v)
13110: .iadd (LOG2_C19).imul (v)
13111: .iadd (LOG2_C17).imul (v)
13112: .iadd (LOG2_C15).imul (v)
13113: .iadd (LOG2_C13).imul (v)
13114: .iadd (LOG2_C11).imul (v)
13115: .iadd (LOG2_C9).imul (v)
13116: .iadd (LOG2_C7).imul (v)
13117: .iadd (LOG2_C5).imul (v)
13118: .iadd (LOG2_C3).imul (v)
13119: .iadd (LOG2_C1).imul (u);
13120: u.seti (k);
13121: return this.outer ().add (u);
13122: }
13123:
13124:
13125:
13126:
13127:
13128:
13129:
13130:
13131:
13132:
13133:
13134:
13135:
13136:
13137:
13138:
13139:
13140:
13141:
13142:
13143:
13144:
13145:
13146:
13147:
13148:
13149:
13150:
13151:
13152:
13153:
13154:
13155:
13156:
13157:
13158:
13159:
13160:
13161:
13162:
13163:
13164:
13165:
13166:
13167:
13168:
13169:
13170:
13171:
13172:
13173:
13174:
13175:
13176:
13177:
13178:
13179:
13180:
13181:
13182:
13183:
13184:
13185:
13186:
13187:
13188:
13189:
13190:
13191:
13192:
13193:
13194:
13195:
13196:
13197: public final EFP lgamma () {
13198: return this.lgamma (this);
13199: }
13200: public final EFP lgamma (EFP x) {
13201: int xf = x.flg;
13202: if (xf != 0) {
13203: this.flg = (xf == (P | Z) || xf == (P | I) ? P | I :
13204: N);
13205: return this;
13206: }
13207:
13208: this.inner ();
13209: x = new EFP (x);
13210: EFP d = null;
13211: if (x.lt (THIRTEEN)) {
13212: d = new EFP (ONE);
13213: do {
13214: d.mul (x);
13215: x.inc ();
13216: } while (x.lt (THIRTEEN));
13217: }
13218: EFP t = new EFP ().rcp (x);
13219: EFP t2 = new EFP ().squ (t);
13220: this.mul (LGAMMA_C14, t2)
13221: .add (LGAMMA_C13).mul (t2)
13222: .add (LGAMMA_C12).mul (t2)
13223: .add (LGAMMA_C11).mul (t2)
13224: .add (LGAMMA_C10).mul (t2)
13225: .add (LGAMMA_C9).mul (t2)
13226: .add (LGAMMA_C8).mul (t2)
13227: .add (LGAMMA_C7).mul (t2)
13228: .add (LGAMMA_C6).mul (t2)
13229: .add (LGAMMA_C5).mul (t2)
13230: .add (LGAMMA_C4).mul (t2)
13231: .add (LGAMMA_C3).mul (t2)
13232: .add (LGAMMA_C2).mul (t2)
13233: .add (LGAMMA_C1).mul (t)
13234: .add (LOGTWOPI_2).sub (x);
13235: t.sub (x, ONE_2);
13236: this.add (x.log ().mul (t));
13237: if (d != null) {
13238: this.sub (d.log ());
13239: }
13240: return this.outer ().finish ();
13241: }
13242:
13243:
13244:
13245:
13246:
13247:
13248:
13249:
13250:
13251:
13252:
13253: public boolean lt (EFP y) {
13254: int xf = this.flg;
13255: int yf = y.flg;
13256: if ((xf | yf) << 1 != 0) {
13257: return EFP_LT_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
13258: }
13259:
13260: if (xf != yf) {
13261: return xf < yf;
13262: }
13263:
13264: int s;
13265: long t;
13266: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
13267: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
13268: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
13269: 0) < 0;
13270: }
13271:
13272:
13273:
13274:
13275:
13276:
13277:
13278:
13279:
13280:
13281:
13282: public final EFP max (EFP y) {
13283: return this.max (this, y);
13284: }
13285: public final EFP max (EFP x, EFP y) {
13286: if ((x.flg | y.flg) << 3 < 0) {
13287: this.flg = N;
13288: } else if (x.compareTo (y) >= 0) {
13289: this.flg = x.flg;
13290: this.epp = x.epp;
13291: this.dvl = x.dvl;
13292: this.cvl = x.cvl;
13293: } else {
13294: this.flg = y.flg;
13295: this.epp = y.epp;
13296: this.dvl = y.dvl;
13297: this.cvl = y.cvl;
13298: }
13299: return this;
13300: }
13301:
13302:
13303:
13304:
13305:
13306:
13307:
13308:
13309:
13310:
13311:
13312: public final EFP min (EFP y) {
13313: return this.min (this, y);
13314: }
13315: public final EFP min (EFP x, EFP y) {
13316: if ((x.flg | y.flg) << 3 < 0) {
13317: this.flg = N;
13318: } else if (x.compareTo (y) <= 0) {
13319: this.flg = x.flg;
13320: this.epp = x.epp;
13321: this.dvl = x.dvl;
13322: this.cvl = x.cvl;
13323: } else {
13324: this.flg = y.flg;
13325: this.epp = y.epp;
13326: this.dvl = y.dvl;
13327: this.cvl = y.cvl;
13328: }
13329: return this;
13330: }
13331:
13332:
13333:
13334:
13335:
13336:
13337:
13338:
13339:
13340:
13341:
13342:
13343:
13344:
13345:
13346:
13347:
13348:
13349:
13350:
13351:
13352:
13353:
13354:
13355:
13356:
13357:
13358:
13359:
13360:
13361:
13362:
13363:
13364:
13365:
13366:
13367:
13368:
13369:
13370:
13371:
13372:
13373:
13374:
13375:
13376:
13377:
13378:
13379:
13380:
13381:
13382:
13383:
13384:
13385:
13386: public final EFP mul (EFP y) {
13387: int xf = this.flg;
13388: int yf = y.flg;
13389: {
13390: int o;
13391: if ((o = xf | yf) << 1 != 0) {
13392: if (o << 3 < 0) {
13393: this.flg = N;
13394: } else if ((o &= (Z | I)) == (Z | I)) {
13395: epbFpsr |= EPB_FPSR_OE;
13396: if (yf << 1 < 0) {
13397: epbExceptionOperandExponent = yf & M;
13398: epbExceptionOperandMantissa = 0x0000000000000000L;
13399: } else {
13400: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13401: epbExceptionOperandMantissa = 0x0000000000000000L;
13402: }
13403: this.flg = N;
13404: } else {
13405: this.flg = (xf ^ yf) & M | o;
13406: }
13407: return this;
13408: }
13409: }
13410:
13411: int zf = xf ^ yf;
13412:
13413: int ze = this.epp + y.epp;
13414:
13415:
13416:
13417:
13418:
13419:
13420:
13421: long xh = this.dvl;
13422: long yh = y.dvl;
13423: long xl = (xh << -2 | this.cvl >>> 2) >>> -30;
13424:
13425:
13426:
13427: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13428: long xm = xh << 32 >>> -30;
13429:
13430: long ym = yh << 32 >>> -30;
13431: xh >>>= 32;
13432: yh >>>= 32;
13433:
13434:
13435:
13436:
13437:
13438:
13439:
13440:
13441:
13442:
13443:
13444:
13445:
13446:
13447: long zb = xl * yl;
13448: long zc = xl * yh + yl * xh + xm * ym;
13449: long zd = xh * yh;
13450: xl *= ym;
13451: yl *= xm;
13452: xm *= yh;
13453: ym *= xh;
13454: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13455: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13456: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13457: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13458: zb <<= 4;
13459: zc <<= 4;
13460:
13461:
13462: if (zd < 0L) {
13463: ze++;
13464: } else {
13465: zd = zd << 1 | zc >>> -1;
13466: zc <<= 1;
13467: }
13468: return this.finish2 (zf, ze, zd, zc, zb);
13469: }
13470: public final EFP imul (EFP y) {
13471: int xf = this.flg;
13472: int yf = y.flg;
13473: {
13474: int o;
13475: if ((o = xf | yf) << 1 != 0) {
13476: if (o << 3 < 0) {
13477: this.flg = N;
13478: } else if ((o &= (Z | I)) == (Z | I)) {
13479: epbFpsr |= EPB_FPSR_OE;
13480: if (yf << 1 < 0) {
13481: epbExceptionOperandExponent = yf & M;
13482: epbExceptionOperandMantissa = 0x0000000000000000L;
13483: } else {
13484: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13485: epbExceptionOperandMantissa = 0x0000000000000000L;
13486: }
13487: this.flg = N;
13488: } else {
13489: this.flg = (xf ^ yf) & M | o;
13490: }
13491: return this;
13492: }
13493: }
13494:
13495: int zf = xf ^ yf;
13496:
13497: int ze = this.epp + y.epp;
13498:
13499:
13500:
13501:
13502:
13503:
13504:
13505: long xh = this.dvl;
13506: long yh = y.dvl;
13507: long xl = (xh << -2 | this.cvl >>> 2) >>> -30;
13508:
13509:
13510:
13511: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13512: long xm = xh << 32 >>> -30;
13513:
13514: long ym = yh << 32 >>> -30;
13515: xh >>>= 32;
13516: yh >>>= 32;
13517:
13518:
13519:
13520:
13521:
13522:
13523:
13524:
13525:
13526:
13527:
13528:
13529:
13530:
13531: long zb = xl * yl;
13532: long zc = xl * yh + yl * xh + xm * ym;
13533: long zd = xh * yh;
13534: xl *= ym;
13535: yl *= xm;
13536: xm *= yh;
13537: ym *= xh;
13538: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13539: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13540: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13541: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13542: zb <<= 4;
13543: zc <<= 4;
13544:
13545:
13546: if (zd < 0L) {
13547: ze++;
13548: } else {
13549: zd = zd << 1 | zc >>> -1;
13550: zc <<= 1;
13551: }
13552: return this.ifinish (zf, ze, zd, zc, zb);
13553: }
13554: public final EFP mul (EFP x, EFP y) {
13555: int xf = x.flg;
13556: int yf = y.flg;
13557: {
13558: int o;
13559: if ((o = xf | yf) << 1 != 0) {
13560: if (o << 3 < 0) {
13561: this.flg = N;
13562: } else if ((o &= (Z | I)) == (Z | I)) {
13563: epbFpsr |= EPB_FPSR_OE;
13564: if (yf << 1 < 0) {
13565: epbExceptionOperandExponent = yf & M;
13566: epbExceptionOperandMantissa = 0x0000000000000000L;
13567: } else {
13568: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13569: epbExceptionOperandMantissa = 0x0000000000000000L;
13570: }
13571: this.flg = N;
13572: } else {
13573: this.flg = (xf ^ yf) & M | o;
13574: }
13575: return this;
13576: }
13577: }
13578:
13579: int zf = xf ^ yf;
13580:
13581: int ze = x.epp + y.epp;
13582:
13583:
13584:
13585:
13586:
13587:
13588:
13589: long xh = x.dvl;
13590: long yh = y.dvl;
13591: long xl = (xh << -2 | x.cvl >>> 2) >>> -30;
13592:
13593:
13594:
13595: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13596: long xm = xh << 32 >>> -30;
13597:
13598: long ym = yh << 32 >>> -30;
13599: xh >>>= 32;
13600: yh >>>= 32;
13601:
13602:
13603:
13604:
13605:
13606:
13607:
13608:
13609:
13610:
13611:
13612:
13613:
13614:
13615: long zb = xl * yl;
13616: long zc = xl * yh + yl * xh + xm * ym;
13617: long zd = xh * yh;
13618: xl *= ym;
13619: yl *= xm;
13620: xm *= yh;
13621: ym *= xh;
13622: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13623: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13624: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13625: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13626: zb <<= 4;
13627: zc <<= 4;
13628:
13629:
13630: if (zd < 0L) {
13631: ze++;
13632: } else {
13633: zd = zd << 1 | zc >>> -1;
13634: zc <<= 1;
13635: }
13636: return this.finish2 (zf, ze, zd, zc, zb);
13637: }
13638: public final EFP imul (EFP x, EFP y) {
13639: int xf = x.flg;
13640: int yf = y.flg;
13641: {
13642: int o;
13643: if ((o = xf | yf) << 1 != 0) {
13644: if (o << 3 < 0) {
13645: this.flg = N;
13646: } else if ((o &= (Z | I)) == (Z | I)) {
13647: epbFpsr |= EPB_FPSR_OE;
13648: if (yf << 1 < 0) {
13649: epbExceptionOperandExponent = yf & M;
13650: epbExceptionOperandMantissa = 0x0000000000000000L;
13651: } else {
13652: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13653: epbExceptionOperandMantissa = 0x0000000000000000L;
13654: }
13655: this.flg = N;
13656: } else {
13657: this.flg = (xf ^ yf) & M | o;
13658: }
13659: return this;
13660: }
13661: }
13662:
13663: int zf = xf ^ yf;
13664:
13665: int ze = x.epp + y.epp;
13666:
13667:
13668:
13669:
13670:
13671:
13672:
13673: long xh = x.dvl;
13674: long yh = y.dvl;
13675: long xl = (xh << -2 | x.cvl >>> 2) >>> -30;
13676:
13677:
13678:
13679: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13680: long xm = xh << 32 >>> -30;
13681:
13682: long ym = yh << 32 >>> -30;
13683: xh >>>= 32;
13684: yh >>>= 32;
13685:
13686:
13687:
13688:
13689:
13690:
13691:
13692:
13693:
13694:
13695:
13696:
13697:
13698:
13699: long zb = xl * yl;
13700: long zc = xl * yh + yl * xh + xm * ym;
13701: long zd = xh * yh;
13702: xl *= ym;
13703: yl *= xm;
13704: xm *= yh;
13705: ym *= xh;
13706: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13707: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13708: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13709: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13710: zb <<= 4;
13711: zc <<= 4;
13712:
13713:
13714: if (zd < 0L) {
13715: ze++;
13716: } else {
13717: zd = zd << 1 | zc >>> -1;
13718: zc <<= 1;
13719: }
13720: return this.ifinish (zf, ze, zd, zc, zb);
13721: }
13722:
13723:
13724:
13725:
13726:
13727:
13728:
13729:
13730:
13731:
13732:
13733:
13734:
13735:
13736:
13737:
13738:
13739:
13740:
13741:
13742:
13743:
13744:
13745:
13746:
13747:
13748:
13749:
13750:
13751:
13752:
13753:
13754:
13755:
13756:
13757:
13758:
13759:
13760:
13761:
13762:
13763:
13764:
13765:
13766:
13767:
13768:
13769:
13770:
13771:
13772:
13773:
13774:
13775:
13776:
13777:
13778:
13779:
13780:
13781:
13782:
13783:
13784:
13785:
13786:
13787:
13788:
13789:
13790:
13791:
13792:
13793:
13794:
13795:
13796:
13797:
13798:
13799:
13800:
13801:
13802:
13803:
13804:
13805:
13806:
13807:
13808:
13809:
13810:
13811:
13812:
13813:
13814:
13815:
13816: public final EFP mul2 () {
13817: return this.finish (this.flg, this.epp + 1, this.dvl, this.cvl, 0L);
13818: }
13819: public final EFP imul2 () {
13820: this.epp++;
13821: return this;
13822: }
13823: public final EFP mul2 (EFP x) {
13824: return this.finish (x.flg, x.epp + 1, x.dvl, x.cvl, 0L);
13825: }
13826: public final EFP imul2 (EFP x) {
13827: this.flg = x.flg;
13828: this.epp = x.epp + 1;
13829: this.dvl = x.dvl;
13830: this.cvl = x.cvl;
13831: return this;
13832: }
13833:
13834:
13835:
13836:
13837:
13838:
13839:
13840:
13841:
13842:
13843:
13844:
13845:
13846:
13847:
13848:
13849:
13850:
13851:
13852:
13853:
13854:
13855:
13856:
13857:
13858:
13859:
13860:
13861:
13862:
13863:
13864:
13865:
13866:
13867:
13868:
13869:
13870:
13871:
13872:
13873:
13874:
13875:
13876:
13877:
13878:
13879:
13880:
13881:
13882:
13883:
13884:
13885:
13886: public final EFP mul3 () {
13887: return this.muli (this, 3);
13888: }
13889: public final EFP mul3 (EFP x) {
13890:
13891: int xf = x.flg;
13892: if (xf << 1 != 0) {
13893: this.flg = xf;
13894: return this;
13895: }
13896:
13897: int ze = x.epp + 1;
13898: long zd = x.dvl;
13899: long zc = x.cvl;
13900: long t = zc;
13901: zc += (zc >>> 1);
13902: zd += (zd >>> 1) + ((zc & ~t) >>> -1);
13903: if (zd >= 0L) {
13904: zc = zd << -1 | zc >>> 1;
13905: zd = MSB | zd >>> 1;
13906: ze++;
13907: }
13908: return this.finish (xf, ze, zd, zc, 0L);
13909: }
13910:
13911:
13912:
13913:
13914:
13915:
13916:
13917:
13918: public final EFP muli (int n) {
13919: return this.muli (this, n);
13920: }
13921: public final EFP muli (EFP x, int n) {
13922:
13923: int xf = x.flg;
13924: if (n == 0) {
13925: this.flg = (xf & (I | N)) != 0 ? N : xf | Z;
13926: return this;
13927: }
13928: if (xf << 1 != 0) {
13929: this.flg = xf << 3 < 0 ? N : xf ^ (n & M);
13930: return this;
13931: }
13932:
13933: int ze = x.epp;
13934: long zd = x.dvl;
13935: long zc = x.cvl;
13936: if (n < 0) {
13937: xf ^= M;
13938: if (n == 0x80000000) {
13939: ze += 31;
13940: if ((short) ze != ze) {
13941: epbFpsr |= EPB_FPSR_OF;
13942: epbExceptionOperandExponent = xf;
13943: epbExceptionOperandMantissa = zd;
13944: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
13945: }
13946: this.flg = xf;
13947: this.epp = ze;
13948: this.dvl = zd;
13949: this.cvl = zc;
13950: return this;
13951: }
13952: n = -n;
13953: }
13954: if (n > 1) {
13955: long y = (long) n;
13956:
13957:
13958:
13959:
13960:
13961:
13962:
13963:
13964:
13965: zc = (zc >>> 32) * y;
13966: long t = (zd & 0xffffffffL) * y + (zc >>> 32);
13967: zc = t << 32 | (zc & 0xffffffffL);
13968: zd = (zd >>> 32) * y + (t >>> 32);
13969:
13970: int o = Long.numberOfLeadingZeros (zd);
13971: ze += 32 - o;
13972: if (o > 0) {
13973: zd = zd << o | zc >>> -o;
13974: zc <<= o;
13975: }
13976: }
13977: return this.finish (xf, ze, zd, zc, 0L);
13978: }
13979:
13980:
13981:
13982:
13983:
13984:
13985:
13986:
13987:
13988:
13989:
13990:
13991:
13992:
13993:
13994:
13995:
13996:
13997:
13998:
13999:
14000:
14001:
14002:
14003:
14004:
14005:
14006:
14007:
14008:
14009:
14010:
14011:
14012:
14013:
14014:
14015:
14016:
14017:
14018:
14019:
14020:
14021:
14022:
14023:
14024:
14025:
14026:
14027:
14028:
14029:
14030:
14031:
14032: public final EFP mulpi () {
14033: return this.mul (this, PI);
14034: }
14035: public final EFP mulpi (EFP x) {
14036: return this.mul (x, PI);
14037: }
14038:
14039:
14040:
14041:
14042:
14043:
14044:
14045:
14046:
14047:
14048:
14049: public final EFP imulw (EFP w, EFP x, EFP y) {
14050: int xf = x.flg;
14051: int yf = y.flg;
14052: {
14053: int o;
14054: if ((o = xf | yf) << 1 != 0) {
14055: if (o << 3 < 0) {
14056: this.flg = N;
14057: } else if ((o &= (Z | I)) == (Z | I)) {
14058: epbFpsr |= EPB_FPSR_OE;
14059: if (yf << 1 < 0) {
14060: epbExceptionOperandExponent = yf & M;
14061: epbExceptionOperandMantissa = 0x0000000000000000L;
14062: } else {
14063: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
14064: epbExceptionOperandMantissa = 0x0000000000000000L;
14065: }
14066: this.flg = N;
14067: } else {
14068: this.flg = (xf ^ yf) & M | o;
14069: }
14070: w.flg = this.flg;
14071: return this;
14072: }
14073: }
14074:
14075: int zf = xf ^ yf;
14076:
14077: int ze = x.epp + y.epp;
14078:
14079:
14080:
14081:
14082:
14083:
14084:
14085: long xh = x.dvl;
14086: long yh = y.dvl;
14087: long xl = (xh << -2 | x.cvl >>> 2) >>> -30;
14088:
14089:
14090:
14091: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
14092: long xm = xh << 32 >>> -30;
14093:
14094: long ym = yh << 32 >>> -30;
14095: xh >>>= 32;
14096: yh >>>= 32;
14097:
14098:
14099:
14100:
14101:
14102:
14103:
14104:
14105:
14106:
14107:
14108:
14109:
14110:
14111: long zb = xl * yl;
14112: long zc = xl * yh + yl * xh + xm * ym;
14113: long zd = xh * yh;
14114: xl *= ym;
14115: yl *= xm;
14116: xm *= yh;
14117: ym *= xh;
14118: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
14119: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
14120: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
14121: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
14122: zb <<= 4;
14123: zc = zc << 4 | zb >>> -4;
14124: zb <<= 4;
14125:
14126:
14127: if (zd < 0L) {
14128: ze++;
14129: } else {
14130: zd = zd << 1 | zc >>> -1;
14131: zc = zc << 1 | zb >>> -1;
14132: zb <<= 1;
14133: }
14134:
14135:
14136:
14137:
14138:
14139:
14140:
14141:
14142:
14143:
14144: int wf = zf;
14145: int we = ze - LEN;
14146: long wd = zc << LEN - 64 | zb >>> -(LEN - 64);
14147: long wc = zb << LEN - 64;
14148: zc &= -LSB;
14149:
14150:
14151: if (wd < 0L && (zc & LSB | wd << 1 | wc) != 0L) {
14152:
14153: wf ^= M;
14154: wc = -(wc >>> 1);
14155: wd = -wd - (wc >>> -1);
14156: wc <<= 1;
14157:
14158: if ((zc += LSB) == 0L && ++zd == 0L) {
14159: zd = MSB;
14160: ze++;
14161: }
14162: }
14163:
14164: if (wd >= 0L) {
14165: if (wd != 0L) {
14166: int o = Long.numberOfLeadingZeros (wd);
14167: we -= o;
14168: wd = wd << o | wc >>> -o;
14169: wc <<= o;
14170: } else if (wc != 0L) {
14171: int o = Long.numberOfLeadingZeros (wc);
14172: we -= 64 + o;
14173: wd = wc << o;
14174: wc = 0L;
14175: } else {
14176: wf |= Z;
14177: }
14178: }
14179:
14180: if (ze > 32767) {
14181: epbFpsr |= EPB_FPSR_OF;
14182: epbExceptionOperandExponent = zf;
14183: epbExceptionOperandMantissa = zd;
14184: return this.sete (w.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | zf >>> 31]));
14185: } else if (ze < -32768 || wf << 1 >= 0 && we < -32768) {
14186: epbFpsr |= EPB_FPSR_UF;
14187: epbExceptionOperandExponent = zf;
14188: epbExceptionOperandMantissa = zd;
14189: return this.sete (w.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | zf >>> 31]));
14190: } else {
14191: this.flg = zf;
14192: this.epp = ze;
14193: this.dvl = zd;
14194: this.cvl = zc;
14195: w.flg = wf;
14196: w.epp = we;
14197: w.dvl = wd;
14198: w.cvl = wc;
14199: return this;
14200: }
14201: }
14202:
14203:
14204:
14205:
14206:
14207:
14208:
14209:
14210:
14211:
14212:
14213: public boolean ne (EFP y) {
14214: int xf = this.flg;
14215: int yf = y.flg;
14216: return ((xf | yf) << 1 != 0 ?
14217: EFP_NE_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0
14218: :
14219: xf != yf || this.epp != y.epp || this.dvl != y.dvl || this.cvl != y.cvl);
14220: }
14221:
14222:
14223:
14224:
14225:
14226:
14227:
14228:
14229:
14230:
14231:
14232:
14233:
14234:
14235:
14236:
14237:
14238:
14239:
14240:
14241:
14242:
14243:
14244:
14245:
14246:
14247:
14248:
14249:
14250:
14251:
14252:
14253:
14254:
14255:
14256:
14257:
14258:
14259:
14260:
14261:
14262:
14263:
14264:
14265:
14266:
14267:
14268:
14269:
14270:
14271:
14272:
14273:
14274:
14275:
14276:
14277:
14278:
14279: public final EFP neg () {
14280: return this.finish (0 <= this.flg << 3 ? this.flg ^ M : this.flg, this.epp, this.dvl, this.cvl, 0L);
14281: }
14282: public final EFP ineg () {
14283: if (0 <= this.flg << 3) {
14284: this.flg ^= M;
14285: }
14286: return this;
14287: }
14288: public final EFP neg (boolean b) {
14289: return this.finish (b && 0 <= this.flg << 3 ? this.flg ^ M : this.flg, this.epp, this.dvl, this.cvl, 0L);
14290: }
14291: public final EFP ineg (boolean b) {
14292: if (b && 0 <= this.flg << 3) {
14293: this.flg ^= M;
14294: }
14295: return this;
14296: }
14297: public final EFP neg (EFP x) {
14298: return this.finish (0 <= x.flg << 3 ? x.flg ^ M : x.flg, x.epp, x.dvl, x.cvl, 0L);
14299: }
14300: public final EFP ineg (EFP x) {
14301: this.flg = 0 <= x.flg << 3 ? x.flg ^ M : x.flg;
14302: this.epp = x.epp;
14303: this.dvl = x.dvl;
14304: this.cvl = x.cvl;
14305: return this;
14306: }
14307: public final EFP neg (EFP x, boolean b) {
14308: return this.finish (b && 0 <= x.flg << 3 ? x.flg ^ M : x.flg, x.epp, x.dvl, x.cvl, 0L);
14309: }
14310: public final EFP ineg (EFP x, boolean b) {
14311: this.flg = b && 0 <= x.flg << 3 ? x.flg ^ M : x.flg;
14312: this.epp = x.epp;
14313: this.dvl = x.dvl;
14314: this.cvl = x.cvl;
14315: return this;
14316: }
14317:
14318:
14319:
14320:
14321:
14322:
14323:
14324:
14325:
14326:
14327: public final EFP negdec () {
14328: return this.inner ().dec ().outer ().neg (0 <= this.flg << 1);
14329: }
14330: public final EFP negdec (EFP x) {
14331: return this.inner ().dec (x).outer ().neg (0 <= this.flg << 1);
14332: }
14333:
14334:
14335:
14336:
14337:
14338: public final EFP negset0 () {
14339: this.flg = M | Z;
14340:
14341:
14342:
14343: return this;
14344: }
14345:
14346:
14347:
14348:
14349:
14350: public final EFP negset1 () {
14351: this.flg = M;
14352: this.epp = 0;
14353: this.dvl = MSB;
14354: this.cvl = 0L;
14355: return this;
14356: }
14357:
14358:
14359:
14360:
14361:
14362: public final EFP negsetinf () {
14363: this.flg = M | I;
14364:
14365:
14366:
14367: return this;
14368: }
14369:
14370:
14371:
14372:
14373:
14374:
14375:
14376:
14377:
14378: public final EFP negsub (EFP y) {
14379: int xf = y.flg;
14380: int xe = y.epp;
14381: long xd = y.dvl;
14382: long xc = y.cvl;
14383: long xb = 0L;
14384: int yf = this.flg;
14385: if ((xf | yf) << 1 != 0) {
14386: if ((xf | yf) << 3 < 0) {
14387: this.flg = N;
14388: return this;
14389: }
14390: if ((xf & yf) << 2 < 0 && xf == yf) {
14391: epbFpsr |= EPB_FPSR_OE;
14392: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
14393: epbExceptionOperandMantissa = 0x0000000000000000L;
14394: this.flg = N;
14395: return this;
14396: }
14397: if ((xf & yf) << 1 < 0 && xf == yf) {
14398: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14399: return this;
14400: }
14401: if (xf << 1 < 0 || yf << 2 < 0) {
14402: xf = yf ^ M;
14403: xe = this.epp;
14404: xd = this.dvl;
14405: xc = this.cvl;
14406: }
14407:
14408: } else {
14409:
14410: yf ^= M;
14411: long yd = this.dvl;
14412: long yc = this.cvl;
14413: int o = xe - this.epp;
14414: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
14415:
14416: xf = yf;
14417: xe += o = -o;
14418: xd = yd;
14419: xc = yc;
14420: yf = y.flg;
14421: yd = y.dvl;
14422: yc = y.cvl;
14423: }
14424:
14425:
14426: if (0 < o) {
14427: if (o <= 63) {
14428: xb = yc << -o;
14429: yc = yd << -o | yc >>> o;
14430: yd >>>= o;
14431: } else if (o == 64) {
14432: xb = yc;
14433: yc = yd;
14434: yd = 0L;
14435: } else if (o <= 127) {
14436: xb = yd << -o | yc;
14437: yc = yd >>> o;
14438: yd = 0L;
14439: } else {
14440: xb = yd | yc;
14441: yc = 0L;
14442: yd = 0L;
14443: }
14444: }
14445:
14446: if (xf == yf) {
14447:
14448: xb |= yc << 62;
14449:
14450: xc = xd << 63 | xc >>> 1;
14451: xd >>>= 1;
14452: yc = yd << 63 | yc >>> 1;
14453: yd >>>= 1;
14454:
14455: yc >>>= 1;
14456: xc >>>= 1;
14457:
14458: xc += yc;
14459: xd += yd + (xc >>> 63);
14460:
14461: xc <<= 1;
14462:
14463: if (xd < 0L) {
14464: xe++;
14465: } else {
14466: xd = xd << 1 | xc >>> 63;
14467: xc <<= 1;
14468: }
14469: } else {
14470:
14471: xb |= yc << 63;
14472:
14473: yc >>>= 1;
14474: xc >>>= 1;
14475:
14476:
14477: if (xb != 0L) {
14478: xc--;
14479: }
14480: xc -= yc;
14481: xd -= yd + (xc >>> 63);
14482:
14483: xc <<= 1;
14484:
14485: if (0L <= xd) {
14486: if (xd != 0L) {
14487: xe -= o = Long.numberOfLeadingZeros (xd);
14488: xd = xd << o | xc >>> -o;
14489: xc <<= o;
14490: } else if (xc != 0L) {
14491: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
14492: xd = xc << o;
14493: xc = 0L;
14494: } else {
14495: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14496: }
14497: }
14498: }
14499: }
14500: return this.finish (xf, xe, xd, xc, xb);
14501: }
14502: public final EFP negsub (EFP x, EFP y) {
14503: int xf = y.flg;
14504: int xe = y.epp;
14505: long xd = y.dvl;
14506: long xc = y.cvl;
14507: long xb = 0L;
14508: int yf = x.flg;
14509: if ((xf | yf) << 1 != 0) {
14510: if ((xf | yf) << 3 < 0) {
14511: this.flg = N;
14512: return this;
14513: }
14514: if ((xf & yf) << 2 < 0 && xf == yf) {
14515: epbFpsr |= EPB_FPSR_OE;
14516: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
14517: epbExceptionOperandMantissa = 0x0000000000000000L;
14518: this.flg = N;
14519: return this;
14520: }
14521: if ((xf & yf) << 1 < 0 && xf == yf) {
14522: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14523: return this;
14524: }
14525: if (xf << 1 < 0 || yf << 2 < 0) {
14526: xf = yf ^ M;
14527: xe = x.epp;
14528: xd = x.dvl;
14529: xc = x.cvl;
14530: }
14531:
14532: } else {
14533:
14534: yf ^= M;
14535: long yd = x.dvl;
14536: long yc = x.cvl;
14537: int o = xe - x.epp;
14538: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
14539:
14540: xf = yf;
14541: xe += o = -o;
14542: xd = yd;
14543: xc = yc;
14544: yf = y.flg;
14545: yd = y.dvl;
14546: yc = y.cvl;
14547: }
14548:
14549:
14550: if (0 < o) {
14551: if (o <= 63) {
14552: xb = yc << -o;
14553: yc = yd << -o | yc >>> o;
14554: yd >>>= o;
14555: } else if (o == 64) {
14556: xb = yc;
14557: yc = yd;
14558: yd = 0L;
14559: } else if (o <= 127) {
14560: xb = yd << -o | yc;
14561: yc = yd >>> o;
14562: yd = 0L;
14563: } else {
14564: xb = yd | yc;
14565: yc = 0L;
14566: yd = 0L;
14567: }
14568: }
14569:
14570: if (xf == yf) {
14571:
14572: xb |= yc << 62;
14573:
14574: xc = xd << 63 | xc >>> 1;
14575: xd >>>= 1;
14576: yc = yd << 63 | yc >>> 1;
14577: yd >>>= 1;
14578:
14579: yc >>>= 1;
14580: xc >>>= 1;
14581:
14582: xc += yc;
14583: xd += yd + (xc >>> 63);
14584:
14585: xc <<= 1;
14586:
14587: if (xd < 0L) {
14588: xe++;
14589: } else {
14590: xd = xd << 1 | xc >>> 63;
14591: xc <<= 1;
14592: }
14593: } else {
14594:
14595: xb |= yc << 63;
14596:
14597: yc >>>= 1;
14598: xc >>>= 1;
14599:
14600:
14601: if (xb != 0L) {
14602: xc--;
14603: }
14604: xc -= yc;
14605: xd -= yd + (xc >>> 63);
14606:
14607: xc <<= 1;
14608:
14609: if (0L <= xd) {
14610: if (xd != 0L) {
14611: xe -= o = Long.numberOfLeadingZeros (xd);
14612: xd = xd << o | xc >>> -o;
14613: xc <<= o;
14614: } else if (xc != 0L) {
14615: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
14616: xd = xc << o;
14617: xc = 0L;
14618: } else {
14619: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14620: }
14621: }
14622: }
14623: }
14624: return this.finish (xf, xe, xd, xc, xb);
14625: }
14626:
14627:
14628:
14629:
14630:
14631:
14632:
14633:
14634:
14635:
14636:
14637:
14638:
14639:
14640:
14641:
14642:
14643:
14644:
14645:
14646:
14647:
14648:
14649:
14650:
14651:
14652:
14653: public final EFP nextdowne () {
14654: return this.nextdowne (this);
14655: }
14656: public final EFP nextdowne (EFP x) {
14657: int xf = x.flg;
14658: int xe = x.epp;
14659: long xd = x.dvl;
14660: long xc = x.cvl;
14661: if (xf << 1 != 0) {
14662: if (xf << 1 < 0) {
14663: xf = M;
14664: xe = -32768;
14665: xd = MSB;
14666: xc = 0L;
14667: } else if (xf == (P | I)) {
14668: xf = P;
14669: xe = 32767;
14670: xd = -1L;
14671: xc = -1L << 128 - LEN;
14672: }
14673:
14674: } else if (xf >= 0) {
14675: if (xc != 0L) {
14676: xc -= 1L << 128 - LEN;
14677: } else if (xd != MSB) {
14678: xc = -1L << 128 - LEN;
14679: xd--;
14680: } else if (xe > -32768) {
14681: xc = -1L << 128 - LEN;
14682: xd = -1L;
14683: xe--;
14684: } else {
14685: epbFpsr |= EPB_FPSR_UF;
14686: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
14687: epbExceptionOperandMantissa = xd;
14688: return this.set0 ();
14689: }
14690: } else {
14691: if (xc != -1L << 128 - LEN) {
14692: xc += (1L << 128 - LEN);
14693: } else if (xd != -1L) {
14694: xc = 0L;
14695: xd++;
14696: } else if (xe < 32767) {
14697: xc = 0L;
14698: xd = MSB;
14699: xe++;
14700: } else {
14701: epbFpsr |= EPB_FPSR_OF;
14702: epbExceptionOperandExponent = xf;
14703: epbExceptionOperandMantissa = xd;
14704: return this.negsetinf ();
14705: }
14706: }
14707: this.flg = xf;
14708: this.epp = xe;
14709: this.dvl = xd;
14710: this.cvl = xc;
14711: return this;
14712: }
14713: public final EFP nextdownd () {
14714: return this.nextdowne (this).roundd (EPB_MODE_RM);
14715: }
14716: public final EFP nextdownd (EFP x) {
14717: return this.nextdowne (x).roundd (EPB_MODE_RM);
14718: }
14719: public final EFP nextdownf () {
14720: return this.nextdowne (this).roundf (EPB_MODE_RM);
14721: }
14722: public final EFP nextdownf (EFP x) {
14723: return this.nextdowne (x).roundf (EPB_MODE_RM);
14724: }
14725: public final EFP nextdowng () {
14726: return this.nextdowne (this).roundg (EPB_MODE_RM);
14727: }
14728: public final EFP nextdowng (EFP x) {
14729: return this.nextdowne (x).roundg (EPB_MODE_RM);
14730: }
14731: public final EFP nextdownx () {
14732: return this.nextdowne (this).roundx (EPB_MODE_RM);
14733: }
14734: public final EFP nextdownx (EFP x) {
14735: return this.nextdowne (x).roundx (EPB_MODE_RM);
14736: }
14737: public final EFP nextdowny () {
14738: return this.nextdowne (this).roundy (EPB_MODE_RM);
14739: }
14740: public final EFP nextdowny (EFP x) {
14741: return this.nextdowne (x).roundy (EPB_MODE_RM);
14742: }
14743: public final EFP nextdown (int prec) {
14744: switch (prec) {
14745: case EPB_PREC_EXD:
14746: return this.nextdowne (this).roundx (EPB_MODE_RM);
14747: case EPB_PREC_SGL:
14748: return this.nextdowne (this).roundf (EPB_MODE_RM);
14749: case EPB_PREC_DBL:
14750: case EPB_PREC_DBL3:
14751: return this.nextdowne (this).roundd (EPB_MODE_RM);
14752: case EPB_PREC_TPL:
14753: return this.nextdowne (this).roundy (EPB_MODE_RM);
14754: case EPB_PREC_XSG:
14755: return this.nextdowne (this).roundg (EPB_MODE_RM);
14756: }
14757: return this.nextdowne (this);
14758: }
14759: public final EFP nextdown (EFP x, int prec) {
14760: switch (prec) {
14761: case EPB_PREC_EXD:
14762: return this.nextdowne (x).roundx (EPB_MODE_RM);
14763: case EPB_PREC_SGL:
14764: return this.nextdowne (x).roundf (EPB_MODE_RM);
14765: case EPB_PREC_DBL:
14766: case EPB_PREC_DBL3:
14767: return this.nextdowne (x).roundd (EPB_MODE_RM);
14768: case EPB_PREC_TPL:
14769: return this.nextdowne (x).roundy (EPB_MODE_RM);
14770: case EPB_PREC_XSG:
14771: return this.nextdowne (x).roundg (EPB_MODE_RM);
14772: }
14773: return this.nextdowne (x);
14774: }
14775:
14776:
14777:
14778:
14779:
14780:
14781:
14782:
14783:
14784:
14785:
14786:
14787:
14788:
14789:
14790:
14791:
14792:
14793:
14794:
14795:
14796:
14797:
14798:
14799:
14800:
14801:
14802: public final EFP nextupe () {
14803: return this.nextupe (this);
14804: }
14805: public final EFP nextupe (EFP x) {
14806: int xf = x.flg;
14807: int xe = x.epp;
14808: long xd = x.dvl;
14809: long xc = x.cvl;
14810: if (xf << 1 != 0) {
14811: if (xf << 1 < 0) {
14812: xf = P;
14813: xe = -32768;
14814: xd = MSB;
14815: xc = 0L;
14816: } else if (xf == (M | I)) {
14817: xf = M;
14818: xe = 32767;
14819: xd = -1L;
14820: xc = -1L << 128 - LEN;
14821: }
14822:
14823: } else if (xf >= 0) {
14824: if (xc != -1L << 128 - LEN) {
14825: xc += (1L << 128 - LEN);
14826: } else if (xd != -1L) {
14827: xc = 0L;
14828: xd++;
14829: } else if (xe < 32767) {
14830: xc = 0L;
14831: xd = MSB;
14832: xe++;
14833: } else {
14834: epbFpsr |= EPB_FPSR_OF;
14835: epbExceptionOperandExponent = xf;
14836: epbExceptionOperandMantissa = xd;
14837: return this.setinf ();
14838: }
14839: } else {
14840: if (xc != 0L) {
14841: xc -= 1L << 128 - LEN;
14842: } else if (xd != MSB) {
14843: xc = -1L << 128 - LEN;
14844: xd--;
14845: } else if (xe > -32768) {
14846: xc = -1L << 128 - LEN;
14847: xd = -1L;
14848: xe--;
14849: } else {
14850: epbFpsr |= EPB_FPSR_UF;
14851: epbExceptionOperandExponent = xf;
14852: epbExceptionOperandMantissa = xd;
14853: return this.negset0 ();
14854: }
14855: }
14856: this.flg = xf;
14857: this.epp = xe;
14858: this.dvl = xd;
14859: this.cvl = xc;
14860: return this;
14861: }
14862: public final EFP nextupd () {
14863: return this.nextupe (this).roundd (EPB_MODE_RP);
14864: }
14865: public final EFP nextupd (EFP x) {
14866: return this.nextupe (x).roundd (EPB_MODE_RP);
14867: }
14868: public final EFP nextupf () {
14869: return this.nextupe (this).roundf (EPB_MODE_RP);
14870: }
14871: public final EFP nextupf (EFP x) {
14872: return this.nextupe (x).roundf (EPB_MODE_RP);
14873: }
14874: public final EFP nextupg () {
14875: return this.nextupe (this).roundg (EPB_MODE_RP);
14876: }
14877: public final EFP nextupg (EFP x) {
14878: return this.nextupe (x).roundg (EPB_MODE_RP);
14879: }
14880: public final EFP nextupx () {
14881: return this.nextupe (this).roundx (EPB_MODE_RP);
14882: }
14883: public final EFP nextupx (EFP x) {
14884: return this.nextupe (x).roundx (EPB_MODE_RP);
14885: }
14886: public final EFP nextupy () {
14887: return this.nextupe (this).roundy (EPB_MODE_RP);
14888: }
14889: public final EFP nextupy (EFP x) {
14890: return this.nextupe (x).roundy (EPB_MODE_RP);
14891: }
14892: public final EFP nextup (int prec) {
14893: switch (prec) {
14894: case EPB_PREC_EXD:
14895: return this.nextupe (this).roundx (EPB_MODE_RP);
14896: case EPB_PREC_SGL:
14897: return this.nextupe (this).roundf (EPB_MODE_RP);
14898: case EPB_PREC_DBL:
14899: case EPB_PREC_DBL3:
14900: return this.nextupe (this).roundd (EPB_MODE_RP);
14901: case EPB_PREC_TPL:
14902: return this.nextupe (this).roundy (EPB_MODE_RP);
14903: case EPB_PREC_XSG:
14904: return this.nextupe (this).roundg (EPB_MODE_RP);
14905: }
14906: return this.nextupe (this);
14907: }
14908: public final EFP nextup (EFP x, int prec) {
14909: switch (prec) {
14910: case EPB_PREC_EXD:
14911: return this.nextupe (x).roundx (EPB_MODE_RP);
14912: case EPB_PREC_SGL:
14913: return this.nextupe (x).roundf (EPB_MODE_RP);
14914: case EPB_PREC_DBL:
14915: case EPB_PREC_DBL3:
14916: return this.nextupe (x).roundd (EPB_MODE_RP);
14917: case EPB_PREC_TPL:
14918: return this.nextupe (x).roundy (EPB_MODE_RP);
14919: case EPB_PREC_XSG:
14920: return this.nextupe (x).roundg (EPB_MODE_RP);
14921: }
14922: return this.nextupe (x);
14923: }
14924:
14925:
14926:
14927:
14928:
14929:
14930:
14931:
14932:
14933:
14934:
14935:
14936:
14937: public final EFP parse (String s) {
14938: int i = 0;
14939: int l = s.length ();
14940: char c = i < l ? s.charAt (i++) : '\0';
14941:
14942: int f;
14943: if (c == '-') {
14944: f = M;
14945: c = i < l ? s.charAt (i++) : '\0';
14946: } else {
14947: f = P;
14948: if (c == '+') {
14949: c = i < l ? s.charAt (i++) : '\0';
14950: }
14951: }
14952:
14953: if (i + 1 < l && (c | 0x20) == 'i' && (s.charAt (i) | 0x20) == 'n' && (s.charAt (i + 1) | 0x20) == 'f') {
14954: this.flg = f | I;
14955: return this;
14956: }
14957:
14958: this.inner ();
14959: this.flg = P | Z;
14960: boolean nan = true;
14961:
14962: int r = 10;
14963: if (c == '$') {
14964: c = i < l ? s.charAt (i++) : '\0';
14965: r = 16;
14966: } else if (c == '@') {
14967: c = i < l ? s.charAt (i++) : '\0';
14968: r = 8;
14969: } else if (c == '%') {
14970: c = i < l ? s.charAt (i++) : '\0';
14971: r = 2;
14972: } else if (c == '0') {
14973: nan = false;
14974: c = i < l ? s.charAt (i++) : '\0';
14975: if ((c | 0x20) == 'x') {
14976: c = i < l ? s.charAt (i++) : '\0';
14977: r = 16;
14978: } else if ((c | 0x20) == 'o') {
14979: c = i < l ? s.charAt (i++) : '\0';
14980: r = 8;
14981: } else if ((c | 0x20) == 'b') {
14982: c = i < l ? s.charAt (i++) : '\0';
14983: r = 2;
14984: }
14985: }
14986:
14987: {
14988: int t = Character.digit (c, r);
14989: if (t >= 0) {
14990: nan = false;
14991: do {
14992: this.imul (EFP_DIGIT[r]).iadd (EFP_DIGIT[t]);
14993: c = i < l ? s.charAt (i++) : '\0';
14994: t = Character.digit (c, r);
14995: } while (t >= 0);
14996: }
14997: }
14998:
14999: int o = 0;
15000: if (c == '.') {
15001: c = i < l ? s.charAt (i++) : '\0';
15002: int t = Character.digit (c, r);
15003: if (t >= 0) {
15004: nan = false;
15005: do {
15006: o--;
15007: this.imul (EFP_DIGIT[r]).iadd (EFP_DIGIT[t]);
15008: c = i < l ? s.charAt (i++) : '\0';
15009: t = Character.digit (c, r);
15010: } while (t >= 0);
15011: if (r == 8) {
15012: o *= 3;
15013: } else if (r == 16) {
15014: o <<= 2;
15015: }
15016: }
15017: }
15018:
15019: if (nan) {
15020: this.flg = N;
15021: return this.outer ();
15022: }
15023:
15024: if (this.flg << 1 < 0) {
15025: this.flg = f | Z;
15026: return this.outer ();
15027: }
15028:
15029: if ((c | 0x20) == (r == 10 ? 'e' : 'p')) {
15030: c = i < l ? s.charAt (i++) : '\0';
15031: int m;
15032: if (c == '-') {
15033: m = -1;
15034: c = i < l ? s.charAt (i++) : '\0';
15035: } else {
15036: m = 1;
15037: if (c == '+') {
15038: c = i < l ? s.charAt (i++) : '\0';
15039: }
15040: }
15041: if ('0' <= c && c <= '9') {
15042: int t = 0;
15043: do {
15044: t = t * 10 + (c - '0');
15045: if (t >= 100000000) {
15046: this.outer ();
15047: if (m >= 0) {
15048:
15049: epbFpsr |= EPB_FPSR_OF;
15050: epbExceptionOperandExponent = 0;
15051: epbExceptionOperandMantissa = 0L;
15052: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | f >>> 31]).finish ();
15053: } else {
15054:
15055: epbFpsr |= EPB_FPSR_UF;
15056: epbExceptionOperandExponent = 0;
15057: epbExceptionOperandMantissa = 0L;
15058: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | f >>> 31]).finish ();
15059: }
15060: }
15061: c = i < l ? s.charAt (i++) : '\0';
15062: } while ('0' <= c && c <= '9');
15063: o += m * t;
15064: }
15065: }
15066: if (r != 10) {
15067: this.shl (o);
15068: } else if (o > 0) {
15069:
15070: EFP t = new EFP (ONE);
15071: for (int j = 0, m = o; m != 0; j++, m >>>= 1) {
15072: if ((m & 1) != 0) {
15073: t.imul (EFP_TEN_POWER_P[j]);
15074: }
15075: }
15076: this.imul (t);
15077: } else if (o < 0) {
15078:
15079: EFP t = new EFP (ONE);
15080: for (int j = 0, m = -o; m != 0; j++, m >>>= 1) {
15081: if ((m & 1) != 0) {
15082: t.imul (EFP_TEN_POWER_P[j]);
15083: }
15084: }
15085: this.div (t);
15086: }
15087:
15088: return this.outer ().neg (f < 0);
15089: }
15090:
15091:
15092:
15093:
15094:
15095:
15096:
15097:
15098:
15099:
15100:
15101:
15102:
15103:
15104:
15105:
15106:
15107:
15108:
15109:
15110:
15111:
15112:
15113:
15114: public final EFP pow (EFP y) {
15115: return this.pow (this, y);
15116: }
15117: public final EFP pow (EFP x, EFP y) {
15118: int xf = x.flg;
15119: int yf = y.flg;
15120: if (yf << 1 != 0) {
15121: if (yf << 1 < 0) {
15122: this.flg = P;
15123: this.epp = 0;
15124: this.dvl = MSB;
15125: this.cvl = 0L;
15126: return this;
15127: } else {
15128: int s;
15129: this.flg = (yf << 3 < 0 ||
15130: xf << 3 < 0 ||
15131: (s = x.cmp1abs ()) == 0 ? N :
15132: (s ^ yf) >= 0 ? P | I :
15133: P | Z);
15134: return this;
15135: }
15136: } else if (xf << 1 != 0) {
15137: this.flg = (xf << 3 < 0 ? N :
15138: xf >= 0 ?
15139: (xf << 2 ^ yf) >= 0 ? P | Z :
15140: P | I :
15141:
15142: y.isodd () ?
15143: (xf << 2 ^ yf) >= 0 ? M | Z :
15144: M | I :
15145:
15146:
15147:
15148:
15149: (xf << 2 ^ yf) >= 0 ? P | Z :
15150: P | I);
15151: return this;
15152: } else if (xf < 0) {
15153: this.inner ();
15154: if (y.iseven ()) {
15155: EFP w = new EFP ();
15156: this.imulw (w, new EFP ().ineg (x).log2 (), y);
15157: if (this.epp >= 16) {
15158: this.flg = this.flg >= 0 ? P | I : P | Z;
15159: return this.outer ();
15160: } else {
15161: int k = this.geti ();
15162: return this.frac ().iadd (w).exp2 ().outer ().shl (k);
15163: }
15164: } else if (y.isodd ()) {
15165: EFP w = new EFP ();
15166: this.imulw (w, new EFP ().ineg (x).log2 (), y);
15167: if (this.epp >= 16) {
15168: this.flg = this.flg >= 0 ? M | I : M | Z;
15169: return this.outer ();
15170: } else {
15171: int k = this.geti ();
15172: return this.frac ().iadd (w).exp2 ().shl (k).outer ().neg ();
15173: }
15174: } else {
15175: this.flg = N;
15176: return this.outer ();
15177: }
15178: } else {
15179: this.inner ();
15180: EFP w = new EFP ();
15181: this.imulw (w, new EFP ().log2 (x), y);
15182: if (this.epp >= 16) {
15183: this.flg = this.flg >= 0 ? P | I : P | Z;
15184: return this.outer ();
15185: } else {
15186: int k = this.geti ();
15187: return this.frac ().iadd (w).exp2 ().outer ().shl (k);
15188: }
15189: }
15190: }
15191:
15192:
15193:
15194:
15195:
15196:
15197:
15198:
15199: public final EFP powi (int n) {
15200: return this.powi (this, n);
15201: }
15202: public final EFP powi (EFP x, int n) {
15203: int xf = x.flg;
15204: if (n == 0) {
15205:
15206: this.flg = P;
15207: this.epp = 0;
15208: this.dvl = MSB;
15209: this.cvl = 0L;
15210: return this;
15211: } else if (xf << 1 != 0) {
15212: this.flg = (xf << 3 < 0 ? N :
15213: xf >= 0 ?
15214: (xf << 2 ^ n) >= 0 ? P | Z :
15215: P | I :
15216:
15217: (n & 1) != 0 ?
15218: (xf << 2 ^ n) >= 0 ? M | Z :
15219: M | I :
15220:
15221:
15222:
15223:
15224: (xf << 2 ^ n) >= 0 ? P | Z :
15225: P | I);
15226: return this;
15227: } else {
15228:
15229: int t = n >= 0 ? n : -n;
15230: if (t >>> 16 != 0) {
15231:
15232: int xe = x.epp;
15233: long xd = x.dvl;
15234: if (xe == 0 && xd >>> -16 == 0x8000L ||
15235: xe == -1 && xd >>> -16 == 0xffffL) {
15236: return this.pow (x, new EFP (n));
15237: }
15238: }
15239: this.inner ();
15240: EFP w = new EFP (x);
15241: if ((t & 1) == 0) {
15242:
15243: this.flg = P;
15244: this.epp = 0;
15245: this.dvl = MSB;
15246: this.cvl = 0L;
15247: } else {
15248:
15249: this.flg = xf;
15250: this.epp = x.epp;
15251: this.dvl = x.dvl;
15252: this.cvl = x.cvl;
15253: }
15254: while ((t >>>= 1) != 0) {
15255: w.squ ();
15256: if ((t & 1) != 0) {
15257: this.mul (w);
15258: }
15259: }
15260: if (n < 0) {
15261: this.rcp ();
15262: }
15263: return this.outer ().finish ();
15264: }
15265: }
15266:
15267:
15268:
15269:
15270:
15271:
15272:
15273:
15274: public final EFP quo (EFP y) {
15275: return this.quo (this, y);
15276: }
15277: public final EFP quo (EFP x, EFP y) {
15278: int xf = x.flg;
15279: int yf = y.flg;
15280: if ((xf | yf) << 1 != 0) {
15281: this.flg = ((xf | yf) << 3 != 0 || (xf & yf & (Z | I)) != 0 ? N :
15282: (xf ^ yf) & M | ((xf & Z | yf & I) != 0 ? Z : I));
15283: return this;
15284: }
15285:
15286: int zf = xf ^ yf;
15287: int ze = x.epp - y.epp;
15288: if (ze < 0) {
15289: this.flg = zf | Z;
15290: return this;
15291: }
15292:
15293: long r01 = x.dvl;
15294: long y01 = y.dvl;
15295: long r2 = (r01 << -2 | x.cvl >>> 2) >>> 33;
15296: long y2 = (y01 << -2 | y.cvl >>> 2) >>> 33;
15297: r01 >>>= 2;
15298: y01 >>>= 2;
15299: long y0 = y01 >>> 31;
15300: long y1 = y01 & 0x7fffffffL;
15301:
15302: boolean qq;
15303: if (r01 < y01 || (r01 == y01 && r2 < y2)) {
15304: if (ze == 0) {
15305: this.flg = zf | Z;
15306: return this;
15307: }
15308: qq = false;
15309: } else {
15310: qq = true;
15311: r2 -= y2;
15312: r01 -= y01;
15313: if (r2 < 0L) {
15314: r2 += 0x80000000L;
15315: r01--;
15316: }
15317: }
15318: long q0, q1, q2;
15319:
15320: q0 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
15321: r01 = (r01 - q0 * y0 << 31) + r2 - q0 * y1;
15322: if (r01 < 0L) {
15323: q0--;
15324: r01 += y01;
15325: }
15326: r2 = q0 * y2 + 0x7fffffffL;
15327: r01 -= r2 >> 31;
15328: r2 = ~r2 & 0x7fffffffL;
15329: if (r01 < 0L) {
15330: q0--;
15331: r2 += y2;
15332: r01 += y01 + (r2 >> 31);
15333: r2 &= 0x7fffffffL;
15334: }
15335: if (ze <= 31) {
15336: q0 &= ~0x7fffffffL >> ze;
15337: q1 = q2 = 0L;
15338: } else {
15339:
15340: q1 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
15341: r01 = (r01 - q1 * y0 << 31) + r2 - q1 * y1;
15342: if (r01 < 0L) {
15343: q1--;
15344: r01 += y01;
15345: }
15346: r2 = q1 * y2 + 0x7fffffffL;
15347: r01 -= r2 >> 31;
15348: r2 = ~r2 & 0x7fffffffL;
15349: if (r01 < 0L) {
15350: q1--;
15351: r2 += y2;
15352: r01 += y01 + (r2 >> 31);
15353: r2 &= 0x7fffffffL;
15354: }
15355: if (ze <= 62) {
15356: q1 &= ~0x7fffffffL >> ze - 31;
15357: q2 = 0L;
15358: } else {
15359:
15360: q2 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
15361: r01 = (r01 - q2 * y0 << 31) + r2 - q2 * y1;
15362: if (r01 < 0L) {
15363: q2--;
15364: r01 += y01;
15365: }
15366: r2 = q2 * y2 + 0x7fffffffL;
15367: r01 -= r2 >> 31;
15368: r2 = ~r2 & 0x7fffffffL;
15369: if (r01 < 0L) {
15370: q2--;
15371:
15372:
15373:
15374: }
15375: if (ze <= 93) {
15376: q2 &= ~0x7fffffffL >> ze - 62;
15377: }
15378: }
15379: }
15380:
15381:
15382: if (qq) {
15383: q0 = MSB | q0 << 32 | q1 << 1 | q2 >>> 30;
15384: q2 <<= -30;
15385: } else {
15386: ze--;
15387: q0 = q0 << -31 | q1 << 2 | q2 >>> 29;
15388: q2 <<= -29;
15389: }
15390: return this.finish (zf, ze, q0, q2, 0L);
15391: }
15392:
15393:
15394:
15395:
15396:
15397:
15398:
15399:
15400:
15401:
15402:
15403:
15404:
15405:
15406:
15407:
15408:
15409:
15410:
15411:
15412:
15413:
15414:
15415:
15416:
15417:
15418:
15419:
15420:
15421:
15422:
15423:
15424:
15425:
15426:
15427:
15428:
15429:
15430:
15431:
15432:
15433:
15434:
15435:
15436:
15437:
15438:
15439:
15440:
15441:
15442:
15443:
15444:
15445: public final EFP rad () {
15446: return this.mul (this, TO_RAD);
15447: }
15448: public final EFP rad (EFP x) {
15449: return this.mul (x, TO_RAD);
15450: }
15451:
15452:
15453:
15454:
15455:
15456:
15457:
15458:
15459:
15460:
15461: public final EFP random () {
15462: int xf = P;
15463: int xe = -1;
15464: long xd = epbRand48 ();
15465: long xc = epbRand48 ();
15466: xd = xd << 16 | xc >>> 32;
15467: xc = xc << 32 & -LSB;
15468: if (xd != 0L) {
15469: int o = Long.numberOfLeadingZeros (xd);
15470: if (o > 0) {
15471: xe -= o;
15472: xd = xd << o | xc >>> -o;
15473: xc <<= o;
15474: }
15475: } else if (xc != 0L) {
15476: int o = Long.numberOfLeadingZeros (xc);
15477: xe -= 64 + o;
15478: xd = xc << o;
15479: xc = 0L;
15480: } else {
15481: xf = P | Z;
15482: }
15483: return this.finish (xf, xe, xd, xc, 0L);
15484: }
15485:
15486:
15487:
15488:
15489:
15490:
15491:
15492:
15493:
15494:
15495:
15496:
15497:
15498:
15499:
15500:
15501:
15502:
15503:
15504:
15505:
15506:
15507:
15508:
15509:
15510:
15511:
15512:
15513:
15514:
15515:
15516:
15517:
15518:
15519:
15520:
15521:
15522:
15523:
15524:
15525:
15526:
15527:
15528:
15529:
15530:
15531:
15532:
15533:
15534:
15535:
15536:
15537:
15538:
15539:
15540:
15541:
15542:
15543:
15544:
15545:
15546: public final EFP rcp () {
15547: return this.div (ONE, this);
15548: }
15549: public final EFP rcp (EFP x) {
15550: if (false) {
15551: return this.div (ONE, x);
15552: } else {
15553: int xf = x.flg;
15554: if (xf << 1 != 0) {
15555: if (xf << 1 < 0) {
15556: epbFpsr |= EPB_FPSR_DZ;
15557: epbExceptionOperandExponent = xf & M;
15558: epbExceptionOperandMantissa = 0x0000000000000000L;
15559: this.flg = xf ^ (Z | I);
15560: } else if (xf << 2 < 0) {
15561: this.flg = xf ^ (Z | I);
15562: } else {
15563: this.flg = N;
15564: }
15565: return this;
15566: }
15567:
15568: this.inner ();
15569: long s = Double.doubleToLongBits (1.0 / Double.longBitsToDouble ((long) 1023 << 52 | x.dvl << 1 >>> 12));
15570: EFP t = new EFP (xf, (int) (s >>> 52) - 1023 - x.epp, MSB | s << 12 >>> 1, 0L);
15571:
15572: this.imul2 (t);
15573: t.isqu ().imul (x);
15574: return this.outer ().sub (t);
15575: }
15576: }
15577:
15578:
15579:
15580:
15581:
15582:
15583:
15584:
15585:
15586: public final EFP rcpdiv (EFP y) {
15587: return this.div (y, this);
15588: }
15589: public final EFP rcpdiv (EFP x, EFP y) {
15590: return this.div (y, x);
15591: }
15592:
15593:
15594:
15595:
15596:
15597:
15598:
15599:
15600:
15601:
15602:
15603:
15604:
15605:
15606:
15607:
15608:
15609:
15610:
15611:
15612:
15613:
15614:
15615:
15616:
15617:
15618:
15619: public final EFP rem (EFP y) {
15620: return this.rem (this, y);
15621: }
15622: public final EFP rem (EFP x, EFP y) {
15623: int xf = x.flg;
15624: int yf = y.flg;
15625: epbFpsr &= 0xff00ffff;
15626: if ((xf | yf) << 1 != 0) {
15627: if ((xf | yf) << 3 < 0) {
15628: this.flg = N;
15629: } else if (xf << 2 < 0 ||
15630: yf << 1 < 0) {
15631:
15632: epbFpsr |= EPB_FPSR_OE;
15633: if (yf << 1 < 0) {
15634: epbExceptionOperandExponent = yf & M;
15635: epbExceptionOperandMantissa = 0x0000000000000000L;
15636: } else if (yf << 2 < 0) {
15637: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
15638: epbExceptionOperandMantissa = 0x0000000000000000L;
15639: } else {
15640: epbExceptionOperandExponent = yf & M | 0x3fff + y.epp << 16;
15641: epbExceptionOperandMantissa = y.dvl;
15642: }
15643: this.flg = N;
15644: } else if (xf << 1 < 0) {
15645: epbFpsr |= ((xf ^ yf) & M) >>> 8;
15646: this.flg = xf;
15647: } else {
15648: epbFpsr |= ((xf ^ yf) & M) >>> 8;
15649: this.finish (xf, x.epp, x.dvl, x.cvl, 0L);
15650: }
15651: return this;
15652: }
15653:
15654: epbFpsr |= ((xf ^ yf) & M) >>> 8;
15655: if (false) {
15656: this.inner ();
15657:
15658: int s;
15659: long t;
15660: if ((s = x.epp - y.epp) < 0 ||
15661: s == 0 && ((t = x.dvl - y.dvl) < 0L ||
15662: t == 0L && (x.cvl >>> 1) - (y.cvl >>> 1) < 0L)) {
15663:
15664: this.flg = xf;
15665: this.epp = x.epp;
15666: this.dvl = x.dvl;
15667: this.cvl = x.cvl;
15668: } else {
15669: EFP xx = x != this ? x : new EFP (x);
15670: EFP yy = y != this ? y : new EFP (y);
15671: this.divrz (xx, yy).trunc ();
15672: epbQuotient = this.geti32abs ();
15673: epbFpsr |= (epbQuotient & 127) << 16;
15674: EFP ww = new EFP ();
15675: this.imulw (ww, this, yy).negsub (xx).sub (ww);
15676: if (this.flg << 1 < 0) {
15677: this.flg = xf | Z;
15678: }
15679: }
15680: return this.outer ().finish ();
15681: } else {
15682: this.inner ();
15683: int ye = y.epp;
15684: long yd = y.dvl;
15685: long yc = y.cvl;
15686: long yc1 = yc >>> 1;
15687: this.epp = x.epp;
15688: this.dvl = x.dvl;
15689: this.cvl = x.cvl;
15690: int i;
15691: long l;
15692: int q = 0;
15693: if ((i = this.epp - ye) > 0 ||
15694: i == 0 && ((l = this.dvl - yd) > 0L ||
15695: l == 0L && this.cvl >>> 1 >= yc1)) {
15696: this.flg = P;
15697: EFP t = new EFP (P, 0, yd, yc);
15698: do {
15699: t.epp = i = (l = this.dvl - yd) > 0L || l == 0L && this.cvl >>> 1 >= yc1 ? this.epp : this.epp - 1;
15700: if ((i -= ye) <= 31) {
15701: q |= 1 << i;
15702: }
15703: this.sub (t);
15704: } while (this.flg == 0 &&
15705: ((i = this.epp - ye) > 0 ||
15706: i == 0 && ((l = this.dvl - yd) > 0L ||
15707: l == 0L && this.cvl >>> 1 >= yc1)));
15708: this.flg |= xf;
15709: } else {
15710: this.flg = xf;
15711: }
15712: epbQuotient = q;
15713: epbFpsr |= (q & 127) << 16;
15714: return this.outer ().finish ();
15715: }
15716: }
15717:
15718:
15719:
15720:
15721:
15722:
15723:
15724:
15725:
15726:
15727:
15728:
15729:
15730:
15731:
15732:
15733:
15734:
15735:
15736:
15737:
15738:
15739:
15740:
15741:
15742:
15743:
15744:
15745:
15746:
15747:
15748:
15749:
15750:
15751:
15752:
15753:
15754:
15755:
15756:
15757:
15758:
15759:
15760:
15761:
15762:
15763:
15764:
15765:
15766:
15767:
15768:
15769:
15770:
15771:
15772:
15773: public final EFP rint () {
15774: return this.rint (this);
15775: }
15776: public final EFP rint (EFP x) {
15777: int xf = x.flg;
15778: if (xf << 1 != 0) {
15779: this.flg = xf;
15780: return this;
15781: }
15782:
15783: int xe = x.epp;
15784: long xd = x.dvl;
15785: long xc = x.cvl;
15786: if (xe < 0) {
15787: epbFpsr |= EPB_FPSR_X2;
15788: if (xe < -1 || xd == MSB && xc == 0L) {
15789: this.flg = xf | Z;
15790: } else {
15791: this.flg = xf;
15792: this.epp = 0;
15793: this.dvl = MSB;
15794: this.cvl = 0L;
15795: }
15796: return this;
15797: }
15798:
15799: long m = MSB >> xe;
15800: if (xe <= 62) {
15801: if ((xd & ~m | xc) != 0L) {
15802: epbFpsr |= EPB_FPSR_X2;
15803: long t = xd;
15804: xd &= m;
15805: if ((t & -(m >> 1)) != 0L && (t & (-m | ~(m >> 1)) | xc) != 0L) {
15806: xd -= m;
15807: if (xd >= 0L) {
15808: xd = MSB;
15809: xe++;
15810: if ((short) xe != xe) {
15811: epbFpsr |= EPB_FPSR_OF;
15812: epbExceptionOperandExponent = xf;
15813: epbExceptionOperandMantissa = xd;
15814: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
15815: }
15816: }
15817: }
15818: xc = 0L;
15819: }
15820: } else if (xe == 63) {
15821: if (xc != 0L) {
15822: epbFpsr |= EPB_FPSR_X2;
15823: if (xc < 0L && (xd << -1 | xc << 1) != 0L) {
15824: xd++;
15825: if (xd >= 0L) {
15826: xd = MSB;
15827: xe++;
15828: if ((short) xe != xe) {
15829: epbFpsr |= EPB_FPSR_OF;
15830: epbExceptionOperandExponent = xf;
15831: epbExceptionOperandMantissa = xd;
15832: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
15833: }
15834: }
15835: }
15836: xc = 0L;
15837: }
15838: } else if (xe <= LEN - 2) {
15839: if ((xc & ~m) != 0L) {
15840: epbFpsr |= EPB_FPSR_X2;
15841: long t = xc;
15842: xc &= m;
15843: if ((t & -(m >> 1)) != 0L && (t & (-m | ~(m >> 1))) != 0L) {
15844: xc -= m;
15845: if ((t ^ xc) < 0L) {
15846: xd++;
15847: if (xd >= 0L) {
15848: xd = MSB;
15849: xe++;
15850: if ((short) xe != xe) {
15851: epbFpsr |= EPB_FPSR_OF;
15852: epbExceptionOperandExponent = xf;
15853: epbExceptionOperandMantissa = xd;
15854: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
15855: }
15856: }
15857: }
15858: }
15859: }
15860: }
15861:
15862: return finish (xf, xe, xd, xc, 0L);
15863: }
15864:
15865:
15866:
15867:
15868:
15869:
15870:
15871:
15872:
15873:
15874: public final EFP round () {
15875: return this.round (this, EPB_MODE_RN);
15876: }
15877: public final EFP round (int roundingMode) {
15878: return this.round (this, roundingMode);
15879: }
15880: public final EFP round (EFP x) {
15881: return this.round (x, EPB_MODE_RN);
15882: }
15883: public final EFP round (EFP x, int roundingMode) {
15884: return (roundingMode == EPB_MODE_RN ? this.rint (x) :
15885: roundingMode == EPB_MODE_RM ? this.floor (x) :
15886: roundingMode == EPB_MODE_RP ? this.ceil (x) :
15887: this.trunc (x));
15888: }
15889:
15890:
15891:
15892:
15893:
15894:
15895:
15896:
15897:
15898:
15899:
15900:
15901: public final EFP roundd () {
15902: return this.roundd (this, EPB_MODE_RN);
15903: }
15904: public final EFP roundd (int roundingMode) {
15905: return this.roundd (this, roundingMode);
15906: }
15907: public final EFP roundd (EFP x) {
15908: return this.roundd (x, EPB_MODE_RN);
15909: }
15910: public final EFP roundd (EFP x, int roundingMode) {
15911: int xf = x.flg;
15912: if (xf << 1 != 0) {
15913: this.flg = xf;
15914: return this;
15915: }
15916:
15917: int xe = x.epp;
15918: long xd = x.dvl;
15919: long xc = x.cvl;
15920: if (xe < -1075) {
15921: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
15922: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
15923: epbExceptionOperandMantissa = xd;
15924: return this.sete (UNFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15925: }
15926: if (1023 < xe) {
15927: if (true) {
15928: epbFpsr |= EPB_FPSR_OF;
15929: if ((xd << 53 | xc) != 0L) {
15930: epbFpsr |= EPB_FPSR_X2;
15931: }
15932: } else {
15933: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
15934: }
15935: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
15936: epbExceptionOperandMantissa = xd;
15937: return this.sete (OVFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15938: }
15939: long xb = 0L;
15940: int o = xe <= -1023 ? 11 + -1022 - xe : 11;
15941: if (o < 64) {
15942: xb = xc << -o;
15943: xc = xd << -o | xc >>> o;
15944: xd >>>= o;
15945: } else {
15946: xb = xc;
15947: xc = xd;
15948: xd = 0L;
15949: }
15950: if ((xc | xb) != 0L) {
15951: epbFpsr |= EPB_FPSR_X2;
15952: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
15953: epbExceptionOperandMantissa = x.dvl;
15954: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
15955: roundingMode == EPB_MODE_RM && xf < 0 ||
15956: roundingMode == EPB_MODE_RP && 0 <= xf) {
15957: xd++;
15958: if (xd >>> 53 != 0L) {
15959: xd = 1L << 52;
15960: xe++;
15961: if (1023 < xe) {
15962: epbFpsr |= EPB_FPSR_OF;
15963: return this.sete (OVFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15964: }
15965: } else if (11 < o) {
15966: if (xd << o - 1 < 0L) {
15967: xe++;
15968:
15969: if (xe == -1022) {
15970:
15971: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
15972: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
15973: epbExceptionOperandMantissa = xd;
15974: }
15975:
15976: }
15977: }
15978: }
15979:
15980: if (xe <= -1023) {
15981: epbFpsr |= EPB_FPSR_UF;
15982: if (xd == 0L) {
15983: return this.sete (UNFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15984: }
15985: }
15986: } else {
15987: if (xe <= -1023) {
15988: epbFpsr |= EPB_FPSR_UF;
15989: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
15990: epbExceptionOperandMantissa = x.dvl;
15991: if (xd == 0L) {
15992: return this.sete (UNFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15993: }
15994: }
15995: }
15996: xd <<= Long.numberOfLeadingZeros (xd);
15997:
15998: this.flg = xf;
15999: this.epp = xe;
16000: this.dvl = xd;
16001: this.cvl = 0L;
16002: return this;
16003: }
16004:
16005:
16006:
16007:
16008:
16009:
16010:
16011:
16012:
16013:
16014:
16015:
16016: public final EFP roundf () {
16017: return this.roundf (this, EPB_MODE_RN);
16018: }
16019: public final EFP roundf (int roundingMode) {
16020: return this.roundf (this, roundingMode);
16021: }
16022: public final EFP roundf (EFP x) {
16023: return this.roundf (x, EPB_MODE_RN);
16024: }
16025: public final EFP roundf (EFP x, int roundingMode) {
16026: int xf = x.flg;
16027: if (xf << 1 != 0) {
16028: this.flg = xf;
16029: return this;
16030: }
16031:
16032: int xe = x.epp;
16033: long xd = x.dvl;
16034: long xc = x.cvl;
16035: if (xe < -150) {
16036: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16037: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16038: epbExceptionOperandMantissa = xd;
16039: return this.sete (UNFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
16040: }
16041: if (127 < xe) {
16042: if (true) {
16043: epbFpsr |= EPB_FPSR_OF;
16044: if ((xd << 24 | xc) != 0L) {
16045: epbFpsr |= EPB_FPSR_X2;
16046: }
16047: } else {
16048: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16049: }
16050: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16051: epbExceptionOperandMantissa = xd;
16052: return this.sete (OVFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
16053: }
16054: long xb = 0L;
16055: int o = xe <= -127 ? 40 + -126 - xe : 40;
16056: if (o < 64) {
16057: xb = xc << -o;
16058: xc = xd << -o | xc >>> o;
16059: xd >>>= o;
16060: } else {
16061: xb = xc;
16062: xc = xd;
16063: xd = 0L;
16064: }
16065: if ((xc | xb) != 0L) {
16066: epbFpsr |= EPB_FPSR_X2;
16067: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16068: epbExceptionOperandMantissa = x.dvl;
16069: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << -1 | xc << 1 | xb) != 0L ||
16070: roundingMode == EPB_MODE_RM && xf < 0 ||
16071: roundingMode == EPB_MODE_RP && 0 <= xf) {
16072: xd++;
16073: if (xd >>> 24 != 0L) {
16074: xd = 1L << 23;
16075: xe++;
16076: if (127 < xe) {
16077: epbFpsr |= EPB_FPSR_OF;
16078: return this.sete (OVFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
16079: }
16080: } else if (40 < o) {
16081: if (xd << o - 1 < 0L) {
16082: xe++;
16083:
16084: if (xe == -126) {
16085:
16086: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16087: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16088: epbExceptionOperandMantissa = xd;
16089: }
16090:
16091: }
16092: }
16093: }
16094:
16095: if (xe <= -127) {
16096: epbFpsr |= EPB_FPSR_UF;
16097: if (xd == 0L) {
16098: return this.sete (UNFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
16099: }
16100: }
16101: } else {
16102: if (xe <= -127) {
16103: epbFpsr |= EPB_FPSR_UF;
16104: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16105: epbExceptionOperandMantissa = x.dvl;
16106: if (xd == 0L) {
16107: return this.sete (UNFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
16108: }
16109: }
16110: }
16111: xd <<= Long.numberOfLeadingZeros (xd);
16112:
16113: this.flg = xf;
16114: this.epp = xe;
16115: this.dvl = xd;
16116: this.cvl = 0L;
16117: return this;
16118: }
16119:
16120:
16121:
16122:
16123:
16124:
16125:
16126:
16127:
16128:
16129:
16130:
16131: public final EFP roundg () {
16132: return this.roundg (this, EPB_MODE_RN);
16133: }
16134: public final EFP roundg (int roundingMode) {
16135: return this.roundg (this, roundingMode);
16136: }
16137: public final EFP roundg (EFP x) {
16138: return this.roundg (x, EPB_MODE_RN);
16139: }
16140: public final EFP roundg (EFP x, int roundingMode) {
16141: int xf = x.flg;
16142: if (xf << 1 != 0) {
16143: this.flg = xf;
16144: return this;
16145: }
16146:
16147: int xe = x.epp;
16148: long xd = x.dvl;
16149: long xc = x.cvl;
16150: if (xe < -16407) {
16151: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16152: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16153: epbExceptionOperandMantissa = xd;
16154: return this.sete (UNFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16155: }
16156: if (16383 < xe) {
16157: if (true) {
16158: epbFpsr |= EPB_FPSR_OF;
16159: if ((xd << 24 | xc) != 0L) {
16160: epbFpsr |= EPB_FPSR_X2;
16161: }
16162: } else {
16163: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16164: }
16165: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16166: epbExceptionOperandMantissa = xd;
16167: return this.sete (OVFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16168: }
16169: long xb = 0L;
16170: int o = xe <= -16384 ? 40 + -16383 - xe : 40;
16171: if (o < 64) {
16172: xb = xc << -o;
16173: xc = xd << -o | xc >>> o;
16174: xd >>>= o;
16175: } else {
16176: xb = xc;
16177: xc = xd;
16178: xd = 0L;
16179: }
16180: if ((xc | xb) != 0L) {
16181: epbFpsr |= EPB_FPSR_X2;
16182: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16183: epbExceptionOperandMantissa = x.dvl;
16184: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << -1 | xc << 1 | xb) != 0L ||
16185: roundingMode == EPB_MODE_RM && xf < 0 ||
16186: roundingMode == EPB_MODE_RP && 0 <= xf) {
16187: xd++;
16188: if (xd >>> 24 != 0L) {
16189: xd = 1L << 23;
16190: xe++;
16191: if (16383 < xe) {
16192: epbFpsr |= EPB_FPSR_OF;
16193: return this.sete (OVFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16194: }
16195: } else if (40 < o) {
16196: if (xd << o - 1 < 0L) {
16197: xe++;
16198:
16199:
16200:
16201:
16202:
16203:
16204:
16205:
16206: }
16207: }
16208: }
16209:
16210: if (xe <= -16384) {
16211: epbFpsr |= EPB_FPSR_UF;
16212: if (xd == 0L) {
16213: return this.sete (UNFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16214: }
16215: }
16216: } else {
16217: if (xe <= -16384) {
16218: epbFpsr |= EPB_FPSR_UF;
16219: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16220: epbExceptionOperandMantissa = x.dvl;
16221: if (xd == 0L) {
16222: return this.sete (UNFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16223: }
16224: }
16225: }
16226: xd <<= Long.numberOfLeadingZeros (xd);
16227:
16228: this.flg = xf;
16229: this.epp = xe;
16230: this.dvl = xd;
16231: this.cvl = 0L;
16232: return this;
16233: }
16234:
16235:
16236:
16237:
16238:
16239:
16240:
16241:
16242:
16243:
16244:
16245:
16246: public final EFP roundi () {
16247: return this.roundi (this, EPB_MODE_RN);
16248: }
16249: public final EFP roundi (int roundingMode) {
16250: return this.roundi (this, roundingMode);
16251: }
16252: public final EFP roundi (EFP x) {
16253: return this.roundi (x, EPB_MODE_RN);
16254: }
16255: public final EFP roundi (EFP x, int roundingMode) {
16256: return this.seti (x.geti (roundingMode));
16257: }
16258:
16259:
16260:
16261:
16262:
16263:
16264:
16265:
16266:
16267:
16268:
16269:
16270: public final EFP roundl () {
16271: return this.roundl (this, EPB_MODE_RN);
16272: }
16273: public final EFP roundl (int roundingMode) {
16274: return this.roundl (this, roundingMode);
16275: }
16276: public final EFP roundl (EFP x) {
16277: return this.roundl (x, EPB_MODE_RN);
16278: }
16279: public final EFP roundl (EFP x, int roundingMode) {
16280: return this.setl (x.getl (roundingMode));
16281: }
16282:
16283:
16284:
16285:
16286:
16287:
16288:
16289:
16290:
16291: public final EFP roundmand () {
16292: return this.roundmand (this, EPB_MODE_RN);
16293: }
16294: public final EFP roundmand (int roundingMode) {
16295: return this.roundmand (this, roundingMode);
16296: }
16297: public final EFP roundmand (EFP x) {
16298: return this.roundmand (x, EPB_MODE_RN);
16299: }
16300: public final EFP roundmand (EFP x, int roundingMode) {
16301: int xf = x.flg;
16302: if (xf << 1 != 0) {
16303: this.flg = xf;
16304: return this;
16305: }
16306:
16307: int xe = x.epp;
16308: long xd = x.dvl;
16309: long xc = x.cvl;
16310: long xb = 0L;
16311: xb = xc << -11;
16312: xc = xd << -11 | xc >>> 11;
16313: xd >>>= 11;
16314: if ((xc | xb) != 0L) {
16315: epbFpsr |= EPB_FPSR_X2;
16316: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16317: epbExceptionOperandMantissa = x.dvl;
16318: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16319: roundingMode == EPB_MODE_RM && xf < 0 ||
16320: roundingMode == EPB_MODE_RP && 0 <= xf) {
16321: xd++;
16322: if (xd >>> 53 != 0L) {
16323: xd = 1L << 52;
16324: xe++;
16325: }
16326: }
16327:
16328: }
16329: xd <<= 11;
16330:
16331: this.flg = xf;
16332: this.epp = xe;
16333: this.dvl = xd;
16334: this.cvl = 0L;
16335: return this;
16336: }
16337:
16338:
16339:
16340:
16341:
16342:
16343:
16344:
16345:
16346: public final EFP roundmanf () {
16347: return this.roundmanf (this, EPB_MODE_RN);
16348: }
16349: public final EFP roundmanf (int roundingMode) {
16350: return this.roundmanf (this, roundingMode);
16351: }
16352: public final EFP roundmanf (EFP x) {
16353: return this.roundmanf (x, EPB_MODE_RN);
16354: }
16355: public final EFP roundmanf (EFP x, int roundingMode) {
16356: int xf = x.flg;
16357: if (xf << 1 != 0) {
16358: this.flg = xf;
16359: return this;
16360: }
16361:
16362: int xe = x.epp;
16363: long xd = x.dvl;
16364: long xc = x.cvl;
16365: long xb = 0L;
16366: xb = xc << -40;
16367: xc = xd << -40 | xc >>> 40;
16368: xd >>>= 40;
16369: if ((xc | xb) != 0L) {
16370: epbFpsr |= EPB_FPSR_X2;
16371: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16372: epbExceptionOperandMantissa = x.dvl;
16373: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16374: roundingMode == EPB_MODE_RM && xf < 0 ||
16375: roundingMode == EPB_MODE_RP && 0 <= xf) {
16376: xd++;
16377: if (xd >>> 24 != 0L) {
16378: xd = 1L << 23;
16379: xe++;
16380: }
16381: }
16382:
16383: }
16384: xd <<= 40;
16385:
16386: this.flg = xf;
16387: this.epp = xe;
16388: this.dvl = xd;
16389: this.cvl = 0L;
16390: return this;
16391: }
16392:
16393:
16394:
16395:
16396:
16397:
16398:
16399:
16400:
16401: public final EFP roundmanx () {
16402: return this.roundmanx (this, EPB_MODE_RN);
16403: }
16404: public final EFP roundmanx (int roundingMode) {
16405: return this.roundmanx (this, roundingMode);
16406: }
16407: public final EFP roundmanx (EFP x) {
16408: return this.roundmanx (x, EPB_MODE_RN);
16409: }
16410: public final EFP roundmanx (EFP x, int roundingMode) {
16411: int xf = x.flg;
16412: if (xf << 1 != 0) {
16413: this.flg = xf;
16414: return this;
16415: }
16416:
16417: int xe = x.epp;
16418: long xd = x.dvl;
16419: long xc = x.cvl;
16420: long xb = 0L;
16421: if ((xc | xb) != 0L) {
16422: epbFpsr |= EPB_FPSR_X2;
16423: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16424: epbExceptionOperandMantissa = x.dvl;
16425: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16426: roundingMode == EPB_MODE_RM && xf < 0 ||
16427: roundingMode == EPB_MODE_RP && 0 <= xf) {
16428: xd++;
16429: if (xd == 0L) {
16430: xd = MSB;
16431: xe++;
16432: }
16433: }
16434:
16435: }
16436: xd <<= Long.numberOfLeadingZeros (xd);
16437:
16438: this.flg = xf;
16439: this.epp = xe;
16440: this.dvl = xd;
16441: this.cvl = 0L;
16442: return this;
16443: }
16444:
16445:
16446:
16447:
16448:
16449:
16450:
16451:
16452:
16453: public final EFP roundmany () {
16454: return this.roundmany (this, EPB_MODE_RN);
16455: }
16456: public final EFP roundmany (int roundingMode) {
16457: return this.roundmany (this, roundingMode);
16458: }
16459: public final EFP roundmany (EFP x) {
16460: return this.roundmany (x, EPB_MODE_RN);
16461: }
16462: public final EFP roundmany (EFP x, int roundingMode) {
16463: int xf = x.flg;
16464: if (xf << 1 != 0) {
16465: this.flg = xf;
16466: return this;
16467: }
16468:
16469: int xe = x.epp;
16470: long xd = x.dvl;
16471: long xc = x.cvl;
16472: long xb = 0L;
16473: xb = xc << -48;
16474: xc = xd << -48 | xc >>> 48;
16475: xd >>>= 48;
16476: if (xb != 0L) {
16477: epbFpsr |= EPB_FPSR_X2;
16478: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16479: epbExceptionOperandMantissa = x.dvl;
16480: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1) != 0L ||
16481: roundingMode == EPB_MODE_RM && xf < 0 ||
16482: roundingMode == EPB_MODE_RP && 0 <= xf) {
16483: xc++;
16484: if (xc == 0L) {
16485: xd++;
16486: if (xd >>> 16 != 0L) {
16487: xd = 1L << 15;
16488: xe++;
16489: }
16490: }
16491: }
16492:
16493: }
16494: xd = xd << 48 | xc >>> -48;
16495: xc <<= 48;
16496:
16497: this.flg = xf;
16498: this.epp = xe;
16499: this.dvl = xd;
16500: this.cvl = xc;
16501: return this;
16502: }
16503:
16504:
16505:
16506:
16507:
16508:
16509:
16510:
16511:
16512:
16513:
16514:
16515: public final EFP roundx () {
16516: return this.roundx (this, EPB_MODE_RN);
16517: }
16518: public final EFP roundx (int roundingMode) {
16519: return this.roundx (this, roundingMode);
16520: }
16521: public final EFP roundx2 (int roundingMode) {
16522: return this.roundx2 (this, roundingMode);
16523: }
16524: public final EFP roundx (EFP x) {
16525: return this.roundx (x, EPB_MODE_RN);
16526: }
16527: public final EFP roundx (EFP x, int roundingMode) {
16528: int xf = x.flg;
16529: if (xf << 1 != 0) {
16530: this.flg = xf;
16531: return this;
16532: }
16533:
16534: int xe = x.epp;
16535: long xd = x.dvl;
16536: long xc = x.cvl;
16537: if (xe < -16447) {
16538: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16539: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16540: epbExceptionOperandMantissa = xd;
16541: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16542: }
16543: if (16383 < xe) {
16544: if (true) {
16545: epbFpsr |= EPB_FPSR_OF;
16546: if (xc != 0L) {
16547: epbFpsr |= EPB_FPSR_X2;
16548: }
16549: } else {
16550: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16551: }
16552: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16553: epbExceptionOperandMantissa = xd;
16554: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16555: }
16556: long xb = 0L;
16557: int o = xe <= -16384 ? 0 + -16383 - xe : 0;
16558: if (o == 0) {
16559: } else if (o < 64) {
16560: xb = xc << -o;
16561: xc = xd << -o | xc >>> o;
16562: xd >>>= o;
16563: } else {
16564: xb = xc;
16565: xc = xd;
16566: xd = 0L;
16567: }
16568: if ((xc | xb) != 0L) {
16569: epbFpsr |= EPB_FPSR_X2;
16570: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16571: epbExceptionOperandMantissa = x.dvl;
16572: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16573: roundingMode == EPB_MODE_RM && xf < 0 ||
16574: roundingMode == EPB_MODE_RP && 0 <= xf) {
16575: xd++;
16576: if (xd == 0L) {
16577: xd = MSB;
16578: xe++;
16579: if (16383 < xe) {
16580: epbFpsr |= EPB_FPSR_OF;
16581: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16582: }
16583: } else if (0 < o) {
16584: if (xd << o - 1 < 0L) {
16585: xe++;
16586:
16587:
16588:
16589:
16590:
16591:
16592:
16593:
16594: }
16595: }
16596: }
16597:
16598: if (xe <= -16384) {
16599: epbFpsr |= EPB_FPSR_UF;
16600: if (xd == 0L) {
16601: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16602: }
16603: }
16604: } else {
16605: if (xe <= -16384) {
16606: epbFpsr |= EPB_FPSR_UF;
16607: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16608: epbExceptionOperandMantissa = x.dvl;
16609: if (xd == 0L) {
16610: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16611: }
16612: }
16613: }
16614: xd <<= Long.numberOfLeadingZeros (xd);
16615:
16616: this.flg = xf;
16617: this.epp = xe;
16618: this.dvl = xd;
16619: this.cvl = 0L;
16620: return this;
16621: }
16622: public final EFP roundx2 (EFP x, int roundingMode) {
16623: int xf = x.flg;
16624: if (xf << 1 != 0) {
16625: this.flg = xf;
16626: return this;
16627: }
16628:
16629: int xe = x.epp;
16630: long xd = x.dvl;
16631: long xc = x.cvl;
16632: if (xe < -16447) {
16633: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16634: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16635: epbExceptionOperandMantissa = xd;
16636: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16637: }
16638: if (16383 < xe) {
16639: if (true) {
16640: epbFpsr |= EPB_FPSR_OF;
16641: if (xc != 0L) {
16642: epbFpsr |= EPB_FPSR_X2;
16643: }
16644: } else {
16645: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16646: }
16647: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16648: epbExceptionOperandMantissa = xd;
16649: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16650: }
16651: long xb = 0L;
16652: int o = xe <= -16384 ? 0 + -16383 - xe : 0;
16653: if (o == 0) {
16654: } else if (o < 64) {
16655: xb = xc << -o;
16656: xc = xd << -o | xc >>> o;
16657: xd >>>= o;
16658: } else {
16659: xb = xc;
16660: xc = xd;
16661: xd = 0L;
16662: }
16663: if ((xc | xb) != 0L) {
16664: epbFpsr |= EPB_FPSR_X2;
16665: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16666: epbExceptionOperandMantissa = x.dvl;
16667: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16668: roundingMode == EPB_MODE_RM && xf < 0 ||
16669: roundingMode == EPB_MODE_RP && 0 <= xf) {
16670: xd++;
16671: if (xd == 0L) {
16672: xd = MSB;
16673: xe++;
16674: if (16383 < xe) {
16675: epbFpsr |= EPB_FPSR_OF;
16676: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16677: }
16678: } else if (0 < o) {
16679: if (xd << o - 1 < 0L) {
16680: xe++;
16681:
16682: if (xe == -16383) {
16683:
16684: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16685: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16686: epbExceptionOperandMantissa = xd;
16687: }
16688:
16689: }
16690: }
16691: }
16692:
16693: if (xe <= -16384) {
16694: epbFpsr |= EPB_FPSR_UF;
16695: if (xd == 0L) {
16696: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16697: }
16698: }
16699: } else {
16700: if (xe <= -16384) {
16701: epbFpsr |= EPB_FPSR_UF;
16702: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16703: epbExceptionOperandMantissa = x.dvl;
16704: if (xd == 0L) {
16705: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16706: }
16707: }
16708: }
16709: xd <<= Long.numberOfLeadingZeros (xd);
16710:
16711: this.flg = xf;
16712: this.epp = xe;
16713: this.dvl = xd;
16714: this.cvl = 0L;
16715: return this;
16716: }
16717:
16718:
16719:
16720:
16721:
16722:
16723:
16724:
16725:
16726:
16727:
16728:
16729: public final EFP roundy () {
16730: return this.roundy (this, EPB_MODE_RN);
16731: }
16732: public final EFP roundy (int roundingMode) {
16733: return this.roundy (this, roundingMode);
16734: }
16735: public final EFP roundy2 (int roundingMode) {
16736: return this.roundy2 (this, roundingMode);
16737: }
16738: public final EFP roundy (EFP x) {
16739: return this.roundy (x, EPB_MODE_RN);
16740: }
16741: public final EFP roundy (EFP x, int roundingMode) {
16742: int xf = x.flg;
16743: if (xf << 1 != 0) {
16744: this.flg = xf;
16745: return this;
16746: }
16747:
16748: int xe = x.epp;
16749: long xd = x.dvl;
16750: long xc = x.cvl;
16751: if (xe < -16463) {
16752: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16753: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16754: epbExceptionOperandMantissa = xd;
16755: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16756: }
16757: if (16383 < xe) {
16758: if (true) {
16759: epbFpsr |= EPB_FPSR_OF;
16760: if (xc << 16 != 0L) {
16761: epbFpsr |= EPB_FPSR_X2;
16762: }
16763: } else {
16764: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16765: }
16766: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16767: epbExceptionOperandMantissa = xd;
16768: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16769: }
16770: long xb = 0L;
16771: long xa = 0L;
16772: int o = xe <= -16384 ? 48 + -16383 - xe : 48;
16773: if (o < 64) {
16774: xb = xc << -o;
16775: xc = xd << -o | xc >>> o;
16776: xd >>>= o;
16777: } else if (o == 64) {
16778: xb = xc;
16779: xc = xd;
16780: xd = 0L;
16781: } else if (o < 128) {
16782: xa = xc << -o;
16783: xb = xd << -o | xc >>> o;
16784: xc = xd >>> o;
16785: xd = 0L;
16786: } else {
16787: xa = xc;
16788: xb = xd;
16789: xc = 0L;
16790: xd = 0L;
16791: }
16792: if ((xb | xa) != 0L) {
16793: epbFpsr |= EPB_FPSR_X2;
16794: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16795: epbExceptionOperandMantissa = x.dvl;
16796: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1 | xa) != 0L ||
16797: roundingMode == EPB_MODE_RM && xf < 0 ||
16798: roundingMode == EPB_MODE_RP && 0 <= xf) {
16799: xc++;
16800: if (xc == 0L) {
16801: xd++;
16802: if (xd >>> 16 != 0L) {
16803:
16804: xe++;
16805: if (16383 < xe) {
16806: epbFpsr |= EPB_FPSR_OF;
16807: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16808: }
16809: } else if (48 < o) {
16810: if (xd << o - 1 < 0L) {
16811: xe++;
16812:
16813:
16814:
16815:
16816:
16817:
16818:
16819:
16820: }
16821: }
16822: }
16823: }
16824:
16825: if (xe <= -16384) {
16826: epbFpsr |= EPB_FPSR_UF;
16827: if ((xd | xc) == 0L) {
16828: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16829: }
16830: }
16831: } else {
16832: if (xe <= -16384) {
16833: epbFpsr |= EPB_FPSR_UF;
16834: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16835: epbExceptionOperandMantissa = x.dvl;
16836: if ((xd | xc) == 0L) {
16837: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16838: }
16839: }
16840: }
16841: if (xd != 0L) {
16842: o = Long.numberOfLeadingZeros (xd);
16843: xd = xd << o | xc >>> -o;
16844: xc <<= o;
16845: } else {
16846: xd = xc << Long.numberOfLeadingZeros (xc);
16847: xc = 0L;
16848: }
16849:
16850: this.flg = xf;
16851: this.epp = xe;
16852: this.dvl = xd;
16853: this.cvl = xc;
16854: return this;
16855: }
16856: public final EFP roundy2 (EFP x, int roundingMode) {
16857: int xf = x.flg;
16858: if (xf << 1 != 0) {
16859: this.flg = xf;
16860: return this;
16861: }
16862:
16863: int xe = x.epp;
16864: long xd = x.dvl;
16865: long xc = x.cvl;
16866: if (xe < -16463) {
16867: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16868: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16869: epbExceptionOperandMantissa = xd;
16870: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16871: }
16872: if (16383 < xe) {
16873: if (true) {
16874: epbFpsr |= EPB_FPSR_OF;
16875: if (xc << 16 != 0L) {
16876: epbFpsr |= EPB_FPSR_X2;
16877: }
16878: } else {
16879: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16880: }
16881: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16882: epbExceptionOperandMantissa = xd;
16883: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16884: }
16885: long xb = 0L;
16886: long xa = 0L;
16887: int o = xe <= -16384 ? 48 + -16383 - xe : 48;
16888: if (o < 64) {
16889: xb = xc << -o;
16890: xc = xd << -o | xc >>> o;
16891: xd >>>= o;
16892: } else if (o == 64) {
16893: xb = xc;
16894: xc = xd;
16895: xd = 0L;
16896: } else if (o < 128) {
16897: xa = xc << -o;
16898: xb = xd << -o | xc >>> o;
16899: xc = xd >>> o;
16900: xd = 0L;
16901: } else {
16902: xa = xc;
16903: xb = xd;
16904: xc = 0L;
16905: xd = 0L;
16906: }
16907: if ((xb | xa) != 0L) {
16908: epbFpsr |= EPB_FPSR_X2;
16909: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16910: epbExceptionOperandMantissa = x.dvl;
16911: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1 | xa) != 0L ||
16912: roundingMode == EPB_MODE_RM && xf < 0 ||
16913: roundingMode == EPB_MODE_RP && 0 <= xf) {
16914: xc++;
16915: if (xc == 0L) {
16916: xd++;
16917: if (xd >>> 16 != 0L) {
16918:
16919: xe++;
16920: if (16383 < xe) {
16921: epbFpsr |= EPB_FPSR_OF;
16922: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16923: }
16924: } else if (48 < o) {
16925: if (xd << o - 1 < 0L) {
16926: xe++;
16927:
16928: if (xe == -16383) {
16929:
16930: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16931: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16932: epbExceptionOperandMantissa = xd;
16933: }
16934:
16935: }
16936: }
16937: }
16938: }
16939:
16940: if (xe <= -16384) {
16941: epbFpsr |= EPB_FPSR_UF;
16942: if ((xd | xc) == 0L) {
16943: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16944: }
16945: }
16946: } else {
16947: if (xe <= -16384) {
16948: epbFpsr |= EPB_FPSR_UF;
16949: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16950: epbExceptionOperandMantissa = x.dvl;
16951: if ((xd | xc) == 0L) {
16952: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16953: }
16954: }
16955: }
16956: if (xd != 0L) {
16957: o = Long.numberOfLeadingZeros (xd);
16958: xd = xd << o | xc >>> -o;
16959: xc <<= o;
16960: } else {
16961: xd = xc << Long.numberOfLeadingZeros (xc);
16962: xc = 0L;
16963: }
16964:
16965: this.flg = xf;
16966: this.epp = xe;
16967: this.dvl = xd;
16968: this.cvl = xc;
16969: return this;
16970: }
16971:
16972:
16973:
16974:
16975:
16976:
16977:
16978:
16979: public final EFP scale (EFP y) {
16980: return this.scale (this, y);
16981: }
16982: public final EFP scale (EFP x, EFP y) {
16983: int xf = x.flg;
16984: int yf = y.flg;
16985: if ((xf | yf) << 1 != 0) {
16986: if ((xf | yf) << 3 < 0) {
16987: this.flg = N;
16988: } else if (yf << 1 < 0) {
16989: this.finish (x.flg, x.epp, x.dvl, x.cvl, 0L);
16990: } else if (yf << 2 < 0) {
16991: epbFpsr |= EPB_FPSR_OE;
16992: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
16993: epbExceptionOperandMantissa = 0x0000000000000000L;
16994: this.flg = N;
16995: } else if (xf << 1 < 0) {
16996: this.flg = xf;
16997: } else if (xf << 2 < 0) {
16998: this.flg = xf;
16999: }
17000: return this;
17001: }
17002:
17003:
17004:
17005: int i = (16 <= y.epp ? yf < 0 ? -1 << 16 : 1 << 16 :
17006: y.geti ());
17007: if (i <= -1 << 14) {
17008: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
17009: if (i <= -1 << 16) {
17010: epbExceptionOperandExponent = xf;
17011: epbExceptionOperandMantissa = x.dvl;
17012: } else {
17013: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + i << 16;
17014: epbExceptionOperandMantissa = x.dvl;
17015: }
17016: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
17017: }
17018: if (1 << 14 <= i) {
17019: epbFpsr |= EPB_FPSR_OF;
17020: if (1 << 16 <= i) {
17021: epbExceptionOperandExponent = xf;
17022: epbExceptionOperandMantissa = x.dvl;
17023: } else {
17024: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + i << 16;
17025: epbExceptionOperandMantissa = x.dvl;
17026: }
17027: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
17028: }
17029: return this.finish2 (xf, x.epp + i, x.dvl, x.cvl, 0L);
17030: }
17031:
17032:
17033:
17034:
17035:
17036:
17037:
17038:
17039:
17040:
17041:
17042:
17043:
17044:
17045:
17046:
17047:
17048:
17049:
17050:
17051:
17052:
17053:
17054:
17055:
17056:
17057:
17058:
17059:
17060:
17061:
17062:
17063:
17064:
17065:
17066:
17067:
17068:
17069:
17070:
17071:
17072:
17073:
17074:
17075:
17076:
17077:
17078:
17079:
17080:
17081:
17082:
17083:
17084:
17085:
17086:
17087: public final EFP sec () {
17088: return this.sec (this);
17089: }
17090: public final EFP sec (EFP x) {
17091: return this.inner ().cos (x).outer ().rcp ();
17092: }
17093:
17094:
17095:
17096:
17097:
17098:
17099:
17100:
17101:
17102:
17103:
17104:
17105:
17106:
17107:
17108:
17109:
17110:
17111:
17112:
17113:
17114:
17115:
17116:
17117:
17118:
17119:
17120:
17121:
17122:
17123:
17124:
17125:
17126:
17127:
17128:
17129:
17130:
17131:
17132:
17133:
17134:
17135:
17136:
17137:
17138:
17139:
17140:
17141:
17142:
17143:
17144:
17145:
17146:
17147:
17148:
17149:
17150:
17151:
17152:
17153: public final EFP sech () {
17154: return this.sech (this);
17155: }
17156: public final EFP sech (EFP x) {
17157: return this.inner ().cosh (x).outer ().rcp ();
17158: }
17159:
17160:
17161:
17162:
17163:
17164: public final EFP set0 () {
17165: this.flg = P | Z;
17166:
17167:
17168:
17169: return this;
17170: }
17171:
17172:
17173:
17174:
17175:
17176: public final EFP set1 () {
17177: this.flg = P;
17178: this.epp = 0;
17179: this.dvl = MSB;
17180: this.cvl = 0L;
17181: return this;
17182: }
17183:
17184:
17185:
17186:
17187:
17188:
17189:
17190:
17191:
17192:
17193:
17194:
17195:
17196:
17197:
17198:
17199:
17200:
17201:
17202:
17203: public final EFP setapery () {
17204: epbFpsr |= EPB_FPSR_X2;
17205: return this.sete (ROUNDED_APERY[epbRoundingMode]).finish ();
17206: }
17207:
17208:
17209:
17210:
17211:
17212:
17213:
17214:
17215:
17216:
17217:
17218:
17219:
17220:
17221:
17222:
17223:
17224:
17225:
17226: public final EFP setcatalan () {
17227: epbFpsr |= EPB_FPSR_X2;
17228: return this.sete (ROUNDED_CATALAN[epbRoundingMode]).finish ();
17229: }
17230:
17231:
17232:
17233:
17234:
17235:
17236:
17237:
17238:
17239: public final EFP setd (double d) {
17240: return setd01 (Double.doubleToLongBits (d));
17241: }
17242: public final EFP setd01 (byte[] b, int a) {
17243: return setd01 ((long) b[a] << 56 |
17244: (long) (0xff & b[a + 1]) << 48 |
17245: (long) (0xff & b[a + 2]) << 40 |
17246: (long) (0xff & b[a + 3]) << 32 |
17247: (long) (0xff & b[a + 4]) << 24 |
17248: (long) (0xff & b[a + 5]) << 16 |
17249: (long) (0xff & b[a + 6]) << 8 |
17250: (long) (0xff & b[a + 7]));
17251: }
17252: public final EFP setd01 (int[] ib, int ia) {
17253: return setd01 ((long) ib[ia] << 32 |
17254: (0xffffffffL & ib[ia + 1]));
17255: }
17256: public final EFP setd01 (long l) {
17257: int zf = (int) (l >>> 32) & M;
17258: int ze = ((int) (l >>> 52) & 0x7ff) - 1023;
17259: long zd = 0L;
17260: l &= -1L >>> 12;
17261: if (ze == 1024) {
17262: if (l == 0L) {
17263: zf |= I;
17264: } else {
17265: if (l << 12 >= 0L) {
17266: epbFpsr |= EPB_FPSR_SN;
17267: epbExceptionOperandExponent = 0x7fff << 16;
17268: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17269: }
17270: zf = N;
17271: }
17272: } else if (ze >= -1022) {
17273: zd = MSB | l << 11;
17274: } else if (l == 0L) {
17275: zf |= Z;
17276: } else {
17277: int o = Long.numberOfLeadingZeros (l);
17278: ze -= o - 12;
17279: zd = l << o;
17280: }
17281: this.flg = zf;
17282: this.epp = ze;
17283: this.dvl = zd;
17284: this.cvl = 0L;
17285:
17286:
17287: return this;
17288: }
17289:
17290:
17291:
17292:
17293:
17294:
17295:
17296:
17297: public final EFP sete (EFP x) {
17298: this.flg = x.flg;
17299: this.epp = x.epp;
17300: this.dvl = x.dvl;
17301: this.cvl = x.cvl;
17302: return this;
17303: }
17304:
17305:
17306:
17307:
17308:
17309:
17310:
17311:
17312:
17313:
17314:
17315:
17316:
17317:
17318:
17319:
17320:
17321:
17322: public final EFP seteuler () {
17323: epbFpsr |= EPB_FPSR_X2;
17324: return this.sete (ROUNDED_EULER[epbRoundingMode]).finish ();
17325: }
17326:
17327:
17328:
17329:
17330:
17331:
17332:
17333:
17334:
17335: public final EFP setf (float f) {
17336: return setf0 (Float.floatToIntBits (f));
17337: }
17338: public final EFP setf0 (byte[] b, int a) {
17339: return setf0 (b[a] << 24 |
17340: (0xff & b[a + 1]) << 16 |
17341: (0xff & b[a + 2]) << 8 |
17342: (0xff & b[a + 3]));
17343: }
17344: public final EFP setf0 (int[] ib, int ia) {
17345: return setf0 (ib[ia]);
17346: }
17347: public final EFP setf0 (int i) {
17348: int zf = i & M;
17349: int ze = (i >>> 23 & 0xff) - 127;
17350: long zd = 0L;
17351: i &= -1 >>> 9;
17352: if (ze == 128) {
17353: if (i == 0) {
17354: zf |= I;
17355: } else {
17356: if (i << 9 >= 0) {
17357: epbFpsr |= EPB_FPSR_SN;
17358: epbExceptionOperandExponent = 0x7fff << 16;
17359: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17360: }
17361: zf = N;
17362: }
17363: } else if (ze >= -126) {
17364: zd = (long) (1 << 23 | i) << 32 + 8;
17365: } else if (i == 0) {
17366: zf |= Z;
17367: } else {
17368: int o = Integer.numberOfLeadingZeros (i);
17369: ze -= o - 9;
17370: zd = (long) i << 32 + o;
17371: }
17372: this.flg = zf;
17373: this.epp = ze;
17374: this.dvl = zd;
17375: this.cvl = 0L;
17376:
17377:
17378: return this;
17379: }
17380:
17381:
17382:
17383:
17384:
17385: public final EFP seti (int i) {
17386: if (i == 0) {
17387: this.flg = P | Z;
17388: return this;
17389: }
17390: int zf = P;
17391: if (i < 0) {
17392: zf = M;
17393: i = -i;
17394: }
17395: int ze = 31 - Integer.numberOfLeadingZeros (i);
17396: long zd = (long) i << 63 - ze;
17397: return this.finish (zf, ze, zd, 0L, 0L);
17398: }
17399:
17400:
17401:
17402:
17403:
17404: public final EFP setinf () {
17405: this.flg = P | I;
17406:
17407:
17408:
17409: return this;
17410: }
17411:
17412:
17413:
17414:
17415:
17416: public final EFP setl (long l) {
17417: if (l == 0L) {
17418: this.flg = P | Z;
17419: return this;
17420: }
17421: int zf = P;
17422: if (l < 0L) {
17423: zf = M;
17424: l = -l;
17425: }
17426: int ze = 63 - Long.numberOfLeadingZeros (l);
17427: long zd = l << ~ze;
17428: return this.finish (zf, ze, zd, 0L, 0L);
17429: }
17430:
17431:
17432:
17433:
17434:
17435:
17436:
17437: public final EFP setmax () {
17438: return this.finish (P, 32767, 0xffffffffffffffffL, 0xffffffffffffffffL << 128 - LEN, 0L);
17439: }
17440:
17441:
17442:
17443:
17444:
17445:
17446:
17447: public final EFP setmin () {
17448: return this.finish (M, -32767, MSB, 0L, 0L);
17449: }
17450:
17451:
17452:
17453:
17454:
17455: public final EFP setnan () {
17456: this.flg = N;
17457:
17458:
17459:
17460: return this;
17461: }
17462:
17463:
17464:
17465:
17466:
17467:
17468:
17469:
17470:
17471:
17472:
17473:
17474:
17475:
17476:
17477:
17478:
17479:
17480: public final EFP setnapier () {
17481: epbFpsr |= EPB_FPSR_X2;
17482: return this.sete (ROUNDED_NAPIER[epbRoundingMode]).finish ();
17483: }
17484:
17485:
17486:
17487:
17488:
17489:
17490:
17491: public final EFP setp012 (byte[] b, int a) {
17492: return setp012 (b[a] << 24 |
17493: (0xff & b[a + 1]) << 16 |
17494: (0xff & b[a + 2]) << 8 |
17495: (0xff & b[a + 3]),
17496: (long) b[a + 4] << 56 |
17497: (long) (0xff & b[a + 5]) << 48 |
17498: (long) (0xff & b[a + 6]) << 40 |
17499: (long) (0xff & b[a + 7]) << 32 |
17500: (long) (0xff & b[a + 8]) << 24 |
17501: (long) (0xff & b[a + 9]) << 16 |
17502: (long) (0xff & b[a + 10]) << 8 |
17503: (long) (0xff & b[a + 11]));
17504: }
17505: public final EFP setp012 (int[] ib, int ia) {
17506: return setp012 (ib[ia],
17507: (long) ib[ia + 1] << 32 |
17508: (0xffffffffL & ib[ia + 2]));
17509: }
17510: public final EFP setp012 (int u, long v) {
17511: int zf = u & M;
17512: int e = XEiJ.FMT_DCB4[u >>> 16 & 0xfff];
17513: int m0 = XEiJ.FMT_DCB4[u & 0x000f];
17514: int m1 = XEiJ.FMT_DCB4[(char) (v >>> 48)];
17515: int m2 = XEiJ.FMT_DCB4[(char) (v >>> 32)];
17516: int m3 = XEiJ.FMT_DCB4[(char) (v >>> 16)];
17517: int m4 = XEiJ.FMT_DCB4[(char) v ];
17518: {
17519: int t = m0 | m1 | m2 | m3 | m4;
17520: if ((u & 0x30000000) != 0 ||
17521: (e | t) < 0) {
17522: if (v == 0L) {
17523: this.flg = zf | I;
17524: } else {
17525: if (v << 1 >= 0L) {
17526: epbFpsr |= EPB_FPSR_SN;
17527: epbExceptionOperandExponent = 0x7fff << 16;
17528: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17529: }
17530: this.flg = N;
17531: }
17532: return this;
17533: }
17534: if (t == 0) {
17535: this.flg = zf | Z;
17536: return this;
17537: }
17538: }
17539:
17540:
17541: int savedMode = epbRoundingMode;
17542: int savedFpsr = epbFpsr;
17543: epbFpsr = 0;
17544:
17545: this.inner ();
17546: EFP t = new EFP ();
17547: this.setl ((long) (m0 * 100000000 + m1 * 10000 + m2)).imul (TENXP3).iadd (t.setl ((long) (m3 * 10000 + m4)));
17548:
17549:
17550: this.flg |= zf;
17551:
17552: if (u << 1 < 0) {
17553: e = -e;
17554: }
17555: e -= 16;
17556: if (e < 0) {
17557: e = -e;
17558: t.set1 ();
17559: for (int i = 0; e != 0; i++, e >>>= 1) {
17560: if ((e & 1) != 0) {
17561: t.imul (EFP_TEN_POWER_P[i]);
17562: }
17563: }
17564: epbRoundingPrec = EPB_PREC_EXD;
17565: epbRoundingMode = savedMode;
17566: this.div (t);
17567: } else {
17568: t.set1 ();
17569: for (int i = 0; e != 0; i++, e >>>= 1) {
17570: if ((e & 1) != 0) {
17571: t.imul (EFP_TEN_POWER_P[i]);
17572: }
17573: }
17574: epbRoundingPrec = EPB_PREC_EXD;
17575: epbRoundingMode = savedMode;
17576: this.mul (t);
17577: }
17578: this.outer ();
17579:
17580: epbFpsr = savedFpsr | epbFpsr >>> 1 & EPB_FPSR_X1;
17581:
17582:
17583: return this.finish ();
17584: }
17585:
17586:
17587:
17588:
17589:
17590:
17591:
17592:
17593:
17594:
17595:
17596:
17597:
17598:
17599:
17600:
17601:
17602:
17603:
17604:
17605:
17606:
17607:
17608:
17609:
17610:
17611:
17612:
17613:
17614:
17615:
17616:
17617:
17618:
17619:
17620:
17621:
17622:
17623:
17624:
17625:
17626:
17627:
17628:
17629:
17630:
17631:
17632:
17633:
17634:
17635:
17636:
17637:
17638:
17639:
17640:
17641:
17642:
17643: public final EFP setpi () {
17644: epbFpsr |= EPB_FPSR_X2;
17645: return this.sete (ROUNDED_PI[epbRoundingMode]).finish ();
17646: }
17647:
17648:
17649:
17650:
17651:
17652:
17653:
17654:
17655: public final EFP setx012 (byte[] b, int a) {
17656: return setx012 (b[a] << 24 |
17657: (0xff & b[a + 1]) << 16 |
17658: (0xff & b[a + 2]) << 8 |
17659: (0xff & b[a + 3]),
17660: (long) b[a + 4] << 56 |
17661: (long) (0xff & b[a + 5]) << 48 |
17662: (long) (0xff & b[a + 6]) << 40 |
17663: (long) (0xff & b[a + 7]) << 32 |
17664: (long) (0xff & b[a + 8]) << 24 |
17665: (long) (0xff & b[a + 9]) << 16 |
17666: (long) (0xff & b[a + 10]) << 8 |
17667: (long) (0xff & b[a + 11]));
17668: }
17669: public final EFP setx012 (int[] ib, int ia) {
17670: return setx012 (ib[ia],
17671: (long) ib[ia + 1] << 32 |
17672: (0xffffffffL & ib[ia + 2]));
17673: }
17674: public final EFP setx012 (int i, long l) {
17675: int zf = i & M;
17676: int ze = (i >>> 16 & 32767) - 16383;
17677: if (ze == 16384) {
17678: if (l == 0L) {
17679: this.flg = zf | I;
17680: } else {
17681: if (l << 1 >= 0L) {
17682: epbFpsr |= EPB_FPSR_SN;
17683: epbExceptionOperandExponent = 0x7fff << 16;
17684: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17685: }
17686: this.flg = N;
17687: }
17688: return this;
17689: }
17690: if (l == 0L) {
17691: this.flg = zf | Z;
17692: return this;
17693: }
17694: if (l >= 0L) {
17695: int o = Long.numberOfLeadingZeros (l);
17696: ze -= o;
17697: l <<= o;
17698: }
17699: this.flg = zf;
17700: this.epp = ze;
17701: this.dvl = l;
17702: this.cvl = 0L;
17703:
17704:
17705: return this;
17706: }
17707:
17708:
17709:
17710:
17711:
17712:
17713:
17714:
17715: public final EFP sety012 (byte[] b, int a) {
17716: return sety012 (b[a] << 24 |
17717: (0xff & b[a + 1]) << 16 |
17718: (0xff & b[a + 2]) << 8 |
17719: (0xff & b[a + 3]),
17720: (long) b[a + 4] << 56 |
17721: (long) (0xff & b[a + 5]) << 48 |
17722: (long) (0xff & b[a + 6]) << 40 |
17723: (long) (0xff & b[a + 7]) << 32 |
17724: (long) (0xff & b[a + 8]) << 24 |
17725: (long) (0xff & b[a + 9]) << 16 |
17726: (long) (0xff & b[a + 10]) << 8 |
17727: (long) (0xff & b[a + 11]));
17728: }
17729: public final EFP sety012 (int[] ib, int ia) {
17730: return sety012 (ib[ia],
17731: (long) ib[ia + 1] << 32 |
17732: (0xffffffffL & ib[ia + 2]));
17733: }
17734: public final EFP sety012 (int i, long l) {
17735: int zf = i & M;
17736: int ze = (i >>> 16 & 32767) - 16383;
17737: if (ze == 16384) {
17738: if (l == 0L) {
17739: this.flg = zf | I;
17740: } else {
17741: if (l << 1 >= 0L) {
17742: epbFpsr |= EPB_FPSR_SN;
17743: epbExceptionOperandExponent = 0x7fff << 16;
17744: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17745: }
17746: this.flg = N;
17747: }
17748: return this;
17749: }
17750: long m = (long) i << 48;
17751: if (l == 0L && m == 0L) {
17752: this.flg = zf | Z;
17753: return this;
17754: }
17755: if (l >= 0L) {
17756: if (l != 0L) {
17757: int o = Long.numberOfLeadingZeros (l);
17758: ze -= o;
17759: l = l << o | m >>> -o;
17760: m <<= o;
17761: } else {
17762: int o = 64 + Long.numberOfLeadingZeros (m);
17763: ze -= o;
17764: l = m << o;
17765: m = 0L;
17766: }
17767: }
17768: this.flg = zf;
17769: this.epp = ze;
17770: this.dvl = l;
17771: this.cvl = m;
17772:
17773:
17774: return this;
17775: }
17776:
17777:
17778:
17779:
17780:
17781:
17782:
17783:
17784:
17785:
17786:
17787:
17788:
17789:
17790:
17791:
17792:
17793:
17794:
17795:
17796:
17797:
17798:
17799:
17800:
17801:
17802:
17803:
17804:
17805:
17806:
17807:
17808:
17809:
17810:
17811:
17812:
17813:
17814:
17815:
17816:
17817:
17818:
17819:
17820:
17821:
17822:
17823:
17824:
17825:
17826:
17827:
17828:
17829:
17830:
17831:
17832:
17833:
17834:
17835:
17836:
17837: public final EFP sgn () {
17838: return this.sgn (this);
17839: }
17840: public final EFP sgn (EFP x) {
17841: int xf = x.flg;
17842: if ((xf & (Z | N)) != 0) {
17843: this.flg = xf;
17844: } else {
17845: this.flg = xf & M;
17846: this.epp = 0;
17847: this.dvl = MSB;
17848: this.cvl = 0L;
17849: }
17850: return this;
17851: }
17852:
17853:
17854:
17855:
17856:
17857:
17858:
17859:
17860:
17861:
17862:
17863:
17864:
17865:
17866:
17867:
17868:
17869:
17870:
17871:
17872:
17873:
17874:
17875:
17876:
17877:
17878:
17879:
17880:
17881:
17882:
17883: public final EFP sgnsub (EFP y) {
17884: return this.sgnsub (this, y);
17885: }
17886: public final EFP sgnsub (EFP x, EFP y) {
17887: int xf = x.flg;
17888: int yf = y.flg;
17889: if ((xf | yf) << 1 != 0) {
17890: if ((xf & yf) << 1 < 0 && xf == yf) {
17891: this.flg = P | Z;
17892: } else if ((xf & yf) << 2 < 0 && xf == yf ||
17893: (xf | yf) << 3 < 0) {
17894: this.flg = N;
17895: } else if ((xf << 1 | yf << 2) < 0) {
17896: if (yf << 1 < 0) {
17897: this.flg = yf ^ M;
17898: } else {
17899: this.flg = yf & M ^ M;
17900: this.epp = 0;
17901: this.dvl = MSB;
17902: this.cvl = 0L;
17903: }
17904: } else {
17905: this.flg = xf & M;
17906: this.epp = 0;
17907: this.dvl = MSB;
17908: this.cvl = 0L;
17909: }
17910: } else if (xf != yf) {
17911: this.flg = xf >= 0 ? P : M;
17912: this.epp = 0;
17913: this.dvl = MSB;
17914: this.cvl = 0L;
17915: } else {
17916: int s;
17917: long t;
17918: s = (xf >= 0 ? 1 : -1) * ((s = x.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
17919: (t = x.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
17920: (t = (x.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
17921: 0);
17922: if (s != 0) {
17923: this.flg = s >= 0 ? P : M;
17924: this.epp = 0;
17925: this.dvl = MSB;
17926: this.cvl = 0L;
17927: } else {
17928: this.flg = P | Z;
17929: }
17930: }
17931: return this;
17932: }
17933:
17934:
17935:
17936:
17937:
17938:
17939:
17940:
17941: public final EFP shl (int n) {
17942:
17943: n = Math.max (-65536, Math.min (65536, n));
17944: return this.finish (this.flg, this.epp + n, this.dvl, this.cvl, 0L);
17945: }
17946: public final EFP shl (EFP x, int n) {
17947:
17948: n = Math.max (-65536, Math.min (65536, n));
17949: return this.finish (x.flg, x.epp + n, x.dvl, x.cvl, 0L);
17950: }
17951:
17952:
17953:
17954:
17955:
17956:
17957:
17958:
17959: public final EFP shr (int n) {
17960:
17961: n = Math.max (-65536, Math.min (65536, n));
17962: return this.finish (this.flg, this.epp - n, this.dvl, this.cvl, 0L);
17963: }
17964: public final EFP shr (EFP x, int n) {
17965:
17966: n = Math.max (-65536, Math.min (65536, n));
17967: return this.finish (x.flg, x.epp - n, x.dvl, x.cvl, 0L);
17968: }
17969:
17970:
17971:
17972:
17973:
17974:
17975:
17976:
17977:
17978:
17979:
17980:
17981:
17982:
17983:
17984:
17985:
17986:
17987:
17988:
17989:
17990:
17991:
17992:
17993:
17994:
17995:
17996:
17997:
17998:
17999:
18000:
18001:
18002:
18003:
18004:
18005:
18006:
18007:
18008:
18009:
18010:
18011:
18012:
18013:
18014:
18015:
18016:
18017:
18018:
18019:
18020:
18021:
18022:
18023:
18024:
18025:
18026:
18027:
18028:
18029:
18030:
18031:
18032:
18033:
18034:
18035:
18036:
18037:
18038:
18039:
18040:
18041:
18042:
18043:
18044:
18045:
18046:
18047:
18048:
18049:
18050:
18051:
18052:
18053:
18054:
18055:
18056:
18057:
18058:
18059:
18060:
18061:
18062:
18063:
18064:
18065:
18066:
18067:
18068:
18069:
18070:
18071:
18072:
18073:
18074:
18075:
18076: public final EFP sin () {
18077: return this.sin (this);
18078: }
18079: public final EFP sin (EFP x) {
18080: int xf = x.flg;
18081: if (xf << 1 != 0) {
18082: if (xf << 1 < 0) {
18083: this.flg = xf;
18084: } else if (xf << 2 < 0) {
18085: epbFpsr |= EPB_FPSR_OE;
18086: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
18087: epbExceptionOperandMantissa = 0x0000000000000000L;
18088: this.flg = N;
18089: } else {
18090: this.flg = N;
18091: }
18092: return this;
18093: }
18094:
18095: int savedFpsr = epbFpsr;
18096: this.inner ();
18097: if (this == x) {
18098: x = new EFP (x);
18099: }
18100: EFP u = new EFP ();
18101: EFP u2 = new EFP ();
18102: int k = u.ieeerempi2 (x);
18103: if (false) {
18104: EFP s = new EFP ();
18105: EFP t = new EFP ();
18106: u2.isqu (u);
18107: if ((k & 1) == 0) {
18108:
18109: s.flg = u.flg;
18110: s.epp = u.epp;
18111: s.dvl = u.dvl;
18112: s.cvl = u.cvl;
18113:
18114: t.flg = P | Z;
18115:
18116: this.flg = s.flg;
18117: this.epp = s.epp;
18118: this.dvl = s.dvl;
18119: this.cvl = s.cvl;
18120: for (int twok1 = 3; this.ne (t); twok1 += 2) {
18121: s.imul (u2).divi ((1 - twok1) * twok1);
18122:
18123: t.flg = this.flg;
18124: t.epp = this.epp;
18125: t.dvl = this.dvl;
18126: t.cvl = this.cvl;
18127: this.iadd (s);
18128: }
18129: } else {
18130:
18131: s.flg = P;
18132: s.epp = 0;
18133: s.dvl = MSB;
18134: s.cvl = 0L;
18135:
18136: t.flg = P | Z;
18137:
18138: this.flg = s.flg;
18139: this.epp = s.epp;
18140: this.dvl = s.dvl;
18141: this.cvl = s.cvl;
18142: for (int twok = 2; this.ne (t); twok += 2) {
18143: s.imul (u2).divi ((1 - twok) * twok);
18144:
18145: t.flg = this.flg;
18146: t.epp = this.epp;
18147: t.dvl = this.dvl;
18148: t.cvl = this.cvl;
18149: this.iadd (s);
18150: }
18151: }
18152: } else {
18153: if ((k & 1) == 0) {
18154: u2.isqu (u);
18155: this.imul (SIN_C21, u2)
18156: .iadd (SIN_C19).imul (u2)
18157: .iadd (SIN_C17).imul (u2)
18158: .iadd (SIN_C15).imul (u2)
18159: .iadd (SIN_C13).imul (u2)
18160: .iadd (SIN_C11).imul (u2)
18161: .iadd (SIN_C9).imul (u2)
18162: .iadd (SIN_C7).imul (u2)
18163: .iadd (SIN_C5).imul (u2)
18164: .iadd (SIN_C3).imul (u2)
18165: .iadd (SIN_C1).imul (u);
18166: } else {
18167: u2.isqu (u);
18168: this.imul (COS_C20, u2)
18169: .iadd (COS_C18).imul (u2)
18170: .iadd (COS_C16).imul (u2)
18171: .iadd (COS_C14).imul (u2)
18172: .iadd (COS_C12).imul (u2)
18173: .iadd (COS_C10).imul (u2)
18174: .iadd (COS_C8).imul (u2)
18175: .iadd (COS_C6).imul (u2)
18176: .iadd (COS_C4).imul (u2)
18177: .iadd (COS_C2).imul (u2)
18178: .iadd (COS_C0);
18179: }
18180: }
18181: this.outer ().neg (k << 30 < 0);
18182:
18183:
18184:
18185: if (this.flg << 1 == 0 && this.epp == 0) {
18186: if (this.flg < 0) {
18187: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
18188: this.sete (NEXTUP_MINUSONE[epbRoundingPrec]);
18189: }
18190: } else {
18191: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
18192: this.sete (NEXTDOWN_PLUSONE[epbRoundingPrec]);
18193: }
18194: }
18195: }
18196: return this.originUpperLower (x).correctUnderflow (savedFpsr);
18197: }
18198:
18199:
18200:
18201:
18202:
18203:
18204:
18205:
18206:
18207:
18208:
18209:
18210:
18211:
18212:
18213:
18214:
18215:
18216:
18217:
18218:
18219:
18220:
18221:
18222:
18223:
18224:
18225:
18226:
18227:
18228:
18229:
18230:
18231:
18232:
18233:
18234:
18235:
18236:
18237:
18238:
18239:
18240:
18241:
18242:
18243:
18244:
18245:
18246:
18247:
18248:
18249:
18250:
18251:
18252:
18253:
18254:
18255:
18256:
18257:
18258:
18259:
18260:
18261:
18262:
18263:
18264:
18265:
18266:
18267:
18268:
18269:
18270:
18271:
18272:
18273:
18274:
18275:
18276:
18277: public final EFP sinh () {
18278: return this.sinh (this);
18279: }
18280: public final EFP sinh (EFP x) {
18281: int xf = x.flg;
18282: if (xf << 1 != 0) {
18283: this.flg = xf;
18284: return this;
18285: }
18286:
18287: epbFpsr |= EPB_FPSR_X2;
18288: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
18289: epbExceptionOperandMantissa = x.dvl;
18290: if (15 <= x.epp) {
18291: epbFpsr |= EPB_FPSR_OF;
18292: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
18293: }
18294: if (x.epp < -3) {
18295: int savedFpsr = epbFpsr;
18296: this.inner ();
18297: if (this == x) {
18298: x = new EFP (x);
18299: }
18300: EFP x2 = new EFP ().isqu (x);
18301: this.imul (SINH_C13, x2)
18302: .iadd (SINH_C11).imul (x2)
18303: .iadd (SINH_C9).imul (x2)
18304: .iadd (SINH_C7).imul (x2)
18305: .iadd (SINH_C5).imul (x2)
18306: .iadd (SINH_C3).imul (x2)
18307: .iadd (SINH_C1).outer ().mul (x);
18308: return this.originLowerUpper (x).correctUnderflow (savedFpsr);
18309: }
18310:
18311:
18312:
18313:
18314: this.inner ().abs (x).exp ();
18315: this.sub (new EFP ().rcp (this)).div2 ().outer ().neg (xf < 0);
18316: if (this.flg << 2 < 0) {
18317: epbFpsr |= EPB_FPSR_OF;
18318: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | this.flg >>> 31]).finish ();
18319: }
18320: return this;
18321: }
18322:
18323:
18324:
18325:
18326:
18327:
18328:
18329:
18330:
18331:
18332:
18333:
18334:
18335:
18336:
18337:
18338:
18339:
18340:
18341:
18342:
18343:
18344:
18345:
18346:
18347:
18348:
18349:
18350:
18351:
18352:
18353:
18354:
18355:
18356:
18357:
18358:
18359:
18360:
18361:
18362:
18363:
18364:
18365:
18366:
18367:
18368:
18369:
18370:
18371:
18372:
18373:
18374:
18375:
18376:
18377:
18378:
18379:
18380:
18381:
18382:
18383:
18384:
18385:
18386:
18387:
18388:
18389:
18390:
18391:
18392:
18393:
18394:
18395:
18396:
18397:
18398:
18399:
18400:
18401:
18402:
18403:
18404:
18405:
18406:
18407:
18408:
18409:
18410:
18411:
18412:
18413:
18414:
18415:
18416:
18417:
18418:
18419:
18420:
18421:
18422:
18423:
18424:
18425:
18426:
18427:
18428:
18429:
18430:
18431:
18432:
18433:
18434:
18435:
18436:
18437:
18438:
18439:
18440:
18441:
18442:
18443:
18444:
18445:
18446:
18447:
18448:
18449:
18450:
18451:
18452:
18453:
18454:
18455:
18456:
18457:
18458:
18459:
18460:
18461:
18462:
18463:
18464:
18465:
18466:
18467:
18468:
18469:
18470: public final EFP sqrt () {
18471: return this.sqrt (this);
18472: }
18473: public final EFP sqrt (EFP x) {
18474: int xf = x.flg;
18475: if (xf != 0) {
18476: if (xf == M || xf == (M | I)) {
18477: epbFpsr |= EPB_FPSR_OE;
18478: if (xf << 2 < 0) {
18479: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
18480: epbExceptionOperandMantissa = 0x0000000000000000L;
18481: } else {
18482: epbExceptionOperandExponent = xf & M | 0x3fff + x.epp << 16;
18483: epbExceptionOperandMantissa = x.dvl;
18484: }
18485: this.flg = N;
18486: } else {
18487: this.flg = xf;
18488: }
18489: return this;
18490: }
18491:
18492: if (false) {
18493: this.inner ();
18494: EFP t = new EFP (ONE).max (x);
18495: EFP u = new EFP (x);
18496: EFP w = new EFP ();
18497: do {
18498:
18499: this.flg = t.flg;
18500: this.epp = t.epp;
18501: this.dvl = t.dvl;
18502: this.cvl = t.cvl;
18503: t.iadd (w.sete (u).div (t)).idiv2 ();
18504: } while (this.gt (t));
18505: return this.outer ().finish ();
18506: } else {
18507: if (this == x) {
18508: x = new EFP (x);
18509: }
18510: int xe = x.epp;
18511: if ((xe & 1) != 0 ? (x.dvl >>> -8) == 0xFF : (x.dvl >>> -9) == 0x100) {
18512:
18513:
18514: this.inner ();
18515: x.epp = -(xe & 1);
18516: x.dec ();
18517: this.imul (x, SQRT1PM1_C11).
18518: iadd (SQRT1PM1_C10).imul (x).
18519: iadd (SQRT1PM1_C9).imul (x).
18520: iadd (SQRT1PM1_C8).imul (x).
18521: iadd (SQRT1PM1_C7).imul (x).
18522: iadd (SQRT1PM1_C6).imul (x).
18523: iadd (SQRT1PM1_C5).imul (x).
18524: iadd (SQRT1PM1_C4).imul (x).
18525: iadd (SQRT1PM1_C3).imul (x).
18526: iadd (SQRT1PM1_C2).imul (x).
18527: iadd (SQRT1PM1_C1).imul (x);
18528: this.outer ().inc ();
18529: if (this.flg << 1 == 0) {
18530:
18531:
18532:
18533:
18534:
18535:
18536:
18537:
18538:
18539:
18540:
18541:
18542:
18543:
18544:
18545:
18546:
18547: this.epp += xe + 1 >> 1;
18548: this.finish ();
18549: }
18550: return this;
18551: }
18552:
18553:
18554:
18555:
18556:
18557:
18558:
18559:
18560:
18561:
18562:
18563: long s = Double.doubleToLongBits (Math.sqrt (Double.longBitsToDouble ((long) (1023 + (xe & 1)) << 52 | x.dvl << 1 >>> 12)));
18564: EFP t = new EFP (P, (int) (s >>> 52) - 1023 + (xe >> 1), MSB | s << 12 >>> 1, 0L);
18565: int savedFpsr = epbFpsr;
18566: this.inner ().div (x, t).iadd (t).outer ();
18567: this.epp--;
18568: epbFpsr = 0;
18569: this.finish ();
18570: savedFpsr |= epbFpsr & (EPB_FPSR_OF | EPB_FPSR_UF);
18571: this.inner ();
18572: t.squ (this);
18573: this.outer ();
18574: if ((epbFpsr & EPB_FPSR_X2) != 0 || !t.eq (x)) {
18575: savedFpsr |= EPB_FPSR_X2;
18576: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
18577: epbExceptionOperandMantissa = x.dvl;
18578: }
18579: epbFpsr = savedFpsr;
18580: return this;
18581: }
18582: }
18583:
18584:
18585:
18586:
18587:
18588:
18589:
18590:
18591:
18592:
18593:
18594:
18595:
18596:
18597:
18598:
18599:
18600:
18601:
18602:
18603:
18604:
18605:
18606:
18607:
18608:
18609:
18610:
18611:
18612:
18613:
18614:
18615:
18616:
18617:
18618:
18619:
18620:
18621:
18622:
18623:
18624:
18625:
18626:
18627:
18628:
18629:
18630:
18631:
18632:
18633:
18634:
18635:
18636: public final EFP squ () {
18637: int xf = this.flg;
18638: if (xf << 1 != 0) {
18639: this.flg = xf << 3 < 0 ? N : xf & ~M;
18640: return this;
18641: }
18642:
18643:
18644: long zd = this.dvl;
18645: long zc = this.cvl;
18646: long zb = (zd << -2 | zc >>> 2) >>> -30;
18647: zc = zd << 32 >>> -30;
18648: zd >>>= 32;
18649:
18650:
18651: long t = zb * zb;
18652: long s = t & 0xffffffffL;
18653: t = (t >>> 30) + (zc * zb << 1);
18654: s |= t & 0xffffffffL;
18655: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18656: s |= t & 0xffffffffL;
18657: t = (t >>> 30) + (zd * zc << 1);
18658: zd = (t >>> 30) + zd * zd;
18659: zc = t << -30 | s;
18660: int ze = this.epp << 1;
18661: if (zd < 0L) {
18662: ze++;
18663: } else {
18664: zd = zd << 1 | zc >>> -1;
18665: zc <<= 1;
18666: }
18667: return this.finish (P, ze, zd, zc, 0L);
18668: }
18669: public final EFP isqu () {
18670: int xf = this.flg;
18671: if (xf << 1 != 0) {
18672: this.flg = xf << 3 < 0 ? N : xf & ~M;
18673: return this;
18674: }
18675:
18676:
18677: long zd = this.dvl;
18678: long zc = this.cvl;
18679: long zb = (zd << -2 | zc >>> 2) >>> -30;
18680: zc = zd << 32 >>> -30;
18681: zd >>>= 32;
18682:
18683:
18684: long t = zb * zb;
18685: long s = t & 0xffffffffL;
18686: t = (t >>> 30) + (zc * zb << 1);
18687: s |= t & 0xffffffffL;
18688: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18689: s |= t & 0xffffffffL;
18690: t = (t >>> 30) + (zd * zc << 1);
18691: zd = (t >>> 30) + zd * zd;
18692: zc = t << -30 | s;
18693: int ze = this.epp << 1;
18694: if (zd < 0L) {
18695: ze++;
18696: } else {
18697: zd = zd << 1 | zc >>> -1;
18698: zc <<= 1;
18699: }
18700: return this.ifinish (P, ze, zd, zc, 0L);
18701: }
18702: public final EFP squ (EFP x) {
18703:
18704:
18705: int xf = x.flg;
18706: if (xf << 1 != 0) {
18707: this.flg = xf << 3 < 0 ? N : xf & ~M;
18708: return this;
18709: }
18710:
18711:
18712: long zd = x.dvl;
18713: long zc = x.cvl;
18714: long zb = (zd << -2 | zc >>> 2) >>> -30;
18715: zc = zd << 32 >>> -30;
18716: zd >>>= 32;
18717:
18718:
18719: long t = zb * zb;
18720: long s = t & 0xffffffffL;
18721: t = (t >>> 30) + (zc * zb << 1);
18722: s |= t & 0xffffffffL;
18723: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18724: s |= t & 0xffffffffL;
18725: t = (t >>> 30) + (zd * zc << 1);
18726: zd = (t >>> 30) + zd * zd;
18727: zc = t << -30 | s;
18728: int ze = x.epp << 1;
18729: if (zd < 0L) {
18730: ze++;
18731: } else {
18732: zd = zd << 1 | zc >>> -1;
18733: zc <<= 1;
18734: }
18735: return this.finish (P, ze, zd, zc, 0L);
18736: }
18737: public final EFP isqu (EFP x) {
18738:
18739:
18740: int xf = x.flg;
18741: if (xf << 1 != 0) {
18742: this.flg = xf << 3 < 0 ? N : xf & ~M;
18743: return this;
18744: }
18745:
18746:
18747: long zd = x.dvl;
18748: long zc = x.cvl;
18749: long zb = (zd << -2 | zc >>> 2) >>> -30;
18750: zc = zd << 32 >>> -30;
18751: zd >>>= 32;
18752:
18753:
18754: long t = zb * zb;
18755: long s = t & 0xffffffffL;
18756: t = (t >>> 30) + (zc * zb << 1);
18757: s |= t & 0xffffffffL;
18758: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18759: s |= t & 0xffffffffL;
18760: t = (t >>> 30) + (zd * zc << 1);
18761: zd = (t >>> 30) + zd * zd;
18762: zc = t << -30 | s;
18763: int ze = x.epp << 1;
18764: if (zd < 0L) {
18765: ze++;
18766: } else {
18767: zd = zd << 1 | zc >>> -1;
18768: zc <<= 1;
18769: }
18770: return this.ifinish (P, ze, zd, zc, 0L);
18771: }
18772:
18773:
18774:
18775:
18776:
18777:
18778:
18779:
18780:
18781:
18782:
18783:
18784: public final EFP sub (EFP y) {
18785: int xf = this.flg;
18786: int xe = this.epp;
18787: long xd = this.dvl;
18788: long xc = this.cvl;
18789: long xb = 0L;
18790: int yf = y.flg;
18791: if ((xf | yf) << 1 != 0) {
18792: if ((xf | yf) << 3 < 0) {
18793: this.flg = N;
18794: return this;
18795: }
18796: if ((xf & yf) << 2 < 0 && xf == yf) {
18797: epbFpsr |= EPB_FPSR_OE;
18798: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
18799: epbExceptionOperandMantissa = 0x0000000000000000L;
18800: this.flg = N;
18801: return this;
18802: }
18803: if ((xf & yf) << 1 < 0 && xf == yf) {
18804: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18805: return this;
18806: }
18807: if (xf << 1 < 0 || yf << 2 < 0) {
18808: xf = yf ^ M;
18809: xe = y.epp;
18810: xd = y.dvl;
18811: xc = y.cvl;
18812: }
18813:
18814: } else {
18815:
18816: yf ^= M;
18817: long yd = y.dvl;
18818: long yc = y.cvl;
18819: int o = xe - y.epp;
18820: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
18821:
18822: xf = yf;
18823: xe += o = -o;
18824: xd = yd;
18825: xc = yc;
18826: yf = this.flg;
18827: yd = this.dvl;
18828: yc = this.cvl;
18829: }
18830:
18831:
18832: if (0 < o) {
18833: if (o <= 63) {
18834: xb = yc << -o;
18835: yc = yd << -o | yc >>> o;
18836: yd >>>= o;
18837: } else if (o == 64) {
18838: xb = yc;
18839: yc = yd;
18840: yd = 0L;
18841: } else if (o <= 127) {
18842: xb = yd << -o | yc;
18843: yc = yd >>> o;
18844: yd = 0L;
18845: } else {
18846: xb = yd | yc;
18847: yc = 0L;
18848: yd = 0L;
18849: }
18850: }
18851:
18852: if (xf == yf) {
18853:
18854: xb |= yc << 62;
18855:
18856: xc = xd << 63 | xc >>> 1;
18857: xd >>>= 1;
18858: yc = yd << 63 | yc >>> 1;
18859: yd >>>= 1;
18860:
18861: yc >>>= 1;
18862: xc >>>= 1;
18863:
18864: xc += yc;
18865: xd += yd + (xc >>> 63);
18866:
18867: xc <<= 1;
18868:
18869: if (xd < 0L) {
18870: xe++;
18871: } else {
18872: xd = xd << 1 | xc >>> 63;
18873: xc <<= 1;
18874: }
18875: } else {
18876:
18877: xb |= yc << 63;
18878:
18879: yc >>>= 1;
18880: xc >>>= 1;
18881:
18882:
18883: if (xb != 0L) {
18884: xc--;
18885: }
18886: xc -= yc;
18887: xd -= yd + (xc >>> 63);
18888:
18889: xc <<= 1;
18890:
18891: if (0L <= xd) {
18892: if (xd != 0L) {
18893: xe -= o = Long.numberOfLeadingZeros (xd);
18894: xd = xd << o | xc >>> -o;
18895: xc <<= o;
18896: } else if (xc != 0L) {
18897: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
18898: xd = xc << o;
18899: xc = 0L;
18900: } else {
18901: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18902: }
18903: }
18904: }
18905: }
18906: return this.finish (xf, xe, xd, xc, xb);
18907: }
18908: public final EFP sub (EFP x, EFP y) {
18909: int xf = x.flg;
18910: int xe = x.epp;
18911: long xd = x.dvl;
18912: long xc = x.cvl;
18913: long xb = 0L;
18914: int yf = y.flg;
18915: if ((xf | yf) << 1 != 0) {
18916: if ((xf | yf) << 3 < 0) {
18917: this.flg = N;
18918: return this;
18919: }
18920: if ((xf & yf) << 2 < 0 && xf == yf) {
18921: epbFpsr |= EPB_FPSR_OE;
18922: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
18923: epbExceptionOperandMantissa = 0x0000000000000000L;
18924: this.flg = N;
18925: return this;
18926: }
18927: if ((xf & yf) << 1 < 0 && xf == yf) {
18928: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18929: return this;
18930: }
18931: if (xf << 1 < 0 || yf << 2 < 0) {
18932: xf = yf ^ M;
18933: xe = y.epp;
18934: xd = y.dvl;
18935: xc = y.cvl;
18936: }
18937:
18938: } else {
18939:
18940: yf ^= M;
18941: long yd = y.dvl;
18942: long yc = y.cvl;
18943: int o = xe - y.epp;
18944: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
18945:
18946: xf = yf;
18947: xe += o = -o;
18948: xd = yd;
18949: xc = yc;
18950: yf = x.flg;
18951: yd = x.dvl;
18952: yc = x.cvl;
18953: }
18954:
18955:
18956: if (0 < o) {
18957: if (o <= 63) {
18958: xb = yc << -o;
18959: yc = yd << -o | yc >>> o;
18960: yd >>>= o;
18961: } else if (o == 64) {
18962: xb = yc;
18963: yc = yd;
18964: yd = 0L;
18965: } else if (o <= 127) {
18966: xb = yd << -o | yc;
18967: yc = yd >>> o;
18968: yd = 0L;
18969: } else {
18970: xb = yd | yc;
18971: yc = 0L;
18972: yd = 0L;
18973: }
18974: }
18975:
18976: if (xf == yf) {
18977:
18978: xb |= yc << 62;
18979:
18980: xc = xd << 63 | xc >>> 1;
18981: xd >>>= 1;
18982: yc = yd << 63 | yc >>> 1;
18983: yd >>>= 1;
18984:
18985: yc >>>= 1;
18986: xc >>>= 1;
18987:
18988: xc += yc;
18989: xd += yd + (xc >>> 63);
18990:
18991: xc <<= 1;
18992:
18993: if (xd < 0L) {
18994: xe++;
18995: } else {
18996: xd = xd << 1 | xc >>> 63;
18997: xc <<= 1;
18998: }
18999: } else {
19000:
19001: xb |= yc << 63;
19002:
19003: yc >>>= 1;
19004: xc >>>= 1;
19005:
19006:
19007: if (xb != 0L) {
19008: xc--;
19009: }
19010: xc -= yc;
19011: xd -= yd + (xc >>> 63);
19012:
19013: xc <<= 1;
19014:
19015: if (0L <= xd) {
19016: if (xd != 0L) {
19017: xe -= o = Long.numberOfLeadingZeros (xd);
19018: xd = xd << o | xc >>> -o;
19019: xc <<= o;
19020: } else if (xc != 0L) {
19021: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
19022: xd = xc << o;
19023: xc = 0L;
19024: } else {
19025: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
19026: }
19027: }
19028: }
19029: }
19030: return this.finish (xf, xe, xd, xc, xb);
19031: }
19032:
19033:
19034:
19035:
19036:
19037:
19038:
19039:
19040:
19041:
19042:
19043:
19044:
19045:
19046:
19047:
19048:
19049:
19050:
19051:
19052:
19053:
19054:
19055:
19056:
19057:
19058:
19059:
19060:
19061:
19062:
19063:
19064:
19065:
19066:
19067:
19068:
19069:
19070:
19071:
19072:
19073:
19074:
19075:
19076:
19077:
19078:
19079:
19080:
19081:
19082:
19083:
19084:
19085:
19086:
19087:
19088:
19089:
19090:
19091:
19092:
19093:
19094:
19095:
19096:
19097:
19098:
19099:
19100:
19101:
19102:
19103:
19104:
19105:
19106:
19107:
19108:
19109:
19110:
19111:
19112:
19113:
19114:
19115:
19116:
19117:
19118:
19119:
19120:
19121:
19122:
19123:
19124:
19125:
19126:
19127:
19128:
19129:
19130:
19131:
19132:
19133:
19134:
19135:
19136:
19137:
19138:
19139:
19140:
19141:
19142:
19143:
19144:
19145:
19146:
19147:
19148:
19149:
19150:
19151:
19152:
19153:
19154:
19155:
19156:
19157:
19158:
19159:
19160:
19161:
19162:
19163:
19164:
19165:
19166:
19167:
19168:
19169:
19170:
19171: public final EFP tan () {
19172: return this.tan (this);
19173: }
19174: public final EFP tan (EFP x) {
19175: int xf = x.flg;
19176: if (xf << 1 != 0) {
19177: if (xf << 1 < 0) {
19178: this.flg = xf;
19179: } else if (xf << 2 < 0) {
19180: epbFpsr |= EPB_FPSR_OE;
19181: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
19182: epbExceptionOperandMantissa = 0x0000000000000000L;
19183: this.flg = N;
19184: } else {
19185: this.flg = N;
19186: }
19187: return this;
19188: }
19189:
19190: if (false) {
19191: EFP c = new EFP ().inner ().cos (x);
19192: return this.sin (x).outer ().div (c);
19193: } else if (false) {
19194: this.inner ();
19195: EFP s = new EFP ();
19196: EFP t = new EFP ();
19197: EFP u = new EFP ().iabs (x);
19198: EFP u2 = new EFP ();
19199: int k = 0;
19200:
19201: if (u.epp >= -1 || (u.epp == -2 && u.dvl >= 0xc90fdaa22168c234L)) {
19202:
19203: s.iadd (u, PI_8).imul (FOUR_PI).trunc ();
19204:
19205: u.sub (t.imulw (u2, s, PI_4)).sub (u2).sub (t.imul (s, PI_4A));
19206: k = s.geti () & 3;
19207: }
19208: u2.isqu (u);
19209: this.imul (TAN_C33, u2)
19210: .iadd (TAN_C31).imul (u2)
19211: .iadd (TAN_C29).imul (u2)
19212: .iadd (TAN_C27).imul (u2)
19213: .iadd (TAN_C25).imul (u2)
19214: .iadd (TAN_C23).imul (u2)
19215: .iadd (TAN_C21).imul (u2)
19216: .iadd (TAN_C19).imul (u2)
19217: .iadd (TAN_C17).imul (u2)
19218: .iadd (TAN_C15).imul (u2)
19219: .iadd (TAN_C13).imul (u2)
19220: .iadd (TAN_C11).imul (u2)
19221: .iadd (TAN_C9).imul (u2)
19222: .iadd (TAN_C7).imul (u2)
19223: .iadd (TAN_C5).imul (u2)
19224: .iadd (TAN_C3).imul (u2)
19225: .iadd (TAN_C1).imul (u);
19226: if (k == 1) {
19227: t.negdec (this);
19228: this.inc ().div (t);
19229: } else if (k == 2) {
19230: this.rcp ().ineg ();
19231: } else if (k == 3) {
19232: t.inc (this);
19233: this.dec ().div (t);
19234: }
19235: return this.outer ().neg (xf < 0);
19236: } else {
19237: if (x.epp >= 16) {
19238: EFP c = new EFP ().inner ().cos (x);
19239: return this.sin (x).outer ().div (c);
19240: }
19241: int savedFpsr = epbFpsr;
19242: this.inner ();
19243: if (this == x) {
19244: x = new EFP (x);
19245: }
19246: if (x.epp < -3) {
19247: EFP x2 = new EFP ().isqu (x);
19248: this.imul (TAN8_C21, x2)
19249: .iadd (TAN8_C19).imul (x2)
19250: .iadd (TAN8_C17).imul (x2)
19251: .iadd (TAN8_C15).imul (x2)
19252: .iadd (TAN8_C13).imul (x2)
19253: .iadd (TAN8_C11).imul (x2)
19254: .iadd (TAN8_C9).imul (x2)
19255: .iadd (TAN8_C7).imul (x2)
19256: .iadd (TAN8_C5).imul (x2)
19257: .iadd (TAN8_C3).imul (x2)
19258: .iadd (TAN8_C1).outer ().mul (x);
19259: return this.originLowerUpper (x).correctUnderflow (savedFpsr);
19260: }
19261: EFP s = new EFP ();
19262: EFP t = new EFP ();
19263: EFP u = new EFP ().iabs (x);
19264: EFP u2 = new EFP ();
19265: s.iadd (u, TAN7_X).imul (TAN7_Y).trunc ();
19266:
19267: u.sub (t.imulw (u2, s, TAN7_Z)).sub (u2).sub (t.imul (s, TAN7_ZA));
19268: int k = s.geti () & 127;
19269: u2.isqu (u);
19270: this.imul (TAN7_C11, u2)
19271: .iadd (TAN7_C9).imul (u2)
19272: .iadd (TAN7_C7).imul (u2)
19273: .iadd (TAN7_C5).imul (u2)
19274: .iadd (TAN7_C3).imul (u2)
19275: .iadd (TAN7_C1).imul (u);
19276: if (k != 0) {
19277: if (k <= 63) {
19278: t = TAN7_T[k];
19279: s.imul (this, t).negdec ();
19280: this.iadd (t).div (s);
19281: } else if (k == 64) {
19282: this.rcp ().ineg ();
19283: } else {
19284: t = TAN7_T[128 - k];
19285: s.imul (this, t).inc ();
19286: this.sub (t).div (s);
19287: }
19288: }
19289: return this.outer ().neg (xf < 0);
19290: }
19291: }
19292:
19293:
19294:
19295:
19296:
19297:
19298:
19299:
19300:
19301:
19302:
19303:
19304:
19305:
19306:
19307:
19308:
19309:
19310:
19311:
19312:
19313:
19314:
19315:
19316:
19317:
19318:
19319:
19320:
19321:
19322:
19323:
19324:
19325:
19326:
19327:
19328:
19329:
19330:
19331:
19332:
19333:
19334:
19335:
19336:
19337:
19338:
19339:
19340:
19341:
19342:
19343:
19344:
19345:
19346:
19347:
19348:
19349:
19350:
19351:
19352:
19353:
19354:
19355:
19356:
19357:
19358:
19359:
19360:
19361:
19362:
19363:
19364:
19365:
19366:
19367:
19368:
19369:
19370:
19371:
19372:
19373:
19374:
19375:
19376:
19377:
19378:
19379:
19380:
19381:
19382:
19383:
19384:
19385:
19386:
19387:
19388:
19389:
19390:
19391:
19392:
19393:
19394:
19395:
19396:
19397:
19398:
19399:
19400:
19401:
19402:
19403:
19404:
19405:
19406:
19407:
19408:
19409:
19410:
19411:
19412:
19413:
19414:
19415:
19416:
19417:
19418:
19419:
19420:
19421:
19422:
19423:
19424:
19425:
19426:
19427:
19428:
19429:
19430:
19431:
19432:
19433:
19434:
19435:
19436: public final EFP tanh () {
19437: return this.tanh (this);
19438: }
19439: public final EFP tanh (EFP x) {
19440: int xf = x.flg;
19441: if (xf << 1 != 0) {
19442: if (xf << 2 < 0) {
19443: this.flg = xf & M;
19444: this.epp = 0;
19445: this.dvl = MSB;
19446: this.cvl = 0L;
19447: } else {
19448: this.flg = xf;
19449: }
19450: return this;
19451: }
19452:
19453:
19454: int xe = x.epp;
19455: if (xe < -2) {
19456: int savedFpsr = epbFpsr;
19457: this.inner ();
19458: if (this == x) {
19459: x = new EFP (x);
19460: }
19461: EFP x2 = new EFP ().isqu (x);
19462: this.imul (TANH_C27, x2)
19463: .iadd (TANH_C25).imul (x2)
19464: .iadd (TANH_C23).imul (x2)
19465: .iadd (TANH_C21).imul (x2)
19466: .iadd (TANH_C19).imul (x2)
19467: .iadd (TANH_C17).imul (x2)
19468: .iadd (TANH_C15).imul (x2)
19469: .iadd (TANH_C13).imul (x2)
19470: .iadd (TANH_C11).imul (x2)
19471: .iadd (TANH_C9).imul (x2)
19472: .iadd (TANH_C7).imul (x2)
19473: .iadd (TANH_C5).imul (x2)
19474: .iadd (TANH_C3).imul (x2)
19475: .iadd (TANH_C1).outer ().mul (x);
19476: return this.originUpperLower (x).correctUnderflow (savedFpsr);
19477: }
19478:
19479: if (false) {
19480: EFP c = new EFP ().inner ().cosh (x);
19481: return this.sinh (x).outer ().div (c);
19482: } else if (6 <= xe) {
19483:
19484:
19485:
19486:
19487:
19488:
19489:
19490:
19491: epbFpsr |= EPB_FPSR_X2;
19492: this.flg = xf & M;
19493: this.epp = 0;
19494: this.dvl = MSB;
19495: this.cvl = 0L;
19496: if (xf < 0) {
19497: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
19498: this.nextup (epbRoundingPrec);
19499: }
19500: } else {
19501: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
19502: this.nextdown (epbRoundingPrec);
19503: }
19504: }
19505: return this;
19506: } else {
19507: EFP t = new EFP ().inner ().imul2 (x).exp ();
19508: this.dec (t);
19509: t.inc ();
19510: return this.outer ().div (t);
19511: }
19512: }
19513:
19514:
19515:
19516:
19517:
19518:
19519:
19520:
19521:
19522:
19523:
19524:
19525:
19526:
19527:
19528:
19529:
19530:
19531:
19532:
19533:
19534:
19535:
19536:
19537:
19538:
19539:
19540:
19541:
19542:
19543:
19544:
19545:
19546:
19547:
19548:
19549:
19550:
19551:
19552:
19553:
19554:
19555:
19556:
19557:
19558:
19559:
19560:
19561:
19562:
19563:
19564:
19565:
19566:
19567:
19568:
19569:
19570:
19571:
19572:
19573:
19574:
19575:
19576:
19577:
19578:
19579:
19580:
19581:
19582:
19583:
19584:
19585: public final EFP tgamma () {
19586: return this.tgamma (this);
19587: }
19588: public final EFP tgamma (EFP x) {
19589: int xf = x.flg;
19590: if (xf << 1 != 0) {
19591: this.flg = (xf == (P | Z) || xf == (P | I) ? P | I :
19592: xf == (M | Z) ? M | I :
19593: N);
19594: return this;
19595: }
19596:
19597: this.inner ();
19598: if (xf < 0) {
19599: EFP t = new EFP ().mul (PI, x).sin ();
19600: this.negdec (x).lgamma ().exp ().mul (t).rcpdiv (PI);
19601: } else {
19602: this.lgamma (x).exp ();
19603: }
19604: return this.outer ().finish ();
19605: }
19606:
19607:
19608:
19609:
19610:
19611:
19612:
19613:
19614:
19615:
19616:
19617:
19618:
19619:
19620:
19621: @Override public String toString () {
19622: int xf = this.flg;
19623: if (xf << 1 != 0) {
19624: return (xf == (P | Z) ? "0" :
19625: xf == (M | Z) ? "-0" :
19626: xf == (P | I) ? "Infinity" :
19627: xf == (M | I) ? "-Infinity" :
19628: xf << 3 < 0 ? "NaN" : "???");
19629: }
19630:
19631: this.inner ();
19632: EFP x = new EFP ().iabs (this);
19633:
19634:
19635: int e = (int) Math.floor ((double) x.epp * 0.30102999566398119521373889472);
19636:
19637:
19638:
19639: if (0 < e) {
19640: x.imul (EFP_TEN_M16QR[e & 15]);
19641: if (16 <= e) {
19642: x.imul (EFP_TEN_M16QR[16 + (e >> 4 & 15)]);
19643: if (256 <= e) {
19644: x.imul (EFP_TEN_M16QR[32 + (e >> 8 & 15)]);
19645: if (4096 <= e) {
19646: x.imul (EFP_TEN_M16QR[48 + (e >> 12)]);
19647: }
19648: }
19649: }
19650: } else if (e < 0) {
19651: x.imul (EFP_TEN_P16QR[-e & 15]);
19652: if (e <= -16) {
19653: x.imul (EFP_TEN_P16QR[16 + (-e >> 4 & 15)]);
19654: if (e <= -256) {
19655: x.imul (EFP_TEN_P16QR[32 + (-e >> 8 & 15)]);
19656: if (e <= -4096) {
19657: x.imul (EFP_TEN_P16QR[48 + (-e >> 12)]);
19658: }
19659: }
19660: }
19661: }
19662: this.outer ();
19663:
19664:
19665:
19666:
19667: int[] w = new int[2 + (EFP_DECIMAL_PREC + 4 & -4)];
19668: {
19669: int t = 31 - x.epp;
19670: long x1 = x.dvl >>> t;
19671: long x2 = x.dvl << -t | x.cvl >>> t;
19672: long x3 = x2 & 0xffffffffL;
19673: x2 >>>= 32;
19674: t = XEiJ.FMT_BCD4[(int) (x1 >>> 32)];
19675: w[0] = t >> 4;
19676: w[1] = t & 15;
19677: for (int i = 2; i < 2 + (EFP_DECIMAL_PREC + 4 & -4); i += 4) {
19678: x3 *= 10000L;
19679: x2 = x2 * 10000L + (x3 >>> 32);
19680: x3 &= 0xffffffffL;
19681: x1 = (x1 & 0xffffffffL) * 10000L + (x2 >>> 32);
19682: x2 &= 0xffffffffL;
19683: t = XEiJ.FMT_BCD4[(int) (x1 >>> 32)];
19684: w[i ] = t >> 12;
19685: w[i + 1] = t >> 8 & 15;
19686: w[i + 2] = t >> 4 & 15;
19687: w[i + 3] = t & 15;
19688: }
19689: }
19690:
19691:
19692: int h = w[0] != 0 ? 0 : w[1] != 0 ? 1 : 2;
19693:
19694: int o = h + EFP_DECIMAL_PREC;
19695: if (5 <= w[o]) {
19696: int i = o;
19697: while (10 <= ++w[--i]) {
19698: w[i] = 0;
19699: }
19700: if (i < h) {
19701: h--;
19702: o--;
19703: }
19704: }
19705:
19706:
19707: e -= h - 1;
19708:
19709:
19710: while (w[o - 1] == 0) {
19711: o--;
19712: }
19713:
19714: StringBuilder sb = new StringBuilder ();
19715:
19716: if (xf < 0) {
19717: sb.append ('-');
19718: }
19719:
19720: if (0 <= e && e < EFP_DECIMAL_PREC) {
19721: do {
19722: sb.append ((char) ('0' + w[h++]));
19723: } while (0 <= --e);
19724: if (h < o) {
19725: sb.append ('.');
19726: do {
19727: sb.append ((char) ('0' + w[h++]));
19728: } while (h < o);
19729: }
19730: } else if (-4 <= e && e < 0) {
19731: sb.append ('0');
19732: sb.append ('.');
19733: while (++e < 0) {
19734: sb.append ('0');
19735: }
19736: do {
19737: sb.append ((char) ('0' + w[h++]));
19738: } while (h < o);
19739: } else {
19740: sb.append ((char) ('0' + w[h++]));
19741: if (h < o) {
19742: sb.append ('.');
19743: do {
19744: sb.append ((char) ('0' + w[h++]));
19745: } while (h < o);
19746: }
19747: sb.append ('e');
19748: if (false) {
19749: sb.append (e);
19750: } else {
19751: if (e < 0) {
19752: sb.append ('-');
19753: e = -e;
19754: } else {
19755: sb.append ('+');
19756: }
19757: e = XEiJ.fmtBcd8 (e);
19758: int t = Integer.numberOfLeadingZeros (e);
19759: if (t <= 27) {
19760: if (t <= 23) {
19761: if (t <= 19) {
19762: if (t <= 15) {
19763: sb.append ((char) ('0' + (e >>> 16 & 15)));
19764: }
19765: sb.append ((char) ('0' + (e >>> 12 & 15)));
19766: }
19767: sb.append ((char) ('0' + (e >>> 8 & 15)));
19768: }
19769: sb.append ((char) ('0' + (e >>> 4 & 15)));
19770: }
19771: sb.append ((char) ('0' + (e & 15)));
19772: }
19773: }
19774: return sb.toString ();
19775: }
19776:
19777:
19778:
19779:
19780:
19781:
19782:
19783:
19784:
19785:
19786:
19787:
19788:
19789:
19790:
19791:
19792:
19793:
19794:
19795:
19796:
19797:
19798:
19799:
19800:
19801:
19802:
19803:
19804:
19805:
19806:
19807:
19808:
19809:
19810:
19811:
19812:
19813:
19814:
19815:
19816:
19817:
19818:
19819:
19820:
19821:
19822:
19823:
19824:
19825:
19826:
19827:
19828:
19829:
19830:
19831:
19832:
19833:
19834: public final EFP trunc () {
19835: return trunc (this);
19836: }
19837: public final EFP trunc (EFP x) {
19838: int xf = x.flg;
19839: if (xf << 1 != 0) {
19840: this.flg = xf;
19841: return this;
19842: }
19843:
19844: int xe = x.epp;
19845: if (xe < 0) {
19846: epbFpsr |= EPB_FPSR_X2;
19847: this.flg = xf | Z;
19848: return this;
19849: }
19850: long xd = x.dvl;
19851: long xc = x.cvl;
19852: if (xe <= 63) {
19853: long m = MSB >> xe;
19854: if ((xd & ~m | xc) != 0L) {
19855: epbFpsr |= EPB_FPSR_X2;
19856: xd &= m;
19857: xc = 0L;
19858: }
19859: } else if (xe <= LEN - 2) {
19860: long m = MSB >> xe;
19861: if ((xc & ~m) != 0L) {
19862: epbFpsr |= EPB_FPSR_X2;
19863: xc &= m;
19864: }
19865: }
19866:
19867: return this.finish (xf, xe, xd, xc, 0L);
19868: }
19869:
19870:
19871:
19872:
19873:
19874:
19875:
19876:
19877:
19878:
19879:
19880:
19881: public final EFP ulp () {
19882: return this.ulp (this);
19883: };
19884: public final EFP ulp (EFP x) {
19885: int xf = x.flg;
19886: if (xf << 1 != 0) {
19887: if (xf << 1 < 0) {
19888: this.flg = P;
19889: this.epp = -32768;
19890: this.dvl = MSB;
19891: this.cvl = 0L;
19892: } else {
19893: this.flg = xf & ~M;
19894: }
19895: return this;
19896: }
19897:
19898: this.flg = P;
19899: this.epp = x.epp - (LEN - 1);
19900: this.dvl = MSB;
19901: this.cvl = 0L;
19902: return this;
19903: };
19904:
19905: }
19906:
19907:
19908:
19909:
19910:
19911:
19912:
19913:
19914:
19915:
19916:
19917:
19918:
19919:
19920:
19921:
19922:
19923:
19924:
19925:
19926:
19927:
19928:
19929:
19930:
19931:
19932:
19933:
19934:
19935:
19936:
19937:
19938:
19939:
19940:
19941:
19942:
19943:
19944:
19945:
19946:
19947:
19948:
19949:
19950:
19951:
19952:
19953:
19954:
19955:
19956:
19957:
19958:
19959:
19960:
19961:
19962:
19963:
19964:
19965:
19966:
19967:
19968:
19969:
19970:
19971:
19972:
19973:
19974:
19975:
19976:
19977:
19978:
19979:
19980:
19981:
19982:
19983:
19984:
19985:
19986:
19987:
19988:
19989:
19990:
19991:
19992:
19993: public static final boolean CIR_DEBUG_TRACE = false;
19994:
19995:
19996:
19997:
19998:
19999:
20000:
20001:
20002:
20003:
20004:
20005:
20006:
20007:
20008:
20009: public int cirResponse;
20010: public int cirFormatWord;
20011: public int cirOperationWord;
20012: public int cirCommand;
20013: public int cirRegisterList;
20014: public int cirOperandAddress;
20015:
20016:
20017: public final int[] cirOperandBuffer = new int[212];
20018: public int cirOperandLength;
20019: public int cirOperandIndex;
20020:
20021:
20022:
20023:
20024:
20025:
20026: public static final int CIR_INPUT_MASK = 16;
20027: public static final int CIR_OUTPUT_MASK = 32;
20028: public static final int CIR_IDLE = 0;
20029: public static final int CIR_PROGRAM_COUNTER = 1;
20030: public static final int CIR_DYNAMIC_K_FACTOR = CIR_INPUT_MASK | 2;
20031: public static final int CIR_DYNAMIC_REGISTER_LIST = CIR_INPUT_MASK | 3;
20032: public static final int CIR_REGISTER_SELECT = 4;
20033: public static final int CIR_SOURCE_OPERAND = CIR_INPUT_MASK | 5;
20034: public static final int CIR_DESTINATION_OPERAND = CIR_OUTPUT_MASK | 6;
20035: public static final int CIR_FSAVE_STATE_FRAME = CIR_OUTPUT_MASK | 7;
20036: public static final int CIR_FRESTORE_STATE_FRAME = CIR_INPUT_MASK | 8;
20037: public static final int CIR_EXCEPTION_PROCESSING = 9;
20038: public static final String[] cirNameOfStage = {
20039: "idle",
20040: "input program counter into the instruction address CIR",
20041: "input dynamic k-factor into the operand CIR",
20042: "input dynamic register list into the operand CIR",
20043: "output register select from the register select CIR",
20044: "input source operand into the operand CIR",
20045: "output destination operand from the operand CIR",
20046: "output FSAVE state frame from the operand CIR",
20047: "input FRESTORE state from into the operand CIR",
20048: "exception processing",
20049: };
20050: public int cirStage;
20051:
20052:
20053:
20054: public final void cirInit () {
20055:
20056: Arrays.fill (cirOperandBuffer, 0);
20057: cirReset ();
20058: }
20059:
20060:
20061:
20062: public final void cirReset () {
20063: cirIdle (0x0802);
20064: }
20065:
20066:
20067:
20068: public final void cirIdle (int response) {
20069: if (CIR_DEBUG_TRACE) {
20070: System.out.printf ("%08x cirIdle(0x%08x)\n", XEiJ.regPC0, response);
20071: }
20072: cirResponse = response;
20073: cirOperationWord = 0;
20074: cirCommand = 0;
20075: cirRegisterList = 0;
20076: cirOperandAddress = 0;
20077: Arrays.fill (cirOperandBuffer, 0);
20078: cirOperandLength = 0;
20079: cirOperandIndex = 0;
20080: cirStage = CIR_IDLE;
20081: }
20082:
20083:
20084:
20085:
20086:
20087:
20088:
20089:
20090:
20091:
20092:
20093:
20094:
20095:
20096:
20097:
20098:
20099:
20100:
20101:
20102:
20103:
20104:
20105:
20106:
20107:
20108:
20109:
20110:
20111:
20112:
20113:
20114:
20115:
20116:
20117:
20118:
20119:
20120:
20121:
20122:
20123:
20124:
20125:
20126:
20127:
20128:
20129:
20130:
20131:
20132:
20133:
20134:
20135:
20136:
20137:
20138:
20139:
20140:
20141:
20142:
20143:
20144:
20145:
20146:
20147:
20148:
20149:
20150:
20151:
20152:
20153:
20154:
20155:
20156:
20157:
20158:
20159:
20160:
20161:
20162:
20163:
20164:
20165:
20166:
20167:
20168:
20169:
20170:
20171:
20172:
20173:
20174:
20175:
20176:
20177:
20178:
20179:
20180:
20181:
20182:
20183:
20184:
20185:
20186:
20187:
20188:
20189:
20190:
20191:
20192:
20193:
20194:
20195:
20196:
20197:
20198:
20199:
20200:
20201:
20202:
20203:
20204:
20205:
20206:
20207:
20208:
20209:
20210:
20211:
20212:
20213:
20214:
20215:
20216:
20217:
20218:
20219:
20220:
20221:
20222:
20223:
20224:
20225:
20226:
20227:
20228:
20229:
20230:
20231:
20232:
20233:
20234:
20235:
20236:
20237:
20238:
20239:
20240:
20241:
20242:
20243:
20244:
20245:
20246:
20247:
20248:
20249:
20250:
20251:
20252:
20253:
20254:
20255:
20256:
20257:
20258:
20259:
20260:
20261:
20262:
20263:
20264:
20265:
20266:
20267:
20268:
20269:
20270:
20271:
20272:
20273:
20274:
20275: public void cirException (int response) {
20276: if (CIR_DEBUG_TRACE) {
20277: System.out.printf ("%08x cirException(0x%08x)\n", XEiJ.regPC0, response);
20278: }
20279: cirResponse = response;
20280: cirOperationWord = 0;
20281: cirCommand = 0;
20282: cirRegisterList = 0;
20283: cirOperandAddress = 0;
20284: Arrays.fill (cirOperandBuffer, 0);
20285: cirOperandLength = 0;
20286: cirOperandIndex = 0;
20287: cirStage = CIR_EXCEPTION_PROCESSING;
20288: }
20289:
20290:
20291:
20292: public int cirPeekByteZero (int a) {
20293: return (a & 1) == 0 ? cirPeekWordZero (a) >>> 8 : cirPeekWordZero (a - 1) & 255;
20294: }
20295:
20296:
20297:
20298: public int cirPeekWordZero (int a) {
20299: a &= 0x1e;
20300: int d = 65535;
20301: switch (a) {
20302: case 0x00:
20303: d = (char) cirResponse;
20304: break;
20305:
20306: case 0x04:
20307: if ((cirStage == CIR_EXCEPTION_PROCESSING && cirResponse == 0x1d0d) ||
20308: cirStage == CIR_FSAVE_STATE_FRAME ||
20309: cirStage == CIR_FRESTORE_STATE_FRAME) {
20310: d = 0x0200;
20311:
20312: } else {
20313: if ((cirStage & (CIR_INPUT_MASK | CIR_OUTPUT_MASK)) == 0) {
20314: d = 0x1f38;
20315: } else {
20316: d = 0x1fd4;
20317: }
20318: }
20319: break;
20320: case 0x06:
20321: d = (char) cirFormatWord;
20322: break;
20323: case 0x08:
20324: d = (char) cirOperationWord;
20325: break;
20326:
20327:
20328:
20329:
20330: case 0x10 + 0:
20331:
20332: d = cirPeekLong (a) >>> 16;
20333: break;
20334: case 0x10 + 2:
20335: d = (char) cirPeekLong (a + 2);
20336: break;
20337: case 0x14:
20338: if (cirStage == CIR_REGISTER_SELECT) {
20339:
20340:
20341:
20342:
20343: d = cirRegisterList << 8;
20344: } else {
20345:
20346: }
20347: break;
20348:
20349:
20350:
20351:
20352: case 0x1c + 0:
20353: d = cirPeekLong (a) >>> 16;
20354: break;
20355: case 0x1c + 2:
20356: d = (char) cirPeekLong (a - 2);
20357: break;
20358: }
20359: return d;
20360: }
20361:
20362:
20363:
20364: public int cirPeekLong (int a) {
20365: a &= 0x1e;
20366: int d = -1;
20367: switch (a) {
20368:
20369:
20370:
20371:
20372:
20373:
20374:
20375:
20376:
20377: case 0x10:
20378: if (cirStage == CIR_DESTINATION_OPERAND && cirOperandIndex < cirOperandLength) {
20379: d = cirOperandBuffer[cirOperandIndex];
20380: } else if (cirStage == CIR_FSAVE_STATE_FRAME && cirOperandIndex < cirOperandLength) {
20381: d = cirOperandBuffer[cirOperandLength - cirOperandIndex - 1];
20382: } else {
20383:
20384:
20385: }
20386: break;
20387:
20388:
20389:
20390:
20391: case 0x1c:
20392: d = cirOperandAddress;
20393: break;
20394: }
20395: return d;
20396: }
20397:
20398:
20399:
20400: public int cirReadByteZero (int a) {
20401:
20402: return (a & 1) == 0 ? cirReadWordZero (a) >>> 8 : cirReadWordZero (a - 1) & 255;
20403: }
20404:
20405:
20406:
20407: public int cirReadWordZero (int a) {
20408: a &= 0x1e;
20409: int d = 65535;
20410: switch (a) {
20411: case 0x00:
20412: d = (char) cirResponse;
20413: if (d != cirResponse) {
20414: cirResponse >>>= 16;
20415: if (d == 0x0802) {
20416: cirIdle (0x0802);
20417: }
20418: }
20419: break;
20420:
20421: case 0x04:
20422: if ((cirStage == CIR_EXCEPTION_PROCESSING && cirResponse == 0x1d0d) ||
20423: cirStage == CIR_FSAVE_STATE_FRAME ||
20424: cirStage == CIR_FRESTORE_STATE_FRAME) {
20425: d = 0x0200;
20426: cirException (0x1d0d);
20427: } else {
20428: int i;
20429: if ((cirStage & (CIR_INPUT_MASK | CIR_OUTPUT_MASK)) == 0) {
20430: d = 0x1f38;
20431: i = 0;
20432: } else {
20433: d = 0x1fd4;
20434: i = 3 * 8;
20435: }
20436:
20437: cirOperandBuffer[i++] = epbFpcr;
20438: cirOperandBuffer[i++] = epbFpsr;
20439: cirOperandBuffer[i++] = epbFpiar;
20440: cirOperandBuffer[i++] = epbQuotient;
20441: cirOperandBuffer[i++] = epbRoundingPrec;
20442: cirOperandBuffer[i++] = epbRoundingMode;
20443: cirOperandBuffer[i++] = cirResponse;
20444: cirOperandBuffer[i++] = cirFormatWord;
20445: cirOperandBuffer[i++] = cirOperationWord;
20446: cirOperandBuffer[i++] = cirCommand;
20447: cirOperandBuffer[i++] = cirRegisterList;
20448: cirOperandBuffer[i++] = cirOperandAddress;
20449: cirOperandBuffer[i++] = cirOperandLength;
20450: cirOperandBuffer[i++] = cirOperandIndex;
20451: cirOperandBuffer[i++] = cirStage;
20452: cirFormatWord = d;
20453: cirOperandLength = (d & 255) >>> 2;
20454: cirOperandIndex = 0;
20455: cirStage = CIR_FSAVE_STATE_FRAME;
20456: cirResponse = 0x0900;
20457: }
20458: break;
20459: case 0x06:
20460: d = (char) cirFormatWord;
20461: break;
20462: case 0x08:
20463: d = (char) cirOperationWord;
20464: break;
20465:
20466:
20467:
20468:
20469: case 0x10 + 0:
20470:
20471: d = cirReadLong (a) >>> 16;
20472: break;
20473: case 0x10 + 2:
20474: d = (char) cirReadLong (a + 2);
20475: break;
20476: case 0x14:
20477: if (cirStage == CIR_REGISTER_SELECT) {
20478:
20479:
20480:
20481:
20482: d = cirRegisterList << 8;
20483: cirGen ();
20484: } else {
20485: cirException (0x1d0d);
20486: }
20487: break;
20488:
20489:
20490:
20491:
20492: case 0x1c + 0:
20493: d = cirReadLong (a) >>> 16;
20494: break;
20495: case 0x1c + 2:
20496: d = (char) cirReadLong (a - 2);
20497: break;
20498: }
20499: if (CIR_DEBUG_TRACE) {
20500: System.out.printf ("%08x cirReadWordZero(0x%08x,0x%04x)\n", XEiJ.regPC0, a, d);
20501: }
20502: return d;
20503: }
20504:
20505:
20506:
20507: public int cirReadLong (int a) {
20508: a &= 0x1e;
20509: int d = -1;
20510: switch (a) {
20511:
20512:
20513:
20514:
20515:
20516:
20517:
20518:
20519:
20520: case 0x10:
20521: if (cirStage == CIR_DESTINATION_OPERAND && cirOperandIndex < cirOperandLength) {
20522: d = cirOperandBuffer[cirOperandIndex];
20523: cirOperandIndex++;
20524: if (cirOperandIndex == cirOperandLength) {
20525: cirGen ();
20526: }
20527: } else if (cirStage == CIR_FSAVE_STATE_FRAME && cirOperandIndex < cirOperandLength) {
20528: d = cirOperandBuffer[cirOperandLength - cirOperandIndex - 1];
20529: cirOperandIndex++;
20530: if (cirOperandIndex == cirOperandLength) {
20531: cirIdle (0x0802);
20532: }
20533: } else {
20534:
20535: cirException (0x1d0d);
20536: }
20537: break;
20538:
20539:
20540:
20541:
20542:
20543: case 0x1c:
20544: d = cirOperandAddress;
20545: break;
20546: }
20547: if (CIR_DEBUG_TRACE) {
20548: System.out.printf ("%08x cirReadLong(0x%08x,0x%08x)\n", XEiJ.regPC0, a, d);
20549: }
20550: return d;
20551: }
20552:
20553:
20554:
20555: public void cirWriteByte (int a, int d) {
20556: }
20557:
20558:
20559:
20560: public void cirWriteWord (int a, int d) {
20561: if (CIR_DEBUG_TRACE) {
20562: System.out.printf ("%08x cirWriteWordZero(0x%08x,0x%04x)\n", XEiJ.regPC0, a, d);
20563: }
20564: d &= 65535;
20565: switch (a & 0x1e) {
20566:
20567: case 0x02:
20568:
20569:
20570:
20571: if (cirStage == CIR_EXCEPTION_PROCESSING) {
20572: cirIdle (0x0802);
20573: return;
20574: } else if ((d & 1) != 0) {
20575: cirIdle (0x0802);
20576: return;
20577: }
20578: break;
20579:
20580: case 0x06:
20581: if (d >>> 8 == 0) {
20582: cirFormatWord = d;
20583:
20584: for (int n = 0; n < 8; n++) {
20585: epbFPn[n].setnan ();
20586: }
20587:
20588: epbFpcr = 0;
20589: epbFpsr = 0;
20590: cirIdle (0x0802);
20591: } else if (d == 0x1f38 || d == 0x1fd4) {
20592: cirFormatWord = d;
20593: cirOperandLength = (d & 255) >>> 2;
20594: cirOperandIndex = 0;
20595: cirStage = CIR_FRESTORE_STATE_FRAME;
20596: cirResponse = 0x0900;
20597: } else {
20598: cirFormatWord = 0x0200;
20599: }
20600: return;
20601: case 0x08:
20602:
20603:
20604: cirOperationWord = d;
20605: return;
20606: case 0x0a:
20607: if (cirStage == CIR_IDLE) {
20608: cirCommand = d;
20609: cirGen ();
20610: return;
20611: }
20612: break;
20613: case 0x0c:
20614:
20615: return;
20616: case 0x0e:
20617:
20618: if (cirStage == CIR_IDLE) {
20619: d &= 0x3f;
20620: if ((d & 0x20) != 0 && (epbFpsr & XEiJ.FPU_FPSR_NAN) != 0) {
20621: epbFpsr |= XEiJ.FPU_FPSR_EXC_BSUN;
20622: epbFpsr |= XEiJ.FPU_FPSR_EXC_TO_AEXC[epbFpsr >> 8 & 255];
20623: if ((epbFpcr & XEiJ.FPU_FPCR_BSUN) != 0) {
20624: cirException (0x5c30);
20625: return;
20626: }
20627: }
20628: cirResponse = XEiJ.FPU_CCMAP_882[d << 4 | epbFpsr >> 24 & 15] ? 0x0802_0801 : 0x0802_0800;
20629: return;
20630: }
20631: break;
20632:
20633:
20634: case 0x16:
20635:
20636: return;
20637:
20638:
20639: }
20640: cirException (0x1d0d);
20641: }
20642:
20643:
20644:
20645: public void cirWriteLong (int a, int d) {
20646: if (CIR_DEBUG_TRACE) {
20647: System.out.printf ("%08x cirWriteLongZero(0x%08x,0x%08x)\n", XEiJ.regPC0, a, d);
20648: }
20649: switch (a & 0x1e) {
20650:
20651:
20652:
20653:
20654:
20655:
20656: case 0x0c:
20657:
20658: return;
20659:
20660: case 0x10:
20661: if ((cirStage & CIR_INPUT_MASK) != 0 && cirOperandIndex < cirOperandLength) {
20662: cirOperandBuffer[cirOperandIndex++] = d;
20663: if (cirOperandIndex == cirOperandLength) {
20664: if (cirStage == CIR_DYNAMIC_K_FACTOR ||
20665: cirStage == CIR_DYNAMIC_REGISTER_LIST ||
20666: cirStage == CIR_SOURCE_OPERAND) {
20667: cirGen ();
20668: } else if (cirStage == CIR_FRESTORE_STATE_FRAME) {
20669: int i = cirFormatWord == 0x1f38 ? 0 : 3 * 8;
20670:
20671: epbFpcr = cirOperandBuffer[i++] & EPB_FPCR_ALL;
20672: epbFpsr = cirOperandBuffer[i++] & EPB_FPSR_ALL;
20673: epbFpiar = cirOperandBuffer[i++];
20674: epbQuotient = cirOperandBuffer[i++];
20675: epbRoundingPrec = cirOperandBuffer[i++];
20676: epbRoundingMode = cirOperandBuffer[i++];
20677: cirResponse = cirOperandBuffer[i++];
20678: cirFormatWord = cirOperandBuffer[i++];
20679: cirOperationWord = cirOperandBuffer[i++];
20680: cirCommand = cirOperandBuffer[i++];
20681: cirRegisterList = cirOperandBuffer[i++];
20682: cirOperandAddress = cirOperandBuffer[i++];
20683: cirOperandLength = cirOperandBuffer[i++];
20684: cirOperandIndex = cirOperandBuffer[i++];
20685: cirStage = cirOperandBuffer[i++];
20686: }
20687: }
20688: return;
20689: }
20690: break;
20691:
20692: case 0x16:
20693:
20694: return;
20695: case 0x18:
20696: if (cirStage == CIR_PROGRAM_COUNTER) {
20697:
20698:
20699: epbFpiar = d;
20700: cirGen ();
20701: return;
20702: }
20703: break;
20704: case 0x1c:
20705: cirOperandAddress = d;
20706: break;
20707: }
20708: cirException (0x1d0d);
20709: }
20710:
20711:
20712:
20713:
20714:
20715:
20716: @SuppressWarnings ("fallthrough") public void cirGen () {
20717: if (CIR_DEBUG_TRACE) {
20718: System.out.printf ("%08x cirGen(command=0x%04x,stage=%d(%s))\n", XEiJ.regPC0, cirCommand, cirStage, cirNameOfStage[cirStage & 15]);
20719: }
20720:
20721:
20722:
20723:
20724: int mmm = cirCommand >> 10 & 7;
20725: int nnn = cirCommand >> 7 & 7;
20726: int ccccccc = cirCommand & 0x7f;
20727:
20728:
20729: switch (cirCommand >> 13) {
20730:
20731:
20732: case 0b010:
20733: if (cirStage == CIR_IDLE) {
20734: epbFpsr &= 0x00ff00ff;
20735: epbSetRoundingPrec (epbFpcr >> 6 & 3);
20736: epbSetRoundingMode (epbFpcr >> 4 & 3);
20737: }
20738:
20739: switch (mmm) {
20740:
20741: case 0b000:
20742:
20743:
20744:
20745:
20746:
20747:
20748:
20749:
20750:
20751:
20752: if (cirStage == CIR_IDLE) {
20753: if ((epbFpcr & 0x0000ff00) != 0) {
20754: cirResponse = 0x8900_d504;
20755: cirStage = CIR_PROGRAM_COUNTER;
20756: } else {
20757: cirResponse = 0x8900_9504;
20758: cirOperandLength = 1;
20759: cirOperandIndex = 0;
20760: cirStage = CIR_SOURCE_OPERAND;
20761: }
20762: return;
20763: }
20764: if (cirStage == CIR_PROGRAM_COUNTER) {
20765: cirOperandLength = 1;
20766: cirOperandIndex = 0;
20767: cirStage = CIR_SOURCE_OPERAND;
20768: return;
20769: }
20770: if (cirStage == CIR_SOURCE_OPERAND) {
20771: epbFPn[mmm = EPB_SRC_TMP].seti (cirOperandBuffer[0]);
20772: if (cirPreInstruction ()) {
20773: return;
20774: }
20775: }
20776: break;
20777:
20778: case 0b001:
20779:
20780:
20781:
20782:
20783:
20784:
20785:
20786:
20787:
20788:
20789: if (cirStage == CIR_IDLE) {
20790: if ((epbFpcr & 0x0000ff00) != 0) {
20791: if ((epbMode & EPB_MODE_MC68882) != 0) {
20792: cirResponse = 0x8900_5504;
20793: } else {
20794: cirResponse = 0x8900_d504;
20795: }
20796: cirStage = CIR_PROGRAM_COUNTER;
20797: } else {
20798: if ((epbMode & EPB_MODE_MC68882) != 0) {
20799: cirResponse = 0x8900_1504;
20800: } else {
20801: cirResponse = 0x8900_9504;
20802: }
20803: cirOperandLength = 1;
20804: cirOperandIndex = 0;
20805: cirStage = CIR_SOURCE_OPERAND;
20806: }
20807: return;
20808: }
20809: if (cirStage == CIR_PROGRAM_COUNTER) {
20810: cirOperandLength = 1;
20811: cirOperandIndex = 0;
20812: cirStage = CIR_SOURCE_OPERAND;
20813: return;
20814: }
20815: if (cirStage == CIR_SOURCE_OPERAND) {
20816: epbFPn[mmm = EPB_SRC_TMP].setf0 (cirOperandBuffer[0]);
20817: if (cirPreInstruction ()) {
20818: return;
20819: }
20820: }
20821: break;
20822:
20823: case 0b010:
20824:
20825:
20826:
20827:
20828:
20829:
20830:
20831:
20832:
20833:
20834:
20835:
20836:
20837:
20838:
20839:
20840: if (cirStage == CIR_IDLE) {
20841: if ((epbFpcr & 0x0000ff00) != 0) {
20842: if ((epbMode & EPB_MODE_MC68882) != 0) {
20843: cirResponse = 0x8900_560c;
20844: } else {
20845: cirResponse = 0x8900_d60c;
20846: }
20847: cirStage = CIR_PROGRAM_COUNTER;
20848: } else {
20849: if ((epbMode & EPB_MODE_MC68882) != 0) {
20850: cirResponse = 0x8900_160c;
20851: } else {
20852: cirResponse = 0x8900_960c;
20853: }
20854: cirOperandLength = 3;
20855: cirOperandIndex = 0;
20856: cirStage = CIR_SOURCE_OPERAND;
20857: }
20858: return;
20859: }
20860: if (cirStage == CIR_PROGRAM_COUNTER) {
20861: cirOperandLength = 3;
20862: cirOperandIndex = 0;
20863: cirStage = CIR_SOURCE_OPERAND;
20864: return;
20865: }
20866: if (cirStage == CIR_SOURCE_OPERAND) {
20867: if (epbIsTriple ()) {
20868: epbFPn[mmm = EPB_SRC_TMP].sety012 (cirOperandBuffer[0], (long) cirOperandBuffer[1] << 32 | cirOperandBuffer[2] & 0xffffffffL);
20869: } else {
20870: epbFPn[mmm = EPB_SRC_TMP].setx012 (cirOperandBuffer[0], (long) cirOperandBuffer[1] << 32 | cirOperandBuffer[2] & 0xffffffffL);
20871: }
20872: if (cirPreInstruction ()) {
20873: return;
20874: }
20875: }
20876: break;
20877:
20878: case 0b011:
20879:
20880:
20881:
20882:
20883:
20884:
20885:
20886:
20887:
20888:
20889:
20890:
20891:
20892:
20893:
20894:
20895: if (cirStage == CIR_IDLE) {
20896: if ((epbFpcr & 0x0000ff00) != 0) {
20897: cirResponse = 0x8900_d60c;
20898: cirStage = CIR_PROGRAM_COUNTER;
20899: } else {
20900: cirResponse = 0x8900_960c;
20901: cirOperandLength = 3;
20902: cirOperandIndex = 0;
20903: cirStage = CIR_SOURCE_OPERAND;
20904: }
20905: return;
20906: }
20907: if (cirStage == CIR_PROGRAM_COUNTER) {
20908: cirOperandLength = 3;
20909: cirOperandIndex = 0;
20910: cirStage = CIR_SOURCE_OPERAND;
20911: return;
20912: }
20913: if (cirStage == CIR_SOURCE_OPERAND) {
20914: epbFPn[mmm = EPB_SRC_TMP].setp012 (cirOperandBuffer[0], (long) cirOperandBuffer[1] << 32 | cirOperandBuffer[2] & 0xffffffffL);
20915: if (cirPreInstruction ()) {
20916: return;
20917: }
20918: }
20919: break;
20920:
20921: case 0b100:
20922:
20923:
20924:
20925:
20926:
20927:
20928:
20929:
20930:
20931:
20932:
20933:
20934:
20935:
20936:
20937:
20938:
20939: if (cirStage == CIR_IDLE) {
20940: if ((epbFpcr & 0x0000ff00) != 0) {
20941: cirResponse = 0x8900_d502;
20942: cirStage = CIR_PROGRAM_COUNTER;
20943: } else {
20944: cirResponse = 0x8900_9502;
20945: cirOperandLength = 1;
20946: cirOperandIndex = 0;
20947: cirStage = CIR_SOURCE_OPERAND;
20948: }
20949: return;
20950: }
20951: if (cirStage == CIR_PROGRAM_COUNTER) {
20952: cirOperandLength = 1;
20953: cirOperandIndex = 0;
20954: cirStage = CIR_SOURCE_OPERAND;
20955: return;
20956: }
20957: if (cirStage == CIR_SOURCE_OPERAND) {
20958: epbFPn[mmm = EPB_SRC_TMP].seti (cirOperandBuffer[0] >> 16);
20959: if (cirPreInstruction ()) {
20960: return;
20961: }
20962: }
20963: break;
20964:
20965: case 0b101:
20966:
20967:
20968:
20969:
20970:
20971:
20972:
20973:
20974:
20975:
20976:
20977:
20978:
20979: if (cirStage == CIR_IDLE) {
20980: if ((epbFpcr & 0x0000ff00) != 0) {
20981: if ((epbMode & EPB_MODE_MC68882) != 0) {
20982: cirResponse = 0x8900_5608;
20983: } else {
20984: cirResponse = 0x8900_d608;
20985: }
20986: cirStage = CIR_PROGRAM_COUNTER;
20987: } else {
20988: if ((epbMode & EPB_MODE_MC68882) != 0) {
20989: cirResponse = 0x8900_1608;
20990: } else {
20991: cirResponse = 0x8900_9608;
20992: }
20993: cirOperandLength = 2;
20994: cirOperandIndex = 0;
20995: cirStage = CIR_SOURCE_OPERAND;
20996: }
20997: return;
20998: }
20999: if (cirStage == CIR_PROGRAM_COUNTER) {
21000: cirOperandLength = 2;
21001: cirOperandIndex = 0;
21002: cirStage = CIR_SOURCE_OPERAND;
21003: return;
21004: }
21005: if (cirStage == CIR_SOURCE_OPERAND) {
21006: epbFPn[mmm = EPB_SRC_TMP].setd01 ((long) cirOperandBuffer[0] << 32 | cirOperandBuffer[1] & 0xffffffffL);
21007: if (cirPreInstruction ()) {
21008: return;
21009: }
21010: }
21011: break;
21012:
21013: case 0b110:
21014:
21015:
21016:
21017:
21018:
21019:
21020:
21021:
21022:
21023:
21024:
21025:
21026:
21027:
21028:
21029:
21030:
21031: if (cirStage == CIR_IDLE) {
21032: if ((epbFpcr & 0x0000ff00) != 0) {
21033: cirResponse = 0x8900_d501;
21034: cirStage = CIR_PROGRAM_COUNTER;
21035: } else {
21036: cirResponse = 0x8900_9501;
21037: cirOperandLength = 1;
21038: cirOperandIndex = 0;
21039: cirStage = CIR_SOURCE_OPERAND;
21040: }
21041: return;
21042: }
21043: if (cirStage == CIR_PROGRAM_COUNTER) {
21044: cirOperandLength = 1;
21045: cirOperandIndex = 0;
21046: cirStage = CIR_SOURCE_OPERAND;
21047: return;
21048: }
21049: if (cirStage == CIR_SOURCE_OPERAND) {
21050: epbFPn[mmm = EPB_SRC_TMP].seti (cirOperandBuffer[0] >> 24);
21051: if (cirPreInstruction ()) {
21052: return;
21053: }
21054: }
21055: break;
21056:
21057: case 0b111:
21058:
21059:
21060:
21061:
21062:
21063:
21064:
21065:
21066:
21067:
21068:
21069:
21070:
21071:
21072:
21073:
21074:
21075:
21076:
21077:
21078:
21079:
21080: default:
21081: if (0x40 <= ccccccc) {
21082:
21083:
21084: cirException (0x1c0b);
21085: return;
21086: }
21087: if (false) {
21088: mmm = EPB_CONST_START + ccccccc;
21089: ccccccc = 0;
21090: } else {
21091:
21092: epbFmovecr (epbFPn[nnn], ccccccc);
21093: if (cirMidInstruction ()) {
21094: return;
21095: }
21096:
21097: cirIdle (0x0802);
21098: return;
21099: }
21100:
21101: }
21102:
21103:
21104:
21105:
21106:
21107: case 0b000:
21108: if (cirStage == CIR_IDLE) {
21109: epbFpsr &= 0x00ff00ff;
21110: }
21111:
21112: switch (ccccccc) {
21113:
21114: case 0b000_0000:
21115:
21116:
21117:
21118:
21119:
21120:
21121:
21122:
21123:
21124:
21125:
21126:
21127:
21128:
21129:
21130:
21131:
21132:
21133:
21134:
21135:
21136: epbFPn[nnn].sete (epbFPn[mmm]).finish ();
21137: break;
21138:
21139: case 0b000_0001:
21140:
21141:
21142:
21143:
21144:
21145:
21146:
21147:
21148:
21149:
21150:
21151:
21152:
21153:
21154:
21155:
21156:
21157:
21158:
21159:
21160:
21161:
21162:
21163:
21164: epbSetRoundingPrec (EPB_PREC_EXD);
21165: epbFPn[nnn].round (epbFPn[mmm], epbRoundingMode);
21166: break;
21167:
21168: case 0b000_0010:
21169:
21170:
21171:
21172:
21173:
21174:
21175:
21176:
21177:
21178:
21179:
21180:
21181:
21182:
21183:
21184:
21185:
21186:
21187:
21188:
21189:
21190: epbFPn[nnn].sinh (epbFPn[mmm]);
21191: break;
21192:
21193: case 0b000_0011:
21194:
21195:
21196:
21197:
21198:
21199:
21200:
21201:
21202:
21203:
21204: epbSetRoundingPrec (EPB_PREC_EXD);
21205: epbFPn[nnn].trunc (epbFPn[mmm]);
21206: break;
21207:
21208: case 0b000_0100:
21209: case 0b000_0101:
21210:
21211:
21212:
21213:
21214:
21215:
21216:
21217:
21218:
21219:
21220: epbFPn[nnn].sqrt (epbFPn[mmm]);
21221: break;
21222:
21223: case 0b000_0110:
21224: case 0b000_0111:
21225:
21226:
21227:
21228:
21229:
21230:
21231:
21232:
21233:
21234: epbFPn[nnn].log1p (epbFPn[mmm]);
21235: break;
21236:
21237: case 0b000_1000:
21238:
21239:
21240:
21241:
21242:
21243:
21244:
21245:
21246: epbFPn[nnn].expm1 (epbFPn[mmm]);
21247: break;
21248:
21249: case 0b000_1001:
21250:
21251:
21252:
21253:
21254:
21255:
21256:
21257:
21258: epbFPn[nnn].tanh (epbFPn[mmm]);
21259: break;
21260:
21261: case 0b000_1010:
21262: case 0b000_1011:
21263:
21264:
21265:
21266:
21267:
21268:
21269:
21270:
21271: epbFPn[nnn].atan (epbFPn[mmm]);
21272: break;
21273:
21274: case 0b000_1100:
21275:
21276:
21277:
21278:
21279:
21280:
21281:
21282:
21283: epbFPn[nnn].asin (epbFPn[mmm]);
21284: break;
21285:
21286: case 0b000_1101:
21287:
21288:
21289:
21290:
21291:
21292:
21293:
21294:
21295:
21296: epbFPn[nnn].atanh (epbFPn[mmm]);
21297: break;
21298:
21299: case 0b000_1110:
21300:
21301:
21302:
21303:
21304:
21305:
21306:
21307:
21308: epbFPn[nnn].sin (epbFPn[mmm]);
21309: break;
21310:
21311: case 0b000_1111:
21312:
21313:
21314:
21315:
21316:
21317:
21318:
21319:
21320:
21321: epbFPn[nnn].tan (epbFPn[mmm]);
21322: break;
21323:
21324: case 0b001_0000:
21325:
21326:
21327:
21328:
21329:
21330:
21331:
21332:
21333: epbFPn[nnn].exp (epbFPn[mmm]);
21334: break;
21335:
21336: case 0b001_0001:
21337:
21338:
21339:
21340:
21341:
21342:
21343:
21344:
21345: epbFPn[nnn].exp2 (epbFPn[mmm]);
21346: break;
21347:
21348: case 0b001_0010:
21349: case 0b001_0011:
21350:
21351:
21352:
21353:
21354:
21355:
21356:
21357:
21358: epbFPn[nnn].exp10 (epbFPn[mmm]);
21359: break;
21360:
21361: case 0b001_0100:
21362:
21363:
21364:
21365:
21366:
21367:
21368:
21369:
21370:
21371:
21372: epbFPn[nnn].log (epbFPn[mmm]);
21373: break;
21374:
21375: case 0b001_0101:
21376:
21377:
21378:
21379:
21380:
21381:
21382:
21383:
21384: epbFPn[nnn].log10 (epbFPn[mmm]);
21385: break;
21386:
21387: case 0b001_0110:
21388: case 0b001_0111:
21389:
21390:
21391:
21392:
21393:
21394:
21395:
21396:
21397: epbFPn[nnn].log2 (epbFPn[mmm]);
21398: break;
21399:
21400: case 0b001_1000:
21401:
21402:
21403:
21404:
21405:
21406:
21407:
21408:
21409: epbFPn[nnn].abs (epbFPn[mmm]);
21410: break;
21411:
21412: case 0b001_1001:
21413:
21414:
21415:
21416:
21417:
21418:
21419:
21420:
21421: epbFPn[nnn].cosh (epbFPn[mmm]);
21422: break;
21423:
21424: case 0b001_1010:
21425: case 0b001_1011:
21426:
21427:
21428:
21429:
21430:
21431:
21432:
21433:
21434: epbFPn[nnn].neg (epbFPn[mmm]);
21435: break;
21436:
21437: case 0b001_1100:
21438:
21439:
21440:
21441:
21442:
21443:
21444:
21445:
21446:
21447:
21448: epbFPn[nnn].acos (epbFPn[mmm]);
21449: break;
21450:
21451: case 0b001_1101:
21452:
21453:
21454:
21455:
21456:
21457:
21458:
21459:
21460:
21461: epbFPn[nnn].cos (epbFPn[mmm]);
21462: break;
21463:
21464: case 0b001_1110:
21465:
21466:
21467:
21468:
21469:
21470:
21471:
21472:
21473: epbFPn[nnn].getexp (epbFPn[mmm]);
21474: break;
21475:
21476: case 0b001_1111:
21477:
21478:
21479:
21480:
21481:
21482:
21483:
21484:
21485: epbFPn[nnn].getman (epbFPn[mmm]);
21486: break;
21487:
21488: case 0b010_0000:
21489:
21490:
21491:
21492:
21493:
21494:
21495:
21496:
21497: epbFPn[nnn].div (epbFPn[mmm]);
21498: break;
21499:
21500: case 0b010_0001:
21501:
21502:
21503:
21504:
21505:
21506:
21507:
21508:
21509:
21510:
21511: epbFPn[nnn].rem (epbFPn[mmm]);
21512: break;
21513:
21514: case 0b010_0010:
21515:
21516:
21517:
21518:
21519:
21520:
21521:
21522:
21523: epbFPn[nnn].add (epbFPn[mmm]);
21524: break;
21525:
21526: case 0b010_0011:
21527:
21528:
21529:
21530:
21531:
21532:
21533:
21534:
21535: epbFPn[nnn].mul (epbFPn[mmm]);
21536: break;
21537:
21538: case 0b010_0100:
21539:
21540:
21541:
21542:
21543:
21544:
21545:
21546:
21547: epbSetRoundingPrec (EPB_PREC_XSG);
21548: epbFPn[nnn].div (epbFPn[mmm]);
21549: break;
21550:
21551: case 0b010_0101:
21552:
21553:
21554:
21555:
21556:
21557:
21558:
21559:
21560:
21561:
21562:
21563:
21564: epbFPn[nnn].ieeerem (epbFPn[mmm]);
21565: break;
21566:
21567: case 0b010_0110:
21568:
21569:
21570:
21571:
21572:
21573:
21574:
21575:
21576:
21577: epbFPn[nnn].scale (epbFPn[mmm]);
21578: break;
21579:
21580: case 0b010_0111:
21581:
21582:
21583:
21584:
21585:
21586:
21587:
21588:
21589: {
21590:
21591: int sr = epbFpsr;
21592: epbFPn[EPB_SRC_TMP].roundmanf (epbFPn[mmm], EPB_MODE_RZ);
21593: epbFPn[EPB_DST_TMP].roundmanf (epbFPn[nnn], EPB_MODE_RZ);
21594: epbFpsr = sr;
21595: }
21596: epbSetRoundingPrec (EPB_PREC_XSG);
21597: epbFPn[nnn].mul (epbFPn[EPB_DST_TMP], epbFPn[EPB_SRC_TMP]);
21598: break;
21599:
21600: case 0b010_1000:
21601: case 0b010_1001:
21602: case 0b010_1010:
21603: case 0b010_1011:
21604: case 0b010_1100:
21605: case 0b010_1101:
21606: case 0b010_1110:
21607: case 0b010_1111:
21608:
21609:
21610:
21611:
21612:
21613:
21614:
21615:
21616: epbFPn[nnn].sub (epbFPn[mmm]);
21617: break;
21618:
21619: case 0b011_0000:
21620: case 0b011_0001:
21621: case 0b011_0010:
21622: case 0b011_0011:
21623: case 0b011_0100:
21624: case 0b011_0101:
21625: case 0b011_0110:
21626: case 0b011_0111:
21627:
21628:
21629:
21630:
21631:
21632:
21633:
21634:
21635:
21636: {
21637: int ccc = ccccccc & 7;
21638:
21639: epbFPn[EPB_SRC_TMP].sete (epbFPn[mmm]);
21640: epbFPn[ccc].cos (epbFPn[EPB_SRC_TMP]);
21641: epbFPn[nnn].sin (epbFPn[EPB_SRC_TMP]);
21642: }
21643: break;
21644:
21645: case 0b011_1000:
21646: case 0b011_1001:
21647: case 0b011_1100:
21648: case 0b011_1101:
21649:
21650:
21651:
21652:
21653:
21654:
21655:
21656:
21657:
21658:
21659:
21660:
21661:
21662: {
21663: int xf = epbFPn[nnn].flg;
21664: int yf = epbFPn[mmm].flg;
21665: if ((xf | yf) << 3 < 0) {
21666:
21667: epbFPn[EPB_DST_TMP].flg = N;
21668: } else {
21669: int i = ((xf & yf) << 1 < 0 ? 0 :
21670: epbFPn[nnn].compareTo (epbFPn[mmm]));
21671: if (i == 0) {
21672: if (xf < 0) {
21673:
21674: epbFPn[EPB_DST_TMP].flg = M | Z;
21675: } else {
21676:
21677: epbFPn[EPB_DST_TMP].flg = P | Z;
21678: }
21679: } else if (i < 0) {
21680: epbFPn[EPB_DST_TMP].negset1 ();
21681: } else {
21682: epbFPn[EPB_DST_TMP].set1 ();
21683: }
21684: }
21685: nnn = EPB_DST_TMP;
21686: }
21687: break;
21688:
21689: case 0b011_1010:
21690: case 0b011_1011:
21691: case 0b011_1110:
21692: case 0b011_1111:
21693:
21694:
21695:
21696:
21697:
21698:
21699:
21700:
21701:
21702:
21703:
21704: epbFPn[EPB_DST_TMP].sete (epbFPn[mmm]);
21705: nnn = EPB_DST_TMP;
21706: break;
21707:
21708: case 0b100_0000:
21709:
21710:
21711:
21712:
21713:
21714:
21715:
21716:
21717: epbSetRoundingPrec (EPB_PREC_SGL);
21718: epbFPn[nnn].sete (epbFPn[mmm]).finish ();
21719: break;
21720:
21721: case 0b100_0001:
21722:
21723:
21724:
21725:
21726:
21727:
21728:
21729:
21730: epbSetRoundingPrec (EPB_PREC_SGL);
21731: epbFPn[nnn].sqrt (epbFPn[mmm]);
21732: break;
21733:
21734:
21735:
21736:
21737: case 0b100_0100:
21738:
21739:
21740:
21741:
21742:
21743:
21744:
21745:
21746: epbSetRoundingPrec (EPB_PREC_DBL);
21747: epbFPn[nnn].sete (epbFPn[mmm]).finish ();
21748: break;
21749:
21750: case 0b100_0101:
21751:
21752:
21753:
21754:
21755:
21756:
21757:
21758:
21759: epbSetRoundingPrec (EPB_PREC_DBL);
21760: epbFPn[nnn].sqrt (epbFPn[mmm]);
21761: break;
21762:
21763:
21764:
21765:
21766:
21767:
21768:
21769:
21770:
21771:
21772:
21773:
21774:
21775:
21776:
21777:
21778:
21779:
21780:
21781:
21782: case 0b101_1000:
21783:
21784:
21785:
21786:
21787:
21788:
21789:
21790:
21791: epbSetRoundingPrec (EPB_PREC_SGL);
21792: epbFPn[nnn].abs (epbFPn[mmm]);
21793: break;
21794:
21795:
21796:
21797: case 0b101_1010:
21798:
21799:
21800:
21801:
21802:
21803:
21804:
21805:
21806: epbSetRoundingPrec (EPB_PREC_SGL);
21807: epbFPn[nnn].neg (epbFPn[mmm]);
21808: break;
21809:
21810:
21811:
21812: case 0b101_1100:
21813:
21814:
21815:
21816:
21817:
21818:
21819:
21820:
21821: epbSetRoundingPrec (EPB_PREC_DBL);
21822: epbFPn[nnn].abs (epbFPn[mmm]);
21823: break;
21824:
21825:
21826:
21827: case 0b101_1110:
21828:
21829:
21830:
21831:
21832:
21833:
21834:
21835:
21836: epbSetRoundingPrec (EPB_PREC_DBL);
21837: epbFPn[nnn].neg (epbFPn[mmm]);
21838: break;
21839:
21840:
21841:
21842: case 0b110_0000:
21843:
21844:
21845:
21846:
21847:
21848:
21849:
21850:
21851: epbSetRoundingPrec (EPB_PREC_SGL);
21852: epbFPn[nnn].div (epbFPn[mmm]);
21853: break;
21854:
21855:
21856:
21857: case 0b110_0010:
21858:
21859:
21860:
21861:
21862:
21863:
21864:
21865:
21866: epbSetRoundingPrec (EPB_PREC_SGL);
21867: epbFPn[nnn].add (epbFPn[mmm]);
21868: break;
21869:
21870: case 0b110_0011:
21871:
21872:
21873:
21874:
21875:
21876:
21877:
21878:
21879: epbSetRoundingPrec (EPB_PREC_SGL);
21880: epbFPn[nnn].mul (epbFPn[mmm]);
21881: break;
21882:
21883: case 0b110_0100:
21884:
21885:
21886:
21887:
21888:
21889:
21890:
21891:
21892: epbSetRoundingPrec (EPB_PREC_DBL);
21893: epbFPn[nnn].div (epbFPn[mmm]);
21894: break;
21895:
21896:
21897:
21898: case 0b110_0110:
21899:
21900:
21901:
21902:
21903:
21904:
21905:
21906:
21907: epbSetRoundingPrec (EPB_PREC_DBL);
21908: epbFPn[nnn].add (epbFPn[mmm]);
21909: break;
21910:
21911: case 0b110_0111:
21912:
21913:
21914:
21915:
21916:
21917:
21918:
21919:
21920: epbSetRoundingPrec (EPB_PREC_DBL);
21921: epbFPn[nnn].mul (epbFPn[mmm]);
21922: break;
21923:
21924: case 0b110_1000:
21925:
21926:
21927:
21928:
21929:
21930:
21931:
21932:
21933: epbSetRoundingPrec (EPB_PREC_SGL);
21934: epbFPn[nnn].sub (epbFPn[mmm]);
21935: break;
21936:
21937:
21938:
21939:
21940:
21941: case 0b110_1100:
21942:
21943:
21944:
21945:
21946:
21947:
21948:
21949:
21950:
21951:
21952:
21953:
21954:
21955:
21956:
21957:
21958:
21959:
21960:
21961:
21962:
21963:
21964:
21965:
21966: epbSetRoundingPrec (EPB_PREC_DBL);
21967: epbFPn[nnn].sub (epbFPn[mmm]);
21968: break;
21969:
21970:
21971:
21972:
21973:
21974: case 0b111_0000:
21975: if (EFPBox.EPB_EXTRA_OPERATION) {
21976: epbFPn[nnn].lgamma (epbFPn[mmm]);
21977: } else {
21978: cirException (0x1c0b);
21979: }
21980: break;
21981:
21982: case 0b111_0001:
21983: if (EFPBox.EPB_EXTRA_OPERATION) {
21984: epbFPn[nnn].tgamma (epbFPn[mmm]);
21985: } else {
21986: cirException (0x1c0b);
21987: }
21988: break;
21989:
21990:
21991:
21992:
21993:
21994:
21995:
21996:
21997:
21998:
21999:
22000:
22001:
22002:
22003:
22004:
22005: default:
22006: cirException (0x1c0b);
22007: return;
22008: }
22009:
22010: epbFpsr |= epbFPn[nnn].flg >>> 4;
22011: if (cirMidInstruction ()) {
22012: return;
22013: }
22014:
22015: cirIdle (0x0802);
22016: return;
22017:
22018:
22019: case 0b011:
22020:
22021:
22022:
22023:
22024:
22025:
22026:
22027:
22028: if (cirStage == CIR_IDLE) {
22029: epbFpsr &= 0xffff00ff;
22030: } else if (cirStage == CIR_DESTINATION_OPERAND) {
22031:
22032: cirIdle (0x0802);
22033: return;
22034: }
22035:
22036: switch (mmm) {
22037:
22038: case 0b000:
22039:
22040:
22041:
22042:
22043:
22044:
22045:
22046:
22047:
22048:
22049:
22050:
22051:
22052:
22053:
22054:
22055:
22056: cirOperandBuffer[0] = epbFPn[nnn].geti (epbRoundingMode);
22057: if (cirMidInstruction ()) {
22058: return;
22059: }
22060: cirResponse = 0x8900_b104;
22061: cirOperandLength = 1;
22062: cirOperandIndex = 0;
22063: cirStage = CIR_DESTINATION_OPERAND;
22064: break;
22065:
22066: case 0b001:
22067:
22068:
22069:
22070:
22071:
22072:
22073:
22074:
22075:
22076:
22077:
22078:
22079:
22080:
22081:
22082:
22083:
22084: cirOperandBuffer[0] = epbFPn[nnn].getf0 (epbRoundingMode);
22085: if (cirMidInstruction ()) {
22086: return;
22087: }
22088: if ((epbMode & EPB_MODE_MC68882) != 0) {
22089: cirResponse = 0x8900_3104;
22090: } else {
22091: cirResponse = 0x8900_b104;
22092: }
22093: cirOperandLength = 1;
22094: cirOperandIndex = 0;
22095: cirStage = CIR_DESTINATION_OPERAND;
22096: break;
22097:
22098: case 0b010:
22099:
22100:
22101:
22102:
22103:
22104:
22105:
22106:
22107:
22108:
22109:
22110:
22111:
22112:
22113:
22114:
22115:
22116:
22117:
22118:
22119:
22120:
22121:
22122:
22123:
22124: {
22125: byte[] b = new byte[12];
22126: if (epbIsTriple ()) {
22127: epbFPn[nnn].gety012 (b, 0, epbRoundingMode);
22128: } else {
22129: epbFPn[nnn].getx012 (b, 0, epbRoundingMode);
22130: }
22131: if (cirMidInstruction ()) {
22132: return;
22133: }
22134: cirOperandBuffer[0] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
22135: cirOperandBuffer[1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
22136: cirOperandBuffer[2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
22137: if ((epbMode & EPB_MODE_MC68882) != 0) {
22138: cirResponse = 0x8900_320c;
22139: } else {
22140: cirResponse = 0x8900_320c;
22141: }
22142: cirOperandLength = 3;
22143: cirOperandIndex = 0;
22144: cirStage = CIR_DESTINATION_OPERAND;
22145: break;
22146: }
22147:
22148: case 0b011:
22149:
22150:
22151:
22152:
22153:
22154:
22155:
22156:
22157:
22158:
22159:
22160:
22161:
22162:
22163:
22164:
22165:
22166:
22167:
22168:
22169:
22170:
22171:
22172:
22173:
22174:
22175:
22176:
22177:
22178:
22179:
22180:
22181:
22182:
22183:
22184:
22185:
22186:
22187:
22188:
22189:
22190:
22191:
22192:
22193:
22194:
22195:
22196:
22197:
22198:
22199:
22200:
22201:
22202:
22203:
22204:
22205:
22206:
22207:
22208:
22209:
22210:
22211:
22212:
22213:
22214:
22215:
22216:
22217:
22218:
22219:
22220:
22221:
22222:
22223:
22224:
22225:
22226:
22227:
22228:
22229:
22230:
22231:
22232:
22233:
22234:
22235:
22236:
22237:
22238:
22239:
22240:
22241:
22242:
22243:
22244:
22245:
22246:
22247:
22248:
22249:
22250: {
22251: byte[] b = new byte[12];
22252: epbFPn[nnn].getp012 (b, 0, ccccccc);
22253: if (cirMidInstruction ()) {
22254: return;
22255: }
22256: cirOperandBuffer[0] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
22257: cirOperandBuffer[1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
22258: cirOperandBuffer[2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
22259: cirResponse = 0x8900_b20c;
22260: cirOperandLength = 3;
22261: cirOperandIndex = 0;
22262: cirStage = CIR_DESTINATION_OPERAND;
22263: break;
22264: }
22265:
22266: case 0b100:
22267:
22268:
22269:
22270:
22271:
22272:
22273:
22274:
22275:
22276:
22277:
22278:
22279:
22280:
22281:
22282:
22283:
22284: cirOperandBuffer[0] = epbFPn[nnn].gets (epbRoundingMode) << 16;
22285: if (cirMidInstruction ()) {
22286: return;
22287: }
22288: cirResponse = 0x8900_b102;
22289: cirOperandLength = 1;
22290: cirOperandIndex = 0;
22291: cirStage = CIR_DESTINATION_OPERAND;
22292: break;
22293:
22294: case 0b101:
22295:
22296:
22297:
22298:
22299:
22300:
22301:
22302:
22303:
22304:
22305:
22306:
22307:
22308:
22309:
22310:
22311:
22312:
22313:
22314:
22315:
22316: {
22317: long l = epbFPn[nnn].getd01 (epbRoundingMode);
22318: if (cirMidInstruction ()) {
22319: return;
22320: }
22321: cirOperandBuffer[0] = (int) (l >> 32);
22322: cirOperandBuffer[1] = (int) l;
22323: if ((epbMode & EPB_MODE_MC68882) != 0) {
22324: cirResponse = 0x8900_3208;
22325: } else {
22326: cirResponse = 0x8900_b208;
22327: }
22328: cirOperandLength = 2;
22329: cirOperandIndex = 0;
22330: cirStage = CIR_DESTINATION_OPERAND;
22331: }
22332: break;
22333:
22334: case 0b110:
22335:
22336:
22337:
22338:
22339:
22340:
22341:
22342:
22343:
22344:
22345:
22346:
22347:
22348:
22349:
22350:
22351:
22352: cirOperandBuffer[0] = epbFPn[nnn].getb (epbRoundingMode) << 24;
22353: if (cirMidInstruction ()) {
22354: return;
22355: }
22356: cirResponse = 0x8900_b101;
22357: cirOperandLength = 1;
22358: cirOperandIndex = 0;
22359: cirStage = CIR_DESTINATION_OPERAND;
22360: break;
22361:
22362: case 0b111:
22363:
22364:
22365:
22366:
22367:
22368:
22369:
22370:
22371:
22372:
22373:
22374:
22375:
22376:
22377:
22378:
22379:
22380:
22381:
22382:
22383:
22384:
22385:
22386:
22387:
22388:
22389:
22390:
22391: default:
22392: if (cirStage == CIR_IDLE) {
22393: cirResponse = 0x8900_8c00 + (cirCommand >> 4 & 7);
22394: cirOperandLength = 1;
22395: cirOperandIndex = 0;
22396: cirStage = CIR_DYNAMIC_K_FACTOR;
22397: return;
22398: } else if (cirStage == CIR_DYNAMIC_K_FACTOR) {
22399: byte[] b = new byte[12];
22400: epbFPn[nnn].getp012 (b, 0, cirOperandBuffer[0]);
22401: if (cirMidInstruction ()) {
22402: return;
22403: }
22404: cirOperandBuffer[0] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
22405: cirOperandBuffer[1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
22406: cirOperandBuffer[2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
22407: cirResponse = 0x8900_b20c;
22408: cirOperandLength = 3;
22409: cirOperandIndex = 0;
22410: cirStage = CIR_DESTINATION_OPERAND;
22411: }
22412: }
22413: return;
22414:
22415:
22416: case 0b100:
22417:
22418:
22419:
22420: switch (mmm) {
22421:
22422: case 0b000:
22423:
22424:
22425:
22426:
22427:
22428:
22429:
22430:
22431:
22432:
22433:
22434:
22435: case 0b001:
22436:
22437:
22438:
22439:
22440:
22441:
22442:
22443:
22444:
22445:
22446: if (cirStage == CIR_IDLE) {
22447: cirResponse = 0x8900_9704;
22448: cirOperandLength = 1;
22449: cirOperandIndex = 0;
22450: cirStage = CIR_SOURCE_OPERAND;
22451: return;
22452: } else {
22453: epbFpiar = cirOperandBuffer[0];
22454: }
22455: break;
22456:
22457: case 0b010:
22458:
22459:
22460:
22461:
22462:
22463:
22464:
22465:
22466:
22467:
22468:
22469:
22470: if (cirStage == CIR_IDLE) {
22471: cirResponse = 0x8900_9504;
22472: cirOperandLength = 1;
22473: cirOperandIndex = 0;
22474: cirStage = CIR_SOURCE_OPERAND;
22475: return;
22476: } else {
22477: epbFpsr = cirOperandBuffer[0] & EPB_FPSR_ALL;
22478: }
22479: break;
22480:
22481: case 0b011:
22482:
22483:
22484:
22485:
22486:
22487:
22488:
22489:
22490:
22491:
22492:
22493:
22494:
22495: if (cirStage == CIR_IDLE) {
22496: cirResponse = 0x8900_9608;
22497: cirOperandLength = 2;
22498: cirOperandIndex = 0;
22499: cirStage = CIR_SOURCE_OPERAND;
22500: return;
22501: } else {
22502: epbFpsr = cirOperandBuffer[0] & EPB_FPSR_ALL;
22503: epbFpiar = cirOperandBuffer[1];
22504: }
22505: break;
22506:
22507: case 0b100:
22508:
22509:
22510:
22511:
22512:
22513:
22514:
22515:
22516:
22517:
22518: if (cirStage == CIR_IDLE) {
22519: cirResponse = 0x8900_9504;
22520: cirOperandLength = 1;
22521: cirOperandIndex = 0;
22522: cirStage = CIR_SOURCE_OPERAND;
22523: return;
22524: } else {
22525: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22526: }
22527: break;
22528:
22529: case 0b101:
22530:
22531:
22532:
22533:
22534:
22535:
22536:
22537:
22538:
22539:
22540:
22541:
22542:
22543: if (cirStage == CIR_IDLE) {
22544: cirResponse = 0x8900_9608;
22545: cirOperandLength = 2;
22546: cirOperandIndex = 0;
22547: cirStage = CIR_SOURCE_OPERAND;
22548: return;
22549: } else {
22550: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22551: epbFpiar = cirOperandBuffer[1];
22552: }
22553: break;
22554:
22555: case 0b110:
22556:
22557:
22558:
22559:
22560:
22561:
22562:
22563:
22564:
22565:
22566:
22567:
22568:
22569: if (cirStage == CIR_IDLE) {
22570: cirResponse = 0x8900_9608;
22571: cirOperandLength = 2;
22572: cirOperandIndex = 0;
22573: cirStage = CIR_SOURCE_OPERAND;
22574: return;
22575: } else {
22576: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22577: epbFpsr = cirOperandBuffer[1] & EPB_FPSR_ALL;
22578: }
22579: break;
22580:
22581: case 0b111:
22582:
22583:
22584:
22585:
22586:
22587:
22588:
22589:
22590:
22591:
22592:
22593:
22594:
22595:
22596:
22597:
22598: default:
22599: if (cirStage == CIR_IDLE) {
22600: cirResponse = 0x8900_960c;
22601: cirOperandLength = 3;
22602: cirOperandIndex = 0;
22603: cirStage = CIR_SOURCE_OPERAND;
22604: return;
22605: } else {
22606: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22607: epbFpsr = cirOperandBuffer[1] & EPB_FPSR_ALL;
22608: epbFpiar = cirOperandBuffer[2];
22609: }
22610: }
22611:
22612: cirIdle (0x0802);
22613: return;
22614:
22615:
22616: case 0b101:
22617:
22618:
22619: if (cirStage == CIR_DESTINATION_OPERAND) {
22620:
22621: cirIdle (0x0802);
22622: return;
22623: }
22624:
22625: switch (mmm) {
22626:
22627: case 0b000:
22628:
22629:
22630:
22631:
22632:
22633:
22634:
22635:
22636:
22637:
22638:
22639:
22640:
22641: case 0b001:
22642:
22643:
22644:
22645:
22646:
22647:
22648:
22649:
22650:
22651:
22652:
22653: cirOperandBuffer[0] = epbFpiar;
22654: cirResponse = 0x8900_b304;
22655: cirOperandLength = 1;
22656: cirOperandIndex = 0;
22657: cirStage = CIR_DESTINATION_OPERAND;
22658: return;
22659:
22660: case 0b010:
22661:
22662:
22663:
22664:
22665:
22666:
22667:
22668:
22669:
22670:
22671:
22672: cirOperandBuffer[0] = epbFpsr;
22673: cirResponse = 0x8900_b104;
22674: cirOperandLength = 1;
22675: cirOperandIndex = 0;
22676: cirStage = CIR_DESTINATION_OPERAND;
22677: return;
22678:
22679: case 0b011:
22680:
22681:
22682:
22683:
22684:
22685:
22686:
22687:
22688:
22689:
22690:
22691:
22692:
22693:
22694:
22695: cirOperandBuffer[0] = epbFpsr;
22696: cirOperandBuffer[1] = epbFpiar;
22697: cirResponse = 0x8900_b208;
22698: cirOperandLength = 2;
22699: cirOperandIndex = 0;
22700: cirStage = CIR_DESTINATION_OPERAND;
22701: return;
22702:
22703: case 0b100:
22704:
22705:
22706:
22707:
22708:
22709:
22710:
22711:
22712:
22713:
22714:
22715: cirOperandBuffer[0] = epbFpcr;
22716: cirResponse = 0x8900_b104;
22717: cirOperandLength = 1;
22718: cirOperandIndex = 0;
22719: cirStage = CIR_DESTINATION_OPERAND;
22720: return;
22721:
22722: case 0b101:
22723:
22724:
22725:
22726:
22727:
22728:
22729:
22730:
22731:
22732:
22733:
22734:
22735:
22736:
22737:
22738: cirOperandBuffer[0] = epbFpcr;
22739: cirOperandBuffer[1] = epbFpiar;
22740: cirResponse = 0x8900_b208;
22741: cirOperandLength = 2;
22742: cirOperandIndex = 0;
22743: cirStage = CIR_DESTINATION_OPERAND;
22744: return;
22745:
22746: case 0b110:
22747:
22748:
22749:
22750:
22751:
22752:
22753:
22754:
22755:
22756:
22757:
22758:
22759:
22760:
22761:
22762: cirOperandBuffer[0] = epbFpcr;
22763: cirOperandBuffer[1] = epbFpsr;
22764: cirResponse = 0x8900_b208;
22765: cirOperandLength = 2;
22766: cirOperandIndex = 0;
22767: cirStage = CIR_DESTINATION_OPERAND;
22768: return;
22769:
22770: case 0b111:
22771:
22772:
22773:
22774:
22775:
22776:
22777:
22778:
22779:
22780:
22781:
22782:
22783:
22784:
22785:
22786:
22787:
22788:
22789:
22790: default:
22791: cirOperandBuffer[0] = epbFpcr;
22792: cirOperandBuffer[1] = epbFpsr;
22793: cirOperandBuffer[2] = epbFpiar;
22794: cirResponse = 0x8900_b20c;
22795: cirOperandLength = 3;
22796: cirOperandIndex = 0;
22797: cirStage = CIR_DESTINATION_OPERAND;
22798: return;
22799: }
22800:
22801:
22802:
22803: case 0b110:
22804:
22805:
22806:
22807:
22808:
22809:
22810:
22811:
22812:
22813:
22814:
22815:
22816:
22817:
22818:
22819:
22820:
22821:
22822:
22823:
22824:
22825:
22826:
22827:
22828:
22829:
22830:
22831:
22832:
22833:
22834:
22835:
22836:
22837:
22838:
22839:
22840:
22841:
22842:
22843:
22844:
22845:
22846:
22847:
22848:
22849:
22850:
22851:
22852:
22853:
22854:
22855:
22856:
22857:
22858:
22859:
22860:
22861:
22862:
22863:
22864:
22865:
22866:
22867:
22868:
22869:
22870:
22871:
22872:
22873:
22874:
22875:
22876:
22877:
22878:
22879:
22880:
22881:
22882:
22883:
22884:
22885:
22886:
22887:
22888:
22889:
22890:
22891:
22892:
22893:
22894:
22895:
22896:
22897:
22898:
22899:
22900:
22901:
22902:
22903:
22904:
22905:
22906:
22907:
22908:
22909:
22910:
22911:
22912:
22913:
22914:
22915:
22916:
22917:
22918:
22919:
22920:
22921:
22922:
22923:
22924:
22925:
22926:
22927:
22928:
22929:
22930:
22931:
22932:
22933:
22934:
22935:
22936:
22937:
22938:
22939:
22940:
22941:
22942:
22943:
22944:
22945:
22946:
22947:
22948:
22949:
22950:
22951:
22952:
22953:
22954:
22955:
22956:
22957:
22958:
22959:
22960:
22961:
22962:
22963:
22964:
22965:
22966:
22967:
22968:
22969:
22970:
22971:
22972:
22973:
22974:
22975:
22976:
22977:
22978:
22979:
22980:
22981:
22982:
22983:
22984:
22985:
22986:
22987:
22988:
22989:
22990:
22991:
22992:
22993:
22994:
22995:
22996:
22997:
22998:
22999:
23000:
23001:
23002:
23003:
23004:
23005:
23006:
23007:
23008:
23009:
23010:
23011:
23012:
23013:
23014:
23015:
23016:
23017:
23018:
23019:
23020:
23021:
23022:
23023:
23024:
23025:
23026:
23027:
23028:
23029:
23030:
23031:
23032:
23033:
23034:
23035:
23036:
23037:
23038:
23039:
23040:
23041:
23042:
23043:
23044:
23045:
23046:
23047:
23048:
23049:
23050:
23051:
23052:
23053:
23054:
23055:
23056:
23057:
23058:
23059:
23060:
23061:
23062:
23063:
23064:
23065:
23066:
23067:
23068:
23069:
23070:
23071:
23072:
23073:
23074:
23075:
23076:
23077:
23078:
23079:
23080:
23081:
23082:
23083:
23084: if (cirStage == CIR_IDLE) {
23085: if ((cirCommand & 0x0700) != 0) {
23086: cirException (0x1c0b);
23087: return;
23088: }
23089: if ((mmm & 2) == 0) {
23090: cirRegisterList = cirCommand & 255;
23091: cirResponse = 0x8900_810c;
23092: cirStage = CIR_REGISTER_SELECT;
23093: } else {
23094: cirResponse = 0x8900_8c00 + (cirCommand >> 4 & 7);
23095: cirOperandLength = 1;
23096: cirOperandIndex = 0;
23097: cirStage = CIR_DYNAMIC_REGISTER_LIST;
23098: }
23099: return;
23100: }
23101: if (cirStage == CIR_DYNAMIC_REGISTER_LIST) {
23102: cirRegisterList = cirOperandBuffer[0] & 255;
23103: cirResponse = 0x8900_810c;
23104: cirStage = CIR_REGISTER_SELECT;
23105: return;
23106: }
23107: if (cirStage == CIR_REGISTER_SELECT) {
23108: if (cirRegisterList == 0) {
23109:
23110: cirIdle (0x0802);
23111: return;
23112: }
23113: cirOperandLength = 3 * Integer.bitCount (cirRegisterList);
23114: cirOperandIndex = 0;
23115: cirStage = CIR_SOURCE_OPERAND;
23116: return;
23117: }
23118:
23119: {
23120: int n, p;
23121: if ((cirCommand & 0x1000) == 0) {
23122: n = 7;
23123: p = -1;
23124: } else {
23125: n = 0;
23126: p = 1;
23127: }
23128: int i = 0;
23129: for (int list = cirRegisterList << 24; list != 0; n += p, list <<= 1) {
23130: if (list < 0) {
23131: if (epbIsTriple ()) {
23132: epbFPn[n].sety012 (cirOperandBuffer[i], (long) cirOperandBuffer[i + 1] << 32 | cirOperandBuffer[i + 2] & 0xffffffffL);
23133: } else {
23134: epbFPn[n].setx012 (cirOperandBuffer[i], (long) cirOperandBuffer[i + 1] << 32 | cirOperandBuffer[i + 2] & 0xffffffffL);
23135: }
23136: i += 3;
23137: }
23138: }
23139:
23140: cirIdle (0x0802);
23141: return;
23142: }
23143:
23144:
23145:
23146: case 0b111:
23147:
23148:
23149:
23150:
23151:
23152:
23153:
23154:
23155:
23156:
23157:
23158:
23159:
23160:
23161:
23162:
23163:
23164:
23165:
23166:
23167:
23168:
23169:
23170:
23171:
23172:
23173:
23174:
23175:
23176:
23177:
23178:
23179:
23180:
23181:
23182:
23183:
23184:
23185:
23186:
23187:
23188:
23189:
23190:
23191:
23192:
23193:
23194:
23195:
23196:
23197:
23198:
23199:
23200:
23201:
23202:
23203:
23204:
23205:
23206:
23207:
23208:
23209:
23210:
23211:
23212:
23213:
23214:
23215:
23216:
23217:
23218:
23219:
23220:
23221:
23222:
23223:
23224:
23225:
23226:
23227:
23228:
23229:
23230:
23231:
23232:
23233:
23234:
23235:
23236:
23237:
23238:
23239:
23240:
23241:
23242:
23243:
23244:
23245:
23246:
23247:
23248:
23249:
23250:
23251:
23252:
23253:
23254:
23255:
23256:
23257:
23258:
23259:
23260:
23261:
23262:
23263:
23264:
23265:
23266:
23267:
23268:
23269:
23270:
23271:
23272:
23273:
23274:
23275:
23276:
23277:
23278:
23279:
23280:
23281:
23282:
23283:
23284:
23285:
23286:
23287:
23288:
23289:
23290:
23291: if (cirStage == CIR_IDLE) {
23292: if ((cirCommand & 0x0700) != 0) {
23293: cirException (0x1c0b);
23294: return;
23295: }
23296: if ((mmm & 2) == 0) {
23297: cirRegisterList = cirCommand & 255;
23298: cirResponse = 0x8900_a10c;
23299: cirStage = CIR_REGISTER_SELECT;
23300: } else {
23301: cirResponse = 0x8900_8c00 + (cirCommand >> 4 & 7);
23302: cirOperandLength = 1;
23303: cirOperandIndex = 0;
23304: cirStage = CIR_DYNAMIC_REGISTER_LIST;
23305: }
23306: return;
23307: }
23308: if (cirStage == CIR_DYNAMIC_REGISTER_LIST) {
23309: cirRegisterList = cirOperandBuffer[0] & 255;
23310: cirResponse = 0x8900_a10c;
23311: cirStage = CIR_REGISTER_SELECT;
23312: return;
23313: }
23314: if (cirStage == CIR_REGISTER_SELECT) {
23315: if (cirRegisterList == 0) {
23316:
23317: cirIdle (0x0802);
23318: return;
23319: }
23320: int n, p;
23321: if ((cirCommand & 0x1000) == 0) {
23322: n = 7;
23323: p = -1;
23324: } else {
23325: n = 0;
23326: p = 1;
23327: }
23328: int i = 0;
23329: byte[] b = new byte[12];
23330: for (int list = cirRegisterList << 24; list != 0; n += p, list <<= 1) {
23331: if (list < 0) {
23332: if (epbIsTriple ()) {
23333: epbFPn[n].gety012 (b, 0, epbRoundingMode);
23334: } else {
23335: epbFPn[n].getx012 (b, 0, epbRoundingMode);
23336: }
23337: cirOperandBuffer[i] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
23338: cirOperandBuffer[i + 1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
23339: cirOperandBuffer[i + 2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
23340: i += 3;
23341: }
23342: }
23343: cirOperandLength = i;
23344: cirOperandIndex = 0;
23345: cirStage = CIR_DESTINATION_OPERAND;
23346: return;
23347: }
23348:
23349: {
23350:
23351: cirIdle (0x0802);
23352: return;
23353: }
23354:
23355:
23356:
23357: case 0b001:
23358: default:
23359: cirException (0x1c0b);
23360: return;
23361: }
23362:
23363: }
23364:
23365:
23366:
23367:
23368:
23369:
23370:
23371: public boolean cirPreInstruction () {
23372:
23373: epbFpsr |= XEiJ.FPU_FPSR_EXC_TO_AEXC[epbFpsr >> 8 & 255];
23374:
23375: int mask = epbFpcr & epbFpsr & 0x0000ff00;
23376: if (mask == 0) {
23377: return false;
23378: }
23379: if ((short) mask < 0) {
23380: cirException (0x5c30);
23381: } else if (mask << 17 < 0) {
23382: cirException (0x1c36);
23383: } else if (mask << 18 < 0) {
23384: cirException (0x1c34);
23385: } else if (mask << 19 < 0) {
23386: cirException (0x1c35);
23387: } else if (mask << 20 < 0) {
23388: cirException (0x1c33);
23389: } else if (mask << 21 < 0) {
23390: cirException (0x1c32);
23391: } else {
23392: cirException (0x1c31);
23393: }
23394: return true;
23395: }
23396:
23397:
23398:
23399:
23400:
23401:
23402: public boolean cirMidInstruction () {
23403:
23404: epbFpsr |= XEiJ.FPU_FPSR_EXC_TO_AEXC[epbFpsr >> 8 & 255];
23405:
23406: int mask = epbFpcr & epbFpsr & 0x0000ff00;
23407: if (mask == 0) {
23408: return false;
23409: }
23410: if ((short) mask < 0) {
23411: cirException (0x5d30);
23412: } else if (mask << 17 < 0) {
23413: cirException (0x1d36);
23414: } else if (mask << 18 < 0) {
23415: cirException (0x1d34);
23416: } else if (mask << 19 < 0) {
23417: cirException (0x1d35);
23418: } else if (mask << 20 < 0) {
23419: cirException (0x1d33);
23420: } else if (mask << 21 < 0) {
23421: cirException (0x1d32);
23422: } else {
23423: cirException (0x1d31);
23424: }
23425: return true;
23426: }
23427:
23428:
23429:
23430: }
23431:
23432:
23433: