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 static 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: public double getd () {
10080: return Double.longBitsToDouble (this.getd01 (EPB_MODE_RN));
10081: }
10082: public double getd (int roundingMode) {
10083: return Double.longBitsToDouble (this.getd01 (roundingMode));
10084: }
10085: public long getd01 () {
10086: return this.getd01 (EPB_MODE_RN);
10087: }
10088: public long getd01 (int roundingMode) {
10089: int xf = this.flg;
10090: if (xf << 1 != 0) {
10091: return (xf << 1 < 0 ? 0 <= xf ? 0x0000000000000000L : 0x8000000000000000L :
10092: xf << 2 < 0 ? 0 <= xf ? 0x7ff0000000000000L : 0xfff0000000000000L :
10093: EFP_FPCP_NAN ? 0x7fffffffffffffffL : 0x7ff8000000000000L);
10094: }
10095:
10096: int xe = this.epp;
10097: long xd = this.dvl;
10098: long xc = this.cvl;
10099: if (xe < -1075) {
10100: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10101: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10102: epbExceptionOperandMantissa = xd;
10103: return (0 <= xf ?
10104: roundingMode == EPB_MODE_RP ? 0x0000000000000001L : 0x0000000000000000L :
10105: roundingMode == EPB_MODE_RM ? 0x8000000000000001L : 0x8000000000000000L);
10106: }
10107: if (1023 < xe) {
10108: if (true) {
10109: epbFpsr |= EPB_FPSR_OF;
10110: if ((xd << 53 | xc) != 0L) {
10111: epbFpsr |= EPB_FPSR_X2;
10112: }
10113: } else {
10114: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10115: }
10116: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10117: epbExceptionOperandMantissa = xd;
10118: return (0 <= xf ?
10119: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7fefffffffffffffL : 0x7ff0000000000000L :
10120: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xffefffffffffffffL : 0xfff0000000000000L);
10121: }
10122: long xb = 0L;
10123: int o = xe <= -1023 ? 11 + -1022 - xe : 11;
10124: if (o < 64) {
10125: xb = xc << -o;
10126: xc = xd << -o | xc >>> o;
10127: xd >>>= o;
10128: } else {
10129: xb = xc;
10130: xc = xd;
10131: xd = 0L;
10132: }
10133: if ((xc | xb) != 0L) {
10134: epbFpsr |= EPB_FPSR_X2;
10135: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
10136: roundingMode == EPB_MODE_RM && xf < 0 ||
10137: roundingMode == EPB_MODE_RP && 0 <= xf) {
10138: xd++;
10139: if (xd >>> 53 != 0L) {
10140: xd = 1L << 52;
10141: xe++;
10142: if (1023 < xe) {
10143: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10144: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10145: epbExceptionOperandMantissa = xd;
10146: return (0 <= xf ?
10147: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7fefffffffffffffL : 0x7ff0000000000000L :
10148: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xffefffffffffffffL : 0xfff0000000000000L);
10149: }
10150: } else if (11 < o) {
10151: if (xd << o - 1 < 0L) {
10152: xe++;
10153:
10154: if (xe == -1022) {
10155:
10156: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10157: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10158: epbExceptionOperandMantissa = xd;
10159: }
10160:
10161: }
10162: }
10163: }
10164:
10165: if (xe <= -1023) {
10166: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10167: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10168: epbExceptionOperandMantissa = xd;
10169: if (xd == 0L) {
10170: return (0 <= xf ?
10171: roundingMode == EPB_MODE_RP ? 0x0000000000000001L : 0x0000000000000000L :
10172: roundingMode == EPB_MODE_RM ? 0x8000000000000001L : 0x8000000000000000L);
10173: }
10174: }
10175: } else {
10176: if (xe <= -1023) {
10177: epbFpsr |= EPB_FPSR_UF;
10178: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10179: epbExceptionOperandMantissa = xd;
10180: if (xd == 0L) {
10181: return (0 <= xf ?
10182: roundingMode == EPB_MODE_RP ? 0x0000000000000001L : 0x0000000000000000L :
10183: roundingMode == EPB_MODE_RM ? 0x8000000000000001L : 0x8000000000000000L);
10184: }
10185: }
10186: }
10187: return ((long) (xf | Math.max (0, xe + 1023) << 52 - 32) << 32 |
10188: xd & ((1L << 52) - 1L));
10189: }
10190: public long getd01 (byte[] b, int a) {
10191: long l = this.getd01 (EPB_MODE_RN);
10192: b[a ] = (byte) (l >>> 56);
10193: b[a + 1] = (byte) (l >>> 48);
10194: b[a + 2] = (byte) (l >>> 40);
10195: b[a + 3] = (byte) (l >>> 32);
10196: b[a + 4] = (byte) (l >>> 24);
10197: b[a + 5] = (byte) (l >>> 16);
10198: b[a + 6] = (byte) (l >>> 8);
10199: b[a + 7] = (byte) l;
10200: return l;
10201: }
10202: public long getd01 (byte[] b, int a, int roundingMode) {
10203: long l = this.getd01 (roundingMode);
10204: b[a ] = (byte) (l >>> 56);
10205: b[a + 1] = (byte) (l >>> 48);
10206: b[a + 2] = (byte) (l >>> 40);
10207: b[a + 3] = (byte) (l >>> 32);
10208: b[a + 4] = (byte) (l >>> 24);
10209: b[a + 5] = (byte) (l >>> 16);
10210: b[a + 6] = (byte) (l >>> 8);
10211: b[a + 7] = (byte) l;
10212: return l;
10213: }
10214:
10215:
10216:
10217:
10218:
10219:
10220:
10221:
10222: public final EFP getexp () {
10223: return this.getexp (this);
10224: }
10225: public final EFP getexp (EFP x) {
10226: int xf = x.flg;
10227: if (xf << 1 != 0) {
10228: if (xf << 2 < 0) {
10229: epbFpsr |= EPB_FPSR_OE;
10230: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10231: epbExceptionOperandMantissa = 0x0000000000000000L;
10232: this.flg = N;
10233: } else {
10234: this.flg = xf;
10235: }
10236: return this;
10237: }
10238: return this.seti (x.epp);
10239: }
10240:
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: public float getf () {
10288: return Float.intBitsToFloat (this.getf0 (EPB_MODE_RN));
10289: }
10290: public float getf (int roundingMode) {
10291: return Float.intBitsToFloat (this.getf0 (roundingMode));
10292: }
10293: public int getf0 () {
10294: return this.getf0 (EPB_MODE_RN);
10295: }
10296: public int getf0 (int roundingMode) {
10297: int xf = this.flg;
10298: if (xf << 1 != 0) {
10299: return (xf << 1 < 0 ? xf & M :
10300: xf << 2 < 0 ? (xf & M) | 0x7f800000 :
10301: EFP_FPCP_NAN ? 0x7fffffff : 0x7fc00000);
10302: }
10303:
10304: int xe = this.epp;
10305: long xd = this.dvl;
10306: long xc = this.cvl;
10307: if (xe < -150) {
10308: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10309: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10310: epbExceptionOperandMantissa = xd;
10311: return (0 <= xf ?
10312: roundingMode == EPB_MODE_RP ? 0x00000001 : 0x00000000 :
10313: roundingMode == EPB_MODE_RM ? 0x80000001 : 0x80000000);
10314: }
10315: if (127 < xe) {
10316: if (true) {
10317: epbFpsr |= EPB_FPSR_OF;
10318: if ((xd << 24 | xc) != 0L) {
10319: epbFpsr |= EPB_FPSR_X2;
10320: }
10321: } else {
10322: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10323: }
10324: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10325: epbExceptionOperandMantissa = xd;
10326: return (0 <= xf ?
10327: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7f7fffff : 0x7f800000 :
10328: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xff7fffff : 0xff800000);
10329: }
10330: long xb = 0L;
10331: int o = xe <= -127 ? 40 + -126 - xe : 40;
10332: if (o < 64) {
10333: xb = xc << -o;
10334: xc = xd << -o | xc >>> o;
10335: xd >>>= o;
10336: } else {
10337: xb = xc;
10338: xc = xd;
10339: xd = 0L;
10340: }
10341: if ((xc | xb) != 0L) {
10342: epbFpsr |= EPB_FPSR_X2;
10343: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << -1 | xc << 1 | xb) != 0L ||
10344: roundingMode == EPB_MODE_RM && xf < 0 ||
10345: roundingMode == EPB_MODE_RP && 0 <= xf) {
10346: xd++;
10347: if (xd >>> 24 != 0L) {
10348: xd = 1L << 23;
10349: xe++;
10350: if (127 < xe) {
10351: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10352: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10353: epbExceptionOperandMantissa = xd;
10354: return (0 <= xf ?
10355: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RM ? 0x7f7fffff : 0x7f800000 :
10356: roundingMode == EPB_MODE_RZ || roundingMode == EPB_MODE_RP ? 0xff7fffff : 0xff800000);
10357: }
10358: } else if (40 < o) {
10359: if (xd << o - 1 < 0L) {
10360: xe++;
10361:
10362: if (xe == -126) {
10363:
10364: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10365: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10366: epbExceptionOperandMantissa = xd;
10367: }
10368:
10369: }
10370: }
10371: }
10372:
10373: if (xe <= -127) {
10374: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10375: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10376: epbExceptionOperandMantissa = xd;
10377: if (xd == 0L) {
10378: return (0 <= xf ?
10379: roundingMode == EPB_MODE_RP ? 0x00000001 : 0x00000000 :
10380: roundingMode == EPB_MODE_RM ? 0x80000001 : 0x80000000);
10381: }
10382: }
10383: } else {
10384: if (xe <= -127) {
10385: epbFpsr |= EPB_FPSR_UF;
10386: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10387: epbExceptionOperandMantissa = xd;
10388: if (xd == 0L) {
10389: return (0 <= xf ?
10390: roundingMode == EPB_MODE_RP ? 0x00000001 : 0x00000000 :
10391: roundingMode == EPB_MODE_RM ? 0x80000001 : 0x80000000);
10392: }
10393: }
10394: }
10395: return (xf | Math.max (0, xe + 127) << 23 |
10396: (int) xd & ((1 << 23) - 1));
10397: }
10398: public int getf0 (byte[] b, int a) {
10399: int i = this.getf0 (EPB_MODE_RN);
10400: b[a ] = (byte) (i >>> 24);
10401: b[a + 1] = (byte) (i >>> 16);
10402: b[a + 2] = (byte) (i >>> 8);
10403: b[a + 3] = (byte) i;
10404: return i;
10405: }
10406: public int getf0 (byte[] b, int a, int roundingMode) {
10407: int i = this.getf0 (roundingMode);
10408: b[a ] = (byte) (i >>> 24);
10409: b[a + 1] = (byte) (i >>> 16);
10410: b[a + 2] = (byte) (i >>> 8);
10411: b[a + 3] = (byte) i;
10412: return i;
10413: }
10414:
10415:
10416:
10417:
10418:
10419:
10420:
10421:
10422:
10423:
10424: public int geti () {
10425: int xf = this.flg;
10426: if (xf << 1 != 0) {
10427: if (xf << 1 < 0) {
10428: return 0;
10429: } else if (xf << 2 < 0) {
10430: epbFpsr |= EPB_FPSR_OE;
10431: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10432: epbExceptionOperandMantissa = 0x0000000000000000L;
10433: return xf >> 31 ^ 0x7fffffff;
10434: } else {
10435: epbFpsr |= EPB_FPSR_OE | EPB_FPSR_AV;
10436: epbExceptionOperandExponent = 0x7fff << 16;
10437: epbExceptionOperandMantissa = 0xffffffffffffffffL;
10438: return -1;
10439: }
10440: }
10441:
10442: int xe = this.epp;
10443: long xd = this.dvl;
10444: long xc = this.cvl;
10445: if (xe < 0) {
10446: if (false) {
10447: epbFpsr |= EPB_FPSR_X2;
10448: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10449: epbExceptionOperandMantissa = xd;
10450: }
10451: return 0;
10452: }
10453:
10454: if (xe < 31) {
10455: if (false) {
10456: if ((xd << 1 + xe | xc) != 0L) {
10457: epbFpsr |= EPB_FPSR_X2;
10458: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10459: epbExceptionOperandMantissa = xd;
10460: }
10461: }
10462: return xf >= 0 ? (int) (xd >>> ~xe) : -(int) (xd >>> ~xe);
10463: }
10464:
10465: if (xf >= 0) {
10466: epbFpsr |= EPB_FPSR_OE;
10467: epbExceptionOperandExponent = 0x3fff + xe << 16;
10468: epbExceptionOperandMantissa = xd;
10469: return 0x7fffffff;
10470: }
10471:
10472: if (xe != 31 || xd != MSB || xc != 0L) {
10473: epbFpsr |= EPB_FPSR_OE;
10474: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
10475: epbExceptionOperandMantissa = this.dvl;
10476: }
10477: return 0x80000000;
10478: }
10479: public int geti (int roundingMode) {
10480: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().geti () :
10481: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().geti () :
10482: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().geti () :
10483: new EFP ().inner ().trunc (this).outer ().geti ());
10484: }
10485:
10486:
10487:
10488:
10489:
10490:
10491: public int geti32abs () {
10492: return geti32abs (this);
10493: }
10494: public int geti32abs (EFP x) {
10495: int xf = x.flg;
10496: if (xf << 1 != 0) {
10497: return 0;
10498: }
10499:
10500: int xe = x.epp;
10501: long xd = x.dvl;
10502: long xc = x.cvl;
10503: return (xe < 0 ? 0 :
10504: xe <= 63 ? (int) (xd >>> ~xe) :
10505: xe <= 94 ? (int) (xd << xe + 1 | xc >>> ~xe) :
10506: xe <= LEN + 30 ? (int) (xc >>> ~xe) :
10507: 0);
10508: }
10509:
10510:
10511:
10512:
10513:
10514:
10515:
10516:
10517:
10518: public long getl () {
10519: int xf = this.flg;
10520: if (xf << 1 != 0) {
10521: if (xf << 1 < 0) {
10522: return 0L;
10523: } else if (xf << 2 < 0) {
10524: epbFpsr |= EPB_FPSR_OE;
10525: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10526: epbExceptionOperandMantissa = 0x0000000000000000L;
10527: return xf < 0 ? MSB : ~MSB;
10528: } else {
10529: epbFpsr |= EPB_FPSR_OE;
10530: epbExceptionOperandExponent = 0x7fff << 16;
10531: epbExceptionOperandMantissa = 0xffffffffffffffffL;
10532: return 0L;
10533: }
10534: }
10535:
10536: int xe = this.epp;
10537: if (xe < 0) {
10538: return 0L;
10539: }
10540:
10541: if (xe < 63) {
10542: return xf >= 0 ? this.dvl >>> ~xe : -(this.dvl >>> ~xe);
10543: }
10544:
10545: if (xf >= 0) {
10546: epbFpsr |= EPB_FPSR_OE;
10547: epbExceptionOperandExponent = 0x3fff + xe << 16;
10548: epbExceptionOperandMantissa = this.dvl;
10549: return 0x7fffffffffffffffL;
10550: }
10551:
10552: if (xe != 63 || this.dvl != MSB || this.cvl != 0L) {
10553: epbFpsr |= EPB_FPSR_OE;
10554: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
10555: epbExceptionOperandMantissa = this.dvl;
10556: }
10557: return 0x8000000000000000L;
10558: }
10559: public long getl (int roundingMode) {
10560: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().getl () :
10561: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().getl () :
10562: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().getl () :
10563: this.getl ());
10564: }
10565:
10566:
10567:
10568:
10569:
10570:
10571:
10572:
10573: public final EFP getman () {
10574: return this.getman (this);
10575: }
10576: public final EFP getman (EFP x) {
10577: int xf = x.flg;
10578: if (xf << 1 != 0) {
10579: if (xf << 2 < 0) {
10580: epbFpsr |= EPB_FPSR_OE;
10581: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10582: epbExceptionOperandMantissa = 0x0000000000000000L;
10583: this.flg = N;
10584: } else {
10585: this.flg = xf;
10586: }
10587: return this;
10588: }
10589: this.flg = xf;
10590: this.epp = 0;
10591: this.dvl = x.dvl;
10592: this.cvl = x.cvl;
10593: return this;
10594: }
10595:
10596:
10597:
10598:
10599:
10600:
10601:
10602:
10603:
10604:
10605:
10606:
10607:
10608:
10609:
10610:
10611:
10612:
10613:
10614:
10615:
10616:
10617: public void getp012 (byte[] b, int a) {
10618: getp012 (b, a, 17);
10619: }
10620: public void getp012 (byte[] b, int a, int k) {
10621: k = k << -7 >> -7;
10622: int u;
10623: long v;
10624: int xf = this.flg;
10625: if (xf << 1 != 0) {
10626: if (xf << 1 < 0) {
10627: u = xf & M;
10628: v = 0L;
10629: } else if (xf << 2 < 0) {
10630: u = (xf & M) | 0x7fff0000;
10631: v = 0L;
10632: } else {
10633: u = 0x7fff0000;
10634: v = 0xffffffffffffffffL;
10635: }
10636: } else {
10637: if (k > 17) {
10638: epbFpsr |= EPB_FPSR_OE;
10639: epbExceptionOperandExponent = this.flg & M | 0x3fff + this.epp << 16;
10640: epbExceptionOperandMantissa = this.dvl;
10641: k = 17;
10642: }
10643:
10644:
10645:
10646:
10647:
10648:
10649:
10650:
10651:
10652:
10653: int xe = this.epp;
10654: long xd = this.dvl;
10655: long xc = this.cvl;
10656: EFP x = new EFP (P, xe, xd, xc);
10657: int savedFpsr = epbFpsr;
10658: this.inner ();
10659:
10660:
10661:
10662:
10663:
10664:
10665: int e = (int) Math.floor (0.30102999566398119521373889472449302677 * xe);
10666:
10667:
10668: if (e < 0) {
10669: int o = -e;
10670: EFP t = new EFP (ONE);
10671: for (int i = 0; o != 0; i++, o >>>= 1) {
10672: if ((o & 1) != 0) {
10673: t.imul (EFP_TEN_POWER_P[i]);
10674: }
10675: }
10676: x.imul (t);
10677: } else if (e <= 18) {
10678: e = 0;
10679: } else {
10680: int o = e -= 18;
10681: EFP t = new EFP (ONE);
10682: for (int i = 0; o != 0; i++, o >>>= 1) {
10683: if ((o & 1) != 0) {
10684: t.imul (EFP_TEN_POWER_P[i]);
10685: }
10686: }
10687: x.div (t);
10688: }
10689:
10690:
10691:
10692: u = 0;
10693: v = 0L;
10694: if (0 <= x.epp) {
10695:
10696: long s, t;
10697: if (x.epp <= 63) {
10698: s = 0L;
10699: t = x.dvl >>> ~x.epp;
10700: } else {
10701: s = 1L;
10702: t = x.dvl << 1 | x.cvl >>> -1;
10703: }
10704:
10705: long r = s << 32 | t >>> 32;
10706: s = r / 10000L;
10707: r = r - s * 10000L << 32 | t & 0xffffffffL;
10708: t = r / 10000L;
10709: v = XEiJ.FMT_BCD4[(int) (r - t * 10000L)];
10710: t = XEiJ.fmtBcd16 (s << 32 | t);
10711: u = (int) (t >>> 48);
10712: v |= t << 16;
10713: }
10714:
10715:
10716: while ((u & 0xfffffff0) == 0) {
10717: u = u << 16 | (int) (v >>> -16);
10718: v = v << 16 | XEiJ.FMT_BCD4[x.frac ().muli (10000).geti32abs ()];
10719: e -= 4;
10720: }
10721: long rest = x.frac ().iszero () ? 0L : 1L;
10722: this.outer ();
10723: epbFpsr = savedFpsr;
10724:
10725:
10726:
10727:
10728:
10729:
10730: int w = 24 - (Integer.numberOfLeadingZeros (u) >>> 2);
10731:
10732:
10733: if (k <= 0) {
10734:
10735:
10736:
10737:
10738: k = Math.max (1, Math.min (17, w + e - k));
10739: }
10740:
10741: int i = w - k - 1 << 2;
10742: if (0 < i) {
10743: if (i < 64) {
10744: long mask = -1L << i;
10745: rest |= v & ~mask;
10746: v &= mask;
10747: } else {
10748: int mask = -1 << i - 64;
10749: rest |= (long) (u & ~mask) | v;
10750: u &= mask;
10751: v = 0L;
10752: }
10753: }
10754:
10755: int d = (i < 64 ? (int) (v >>> i) : u >>> i - 64) & 15;
10756: if (d != 0 || rest != 0L) {
10757: epbFpsr |= EPB_FPSR_X2;
10758: epbExceptionOperandExponent = xf & M | 0x3fff + xe << 16;
10759: epbExceptionOperandMantissa = xd;
10760: if (i < 64) {
10761: v &= ~(15L << i);
10762: } else {
10763: u &= ~(15 << i);
10764: }
10765: i += 4;
10766: if ((epbRoundingMode == EPB_MODE_RN &&
10767: (5 < d ||
10768: (d == 5 && (rest != 0L ||
10769: ((i < 64 ? (int) (v >>> i) : u >>> i - 64) & 1) != 0)))) ||
10770: (epbRoundingMode == EPB_MODE_RM && xf < 0) ||
10771: (epbRoundingMode == EPB_MODE_RP && 0 <= xf)) {
10772:
10773:
10774:
10775: while (((i < 64 ? (int) (v >>> i) : u >>> i - 64) & 15) == 9) {
10776: if (i < 64) {
10777: v &= ~(15L << i);
10778: } else {
10779: u &= ~(15 << i);
10780: }
10781: i += 4;
10782: }
10783:
10784:
10785: if (i < 64) {
10786: v += 1L << i;
10787: } else {
10788: u += 1 << i;
10789: }
10790: }
10791: }
10792:
10793: w = 7 - (Integer.numberOfLeadingZeros (u) >>> 2);
10794: e += 16 + w;
10795: i = w << 2;
10796: v = (long) u << -i | v >>> i;
10797: u >>>= i - 64;
10798:
10799: if (e < 0) {
10800: u |= 0x40000000;
10801: e = -e;
10802: }
10803: e = XEiJ.fmtBcd8 (e);
10804: if ((e & ~0xfff) != 0) {
10805: epbFpsr |= EPB_FPSR_OE;
10806: epbExceptionOperandExponent = xf & M | 0x3fff + xe << 16;
10807: epbExceptionOperandMantissa = xd;
10808: }
10809: u |= (e & 0xfff) << 16 | (e & 0xf000);
10810:
10811: u |= xf & M;
10812: }
10813: b[a ] = (byte) (u >> 24);
10814: b[a + 1] = (byte) (u >> 16);
10815: b[a + 2] = (byte) (u >> 8);
10816: b[a + 3] = (byte) u;
10817: u = (int) (v >>> 32);
10818: b[a + 4] = (byte) (u >> 24);
10819: b[a + 5] = (byte) (u >> 16);
10820: b[a + 6] = (byte) (u >> 8);
10821: b[a + 7] = (byte) u;
10822: u = (int) v;
10823: b[a + 8] = (byte) (u >> 24);
10824: b[a + 9] = (byte) (u >> 16);
10825: b[a + 10] = (byte) (u >> 8);
10826: b[a + 11] = (byte) u;
10827: return;
10828: }
10829:
10830:
10831:
10832:
10833:
10834:
10835:
10836:
10837:
10838:
10839:
10840:
10841: public int gets () {
10842: int xf = this.flg;
10843: if (xf << 1 != 0) {
10844: if (xf << 1 < 0) {
10845: return 0;
10846: } else if (xf << 2 < 0) {
10847: epbFpsr |= EPB_FPSR_OE;
10848: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
10849: epbExceptionOperandMantissa = 0x0000000000000000L;
10850: return xf >> 31 ^ 0x00007fff;
10851: } else {
10852: epbFpsr |= EPB_FPSR_OE | EPB_FPSR_AV;
10853: epbExceptionOperandExponent = 0x7fff << 16;
10854: epbExceptionOperandMantissa = 0xffffffffffffffffL;
10855: return -1;
10856: }
10857: }
10858:
10859: int xe = this.epp;
10860: long xd = this.dvl;
10861: long xc = this.cvl;
10862: if (xe < 0) {
10863: if (false) {
10864: epbFpsr |= EPB_FPSR_X2;
10865: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10866: epbExceptionOperandMantissa = xd;
10867: }
10868: return 0;
10869: }
10870:
10871: if (xe < 15) {
10872: if (false) {
10873: if ((xd << 1 + xe | xc) != 0L) {
10874: epbFpsr |= EPB_FPSR_X2;
10875: epbExceptionOperandExponent = xf | 0x3fff + xe << 16;
10876: epbExceptionOperandMantissa = xd;
10877: }
10878: }
10879: return xf >= 0 ? (int) (xd >>> ~xe) : -(int) (xd >>> ~xe);
10880: }
10881:
10882: if (xf >= 0) {
10883: epbFpsr |= EPB_FPSR_OE;
10884: epbExceptionOperandExponent = 0x3fff + xe << 16;
10885: epbExceptionOperandMantissa = xd;
10886: return 0x00007fff;
10887: }
10888:
10889: if (xe != 15 || xd != MSB || xc != 0L) {
10890: epbFpsr |= EPB_FPSR_OE;
10891: epbExceptionOperandExponent = M | 0x3fff + xe << 16;
10892: epbExceptionOperandMantissa = this.dvl;
10893: }
10894: return 0xffff8000;
10895: }
10896: public int gets (int roundingMode) {
10897: return (roundingMode == EPB_MODE_RN ? new EFP ().inner ().rint (this).outer ().gets () :
10898: roundingMode == EPB_MODE_RM ? new EFP ().inner ().floor (this).outer ().gets () :
10899: roundingMode == EPB_MODE_RP ? new EFP ().inner ().ceil (this).outer ().gets () :
10900: new EFP ().inner ().trunc (this).outer ().gets ());
10901: }
10902:
10903:
10904:
10905:
10906:
10907:
10908:
10909:
10910:
10911:
10912:
10913:
10914:
10915:
10916:
10917:
10918:
10919:
10920:
10921:
10922:
10923:
10924:
10925:
10926:
10927:
10928:
10929:
10930:
10931:
10932:
10933:
10934:
10935:
10936: public void getx012 (byte[] b, int a) {
10937: this.getx012 (b, a, EPB_MODE_RN);
10938: }
10939: public void getx012 (byte[] b, int a, int roundingMode) {
10940: int xf = this.flg;
10941: int xe = this.epp;
10942: long xd = this.dvl;
10943: long xc = this.cvl;
10944: xfxd:
10945: {
10946: if (xf << 1 != 0) {
10947: if (xf << 1 < 0) {
10948: xf &= M;
10949: xd = 0x0000000000000000L;
10950: } else if (xf << 2 < 0) {
10951: xf = (xf & M) | 0x7fff0000;
10952: xd = 0x0000000000000000L;
10953: } else {
10954: xf = 0x7fff0000;
10955: xd = 0xffffffffffffffffL;
10956: }
10957: break xfxd;
10958: }
10959:
10960: if (xe < -16447) {
10961: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
10962: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
10963: epbExceptionOperandMantissa = xd;
10964: if (0 <= xf) {
10965: if (roundingMode == EPB_MODE_RP) {
10966: xf = 0x00000000;
10967: xd = 0x0000000000000001L;
10968: } else {
10969: xf = 0x00000000;
10970: xd = 0x0000000000000000L;
10971: }
10972: } else {
10973: if (roundingMode == EPB_MODE_RM) {
10974: xf = 0x80000000;
10975: xd = 0x0000000000000001L;
10976: } else {
10977: xf = 0x80000000;
10978: xd = 0x0000000000000000L;
10979: }
10980: }
10981: break xfxd;
10982: }
10983: if (16383 < xe) {
10984: if (true) {
10985: epbFpsr |= EPB_FPSR_OF;
10986: if (xc != 0L) {
10987: epbFpsr |= EPB_FPSR_X2;
10988: }
10989: } else {
10990: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
10991: }
10992: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
10993: epbExceptionOperandMantissa = xd;
10994: if (0 <= xf) {
10995: if (roundingMode == EPB_MODE_RM) {
10996: xf = 0x7ffe0000;
10997: xd = 0xffffffffffffffffL;
10998: } else {
10999: xf = 0x7fff0000;
11000: xd = 0x0000000000000000L;
11001: }
11002: } else {
11003: if (roundingMode == EPB_MODE_RP) {
11004: xf = 0xfffe0000;
11005: xd = 0xffffffffffffffffL;
11006: } else {
11007: xf = 0xffff0000;
11008: xd = 0x0000000000000000L;
11009: }
11010: }
11011: break xfxd;
11012: }
11013: long xb = 0L;
11014: int o = xe <= -16384 ? 0 + -16383 - xe : 0;
11015: if (o == 0) {
11016: } else if (o < 64) {
11017: xb = xc << -o;
11018: xc = xd << -o | xc >>> o;
11019: xd >>>= o;
11020: } else {
11021: xb = xc;
11022: xc = xd;
11023: xd = 0L;
11024: }
11025: if ((xc | xb) != 0L) {
11026: epbFpsr |= EPB_FPSR_X2;
11027: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
11028: roundingMode == EPB_MODE_RM && xf < 0 ||
11029: roundingMode == EPB_MODE_RP && 0 <= xf) {
11030: xd++;
11031: if (xd == 0L) {
11032: xd = MSB;
11033: xe++;
11034: if (16383 < xe) {
11035: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11036: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11037: epbExceptionOperandMantissa = xd;
11038: if (0 <= xf) {
11039: if (roundingMode == EPB_MODE_RM) {
11040: xf = 0x7ffe0000;
11041: xd = 0xffffffffffffffffL;
11042: } else {
11043: xf = 0x7fff0000;
11044: xd = 0x0000000000000000L;
11045: }
11046: } else {
11047: if (roundingMode == EPB_MODE_RP) {
11048: xf = 0xfffe0000;
11049: xd = 0xffffffffffffffffL;
11050: } else {
11051: xf = 0xffff0000;
11052: xd = 0x0000000000000000L;
11053: }
11054: }
11055: break xfxd;
11056: }
11057: } else if (0 < o) {
11058: if (xd << o - 1 < 0L) {
11059: xe++;
11060:
11061:
11062:
11063:
11064:
11065:
11066:
11067:
11068: }
11069: }
11070: }
11071:
11072: if (xe <= -16384) {
11073: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11074: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11075: epbExceptionOperandMantissa = xd;
11076: if (xd == 0L) {
11077: if (0 <= xf) {
11078: if (roundingMode == EPB_MODE_RP) {
11079: xf = 0x00000000;
11080: xd = 0x0000000000000001L;
11081: } else {
11082: xf = 0x00000000;
11083: xd = 0x0000000000000000L;
11084: }
11085: } else {
11086: if (roundingMode == EPB_MODE_RM) {
11087: xf = 0x80000000;
11088: xd = 0x0000000000000001L;
11089: } else {
11090: xf = 0x80000000;
11091: xd = 0x0000000000000000L;
11092: }
11093: }
11094: break xfxd;
11095: }
11096: }
11097: } else {
11098: if (xe <= -16384) {
11099: epbFpsr |= EPB_FPSR_UF;
11100: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11101: epbExceptionOperandMantissa = xd;
11102: if (xd == 0L) {
11103: if (0 <= xf) {
11104: if (roundingMode == EPB_MODE_RP) {
11105: xf = 0x00000000;
11106: xd = 0x0000000000000001L;
11107: } else {
11108: xf = 0x00000000;
11109: xd = 0x0000000000000000L;
11110: }
11111: } else {
11112: if (roundingMode == EPB_MODE_RM) {
11113: xf = 0x80000000;
11114: xd = 0x0000000000000001L;
11115: } else {
11116: xf = 0x80000000;
11117: xd = 0x0000000000000000L;
11118: }
11119: }
11120: break xfxd;
11121: }
11122: }
11123: }
11124: xf |= Math.max (0, 16383 + xe) << 16;
11125: }
11126:
11127: b[a ] = (byte) (xf >> 24);
11128: b[a + 1] = (byte) (xf >> 16);
11129: b[a + 2] = 0;
11130: b[a + 3] = 0;
11131: xf = (int) (xd >>> 32);
11132: b[a + 4] = (byte) (xf >> 24);
11133: b[a + 5] = (byte) (xf >> 16);
11134: b[a + 6] = (byte) (xf >> 8);
11135: b[a + 7] = (byte) xf;
11136: xf = (int) xd;
11137: b[a + 8] = (byte) (xf >> 24);
11138: b[a + 9] = (byte) (xf >> 16);
11139: b[a + 10] = (byte) (xf >> 8);
11140: b[a + 11] = (byte) xf;
11141: return;
11142: }
11143: public int getx0 () {
11144: byte[] b = new byte[12];
11145: this.getx012 (b, 0, EPB_MODE_RN);
11146: return b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
11147: }
11148: public int getx0 (int roundingMode) {
11149: byte[] b = new byte[12];
11150: this.getx012 (b, 0, roundingMode);
11151: return b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
11152: }
11153: public long getx12 () {
11154: byte[] b = new byte[12];
11155: this.getx012 (b, 0, EPB_MODE_RN);
11156: return ((long) (b[4] << 24 | (b[5] & 255) << 16 | (char) (b[ 6] << 8 | b[ 7] & 255)) << 32 |
11157: (long) (b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255)) & 0xffffffffL);
11158: }
11159: public long getx12 (int roundingMode) {
11160: byte[] b = new byte[12];
11161: this.getx012 (b, 0, roundingMode);
11162: return ((long) (b[4] << 24 | (b[5] & 255) << 16 | (char) (b[ 6] << 8 | b[ 7] & 255)) << 32 |
11163: (long) (b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255)) & 0xffffffffL);
11164: }
11165:
11166:
11167:
11168:
11169:
11170:
11171:
11172:
11173:
11174:
11175:
11176:
11177:
11178:
11179:
11180:
11181:
11182:
11183:
11184:
11185:
11186:
11187:
11188:
11189:
11190:
11191:
11192:
11193:
11194:
11195:
11196: public void gety012 (byte[] b, int a) {
11197: this.gety012 (b, a, EPB_MODE_RN);
11198: }
11199: public void gety012 (byte[] b, int a, int roundingMode) {
11200: int xf = this.flg;
11201: int xe = this.epp;
11202: long xd = this.dvl;
11203: long xc = this.cvl;
11204: xfxd:
11205: {
11206: if (xf << 1 != 0) {
11207: if (xf << 1 < 0) {
11208: xf &= M;
11209: xd = 0x0000000000000000L;
11210: } else if (xf << 2 < 0) {
11211: xf = (xf & M) | 0x7fff0000;
11212: xd = 0x0000000000000000L;
11213: } else {
11214: xf = 0x7fffffff;
11215: xd = 0xffffffffffffffffL;
11216: }
11217: break xfxd;
11218: }
11219:
11220: if (xe < -16463) {
11221: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11222: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11223: epbExceptionOperandMantissa = xd;
11224: if (0 <= xf) {
11225: if (roundingMode == EPB_MODE_RP) {
11226: xf = 0x00000001;
11227: xd = 0x0000000000000000L;
11228: } else {
11229: xf = 0x00000000;
11230: xd = 0x0000000000000000L;
11231: }
11232: } else {
11233: if (roundingMode == EPB_MODE_RM) {
11234: xf = 0x80000001;
11235: xd = 0x0000000000000000L;
11236: } else {
11237: xf = 0x80000000;
11238: xd = 0x0000000000000000L;
11239: }
11240: }
11241: break xfxd;
11242: }
11243: if (16383 < xe) {
11244: if (true) {
11245: epbFpsr |= EPB_FPSR_OF;
11246: if (xc << 16 != 0L) {
11247: epbFpsr |= EPB_FPSR_X2;
11248: }
11249: } else {
11250: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11251: }
11252: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11253: epbExceptionOperandMantissa = xd;
11254: if (0 <= xf) {
11255: if (roundingMode == EPB_MODE_RM) {
11256: xf = 0x7ffeffff;
11257: xd = 0xffffffffffffffffL;
11258: } else {
11259: xf = 0x7fff0000;
11260: xd = 0x0000000000000000L;
11261: }
11262: } else {
11263: if (roundingMode == EPB_MODE_RP) {
11264: xf = 0xfffeffff;
11265: xd = 0xffffffffffffffffL;
11266: } else {
11267: xf = 0xffff0000;
11268: xd = 0x0000000000000000L;
11269: }
11270: }
11271: break xfxd;
11272: }
11273: long xb = 0L;
11274: long xa = 0L;
11275: int o = xe <= -16384 ? 48 + -16383 - xe : 48;
11276: if (o < 64) {
11277: xb = xc << -o;
11278: xc = xd << -o | xc >>> o;
11279: xd >>>= o;
11280: } else if (o == 64) {
11281: xb = xc;
11282: xc = xd;
11283: xd = 0L;
11284: } else if (o < 128) {
11285: xa = xc << -o;
11286: xb = xd << -o | xc >>> o;
11287: xc = xd >>> o;
11288: xd = 0L;
11289: } else {
11290: xa = xc;
11291: xb = xd;
11292: xc = 0L;
11293: xd = 0L;
11294: }
11295: if ((xb | xa) != 0L) {
11296: epbFpsr |= EPB_FPSR_X2;
11297: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1 | xa) != 0L ||
11298: roundingMode == EPB_MODE_RM && xf < 0 ||
11299: roundingMode == EPB_MODE_RP && 0 <= xf) {
11300: xc++;
11301: if (xc == 0L) {
11302: xd++;
11303: if (xd >>> 16 != 0L) {
11304:
11305: xe++;
11306: if (16383 < xe) {
11307: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
11308: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
11309: epbExceptionOperandMantissa = xd;
11310: if (0 <= xf) {
11311: if (roundingMode == EPB_MODE_RM) {
11312: xf = 0x7ffeffff;
11313: xd = 0xffffffffffffffffL;
11314: } else {
11315: xf = 0x7fff0000;
11316: xd = 0x0000000000000000L;
11317: }
11318: } else {
11319: if (roundingMode == EPB_MODE_RP) {
11320: xf = 0xfffeffff;
11321: xd = 0xffffffffffffffffL;
11322: } else {
11323: xf = 0xffff0000;
11324: xd = 0x0000000000000000L;
11325: }
11326: }
11327: break xfxd;
11328: }
11329: } else if (48 < o) {
11330: if (xd << o - 1 < 0L) {
11331: xe++;
11332:
11333:
11334:
11335:
11336:
11337:
11338:
11339:
11340: }
11341: }
11342: }
11343: }
11344:
11345: if (xe <= -16384) {
11346: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
11347: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11348: epbExceptionOperandMantissa = xd;
11349: if ((xd | xc) == 0L) {
11350: if (0 <= xf) {
11351: if (roundingMode == EPB_MODE_RP) {
11352: xf = 0x00000001;
11353: xd = 0x0000000000000000L;
11354: } else {
11355: xf = 0x00000000;
11356: xd = 0x0000000000000000L;
11357: }
11358: } else {
11359: if (roundingMode == EPB_MODE_RM) {
11360: xf = 0x80000001;
11361: xd = 0x0000000000000000L;
11362: } else {
11363: xf = 0x80000000;
11364: xd = 0x0000000000000000L;
11365: }
11366: }
11367: break xfxd;
11368: }
11369: }
11370: } else {
11371: if (xe <= -16384) {
11372: epbFpsr |= EPB_FPSR_UF;
11373: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
11374: epbExceptionOperandMantissa = xd;
11375: if ((xd | xc) == 0L) {
11376: if (0 <= xf) {
11377: if (roundingMode == EPB_MODE_RP) {
11378: xf = 0x00000001;
11379: xd = 0x0000000000000000L;
11380: } else {
11381: xf = 0x00000000;
11382: xd = 0x0000000000000000L;
11383: }
11384: } else {
11385: if (roundingMode == EPB_MODE_RM) {
11386: xf = 0x80000001;
11387: xd = 0x0000000000000000L;
11388: } else {
11389: xf = 0x80000000;
11390: xd = 0x0000000000000000L;
11391: }
11392: }
11393: break xfxd;
11394: }
11395: }
11396: }
11397: xd = xd << 48 | xc >>> -48;
11398: xc <<= 48;
11399: xf |= Math.max (0, 16383 + xe) << 16;
11400: }
11401:
11402: b[a ] = (byte) (xf >> 24);
11403: b[a + 1] = (byte) (xf >> 16);
11404: xf = (int) (xc >>> 48);
11405: b[a + 2] = (byte) (xf >> 8);
11406: b[a + 3] = (byte) xf;
11407: xf = (int) (xd >>> 32);
11408: b[a + 4] = (byte) (xf >> 24);
11409: b[a + 5] = (byte) (xf >> 16);
11410: b[a + 6] = (byte) (xf >> 8);
11411: b[a + 7] = (byte) xf;
11412: xf = (int) xd;
11413: b[a + 8] = (byte) (xf >> 24);
11414: b[a + 9] = (byte) (xf >> 16);
11415: b[a + 10] = (byte) (xf >> 8);
11416: b[a + 11] = (byte) xf;
11417: return;
11418: }
11419: public int gety0 () {
11420: byte[] b = new byte[12];
11421: this.gety012 (b, 0, EPB_MODE_RN);
11422: return b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
11423: }
11424: public int gety0 (int roundingMode) {
11425: byte[] b = new byte[12];
11426: this.gety012 (b, 0, roundingMode);
11427: return b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
11428: }
11429: public long gety12 () {
11430: byte[] b = new byte[12];
11431: this.gety012 (b, 0, EPB_MODE_RN);
11432: return ((long) (b[4] << 24 | (b[5] & 255) << 16 | (char) (b[ 6] << 8 | b[ 7] & 255)) << 32 |
11433: (long) (b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255)) & 0xffffffffL);
11434: }
11435: public long gety12 (int roundingMode) {
11436: byte[] b = new byte[12];
11437: this.gety012 (b, 0, roundingMode);
11438: return ((long) (b[4] << 24 | (b[5] & 255) << 16 | (char) (b[ 6] << 8 | b[ 7] & 255)) << 32 |
11439: (long) (b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255)) & 0xffffffffL);
11440: }
11441:
11442:
11443:
11444:
11445:
11446:
11447:
11448:
11449:
11450:
11451:
11452: public boolean gt (EFP y) {
11453: int xf = this.flg;
11454: int yf = y.flg;
11455: if ((xf | yf) << 1 != 0) {
11456: return EFP_GT_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
11457: }
11458:
11459: if (xf != yf) {
11460: return xf > yf;
11461: }
11462:
11463: int s;
11464: long t;
11465: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
11466: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
11467: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
11468: 0) > 0;
11469: }
11470:
11471:
11472:
11473:
11474:
11475:
11476:
11477:
11478: public int hashCode () {
11479: return (this.flg ^
11480: this.epp ^
11481: (int) (this.dvl >> 32) ^
11482: (int) this.dvl ^
11483: (int) (this.cvl >> 32));
11484: }
11485:
11486:
11487:
11488:
11489:
11490:
11491:
11492:
11493:
11494:
11495:
11496:
11497:
11498:
11499:
11500:
11501:
11502: public final EFP ieeerem (EFP y) {
11503: return this.ieeerem (this, y);
11504: }
11505: public final EFP ieeerem (EFP x, EFP y) {
11506: int xf = x.flg;
11507: int yf = y.flg;
11508: epbFpsr &= 0xff00ffff;
11509: if ((xf | yf) << 1 != 0) {
11510: if ((xf | yf) << 3 < 0) {
11511: this.flg = N;
11512: } else if (xf << 2 < 0 ||
11513: yf << 1 < 0) {
11514:
11515: epbFpsr |= EPB_FPSR_OE;
11516: if (yf << 1 < 0) {
11517: epbExceptionOperandExponent = yf & M;
11518: epbExceptionOperandMantissa = 0x0000000000000000L;
11519: } else if (yf << 2 < 0) {
11520: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
11521: epbExceptionOperandMantissa = 0x0000000000000000L;
11522: } else {
11523: epbExceptionOperandExponent = yf & M | 0x3fff + y.epp << 16;
11524: epbExceptionOperandMantissa = y.dvl;
11525: }
11526: this.flg = N;
11527: } else if (xf << 1 < 0) {
11528: epbFpsr |= ((xf ^ yf) & M) >>> 8;
11529: this.flg = xf;
11530: } else {
11531: epbFpsr |= ((xf ^ yf) & M) >>> 8;
11532: this.finish (xf, x.epp, x.dvl, x.cvl, 0L);
11533: }
11534: return this;
11535: }
11536:
11537: epbFpsr |= ((xf ^ yf) & M) >>> 8;
11538: if (false) {
11539: this.inner ();
11540:
11541: EFP q = new EFP ().quo (x, y);
11542: int qi = q.geti32abs ();
11543: EFP w = new EFP ();
11544: this.imulw (w, q, y).negsub (x).sub (w);
11545: int k = w.imul2 (this).cmpabs (y);
11546: if (k > 0 || k == 0 && (qi & 1) != 0) {
11547: qi++;
11548: if ((xf ^ yf) >= 0) {
11549: this.sub (y);
11550: } else {
11551: this.iadd (y);
11552: }
11553: }
11554: epbQuotient = qi;
11555: epbFpsr |= (qi & 127) << 16;
11556: if (this.flg << 1 < 0) {
11557: this.flg = xf | Z;
11558: }
11559: return this.outer ().finish ();
11560: } else {
11561: this.inner ();
11562: int ye = y.epp;
11563: long yd = y.dvl;
11564: long yc = y.cvl;
11565: long yc1 = yc >>> 1;
11566: this.epp = x.epp;
11567: this.dvl = x.dvl;
11568: this.cvl = x.cvl;
11569: int i;
11570: long l;
11571: int q = 0;
11572: if ((i = this.epp - ye) > 0 ||
11573: i == 0 && ((l = this.dvl - yd) > 0L ||
11574: l == 0L && this.cvl >>> 1 >= yc1)) {
11575: this.flg = P;
11576: EFP t = new EFP (P, 0, yd, yc);
11577: do {
11578: t.epp = i = (l = this.dvl - yd) > 0L || l == 0L && this.cvl >>> 1 >= yc1 ? this.epp : this.epp - 1;
11579: if ((i -= ye) <= 31) {
11580: q |= 1 << i;
11581: }
11582: this.sub (t);
11583: } while (this.flg == 0 &&
11584: ((i = this.epp - ye) > 0 ||
11585: i == 0 && ((l = this.dvl - yd) > 0L ||
11586: l == 0L && this.cvl >>> 1 >= yc1)));
11587: this.flg |= xf;
11588: } else {
11589: this.flg = xf;
11590: }
11591: if (this.flg << 1 >= 0) {
11592: if ((i = this.epp - ye + 1) > 0 ||
11593: i == 0 && ((l = this.dvl - yd) > 0L ||
11594: l == 0L && ((l = (this.cvl >>> 1) - yc1) > 0L ||
11595: l == 0L && (q & 1) != 0))) {
11596: this.sub (new EFP (this.flg, ye, yd, yc));
11597: q++;
11598: }
11599: if ((short) this.epp != this.epp) {
11600: this.outer ();
11601: epbFpsr |= EPB_FPSR_UF;
11602: epbExceptionOperandExponent = this.flg & M;
11603: epbExceptionOperandMantissa = this.dvl;
11604: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
11605: }
11606: }
11607: epbQuotient = q;
11608: epbFpsr |= (q & 127) << 16;
11609: return this.outer ().finish ();
11610: }
11611: }
11612:
11613:
11614:
11615:
11616:
11617:
11618:
11619:
11620:
11621:
11622:
11623:
11624:
11625:
11626:
11627:
11628:
11629:
11630:
11631:
11632:
11633:
11634:
11635:
11636:
11637:
11638:
11639:
11640:
11641:
11642:
11643:
11644:
11645:
11646:
11647:
11648:
11649:
11650:
11651:
11652:
11653:
11654:
11655: public int ieeerempi2 () {
11656: return this.ieeerempi2 (this);
11657: }
11658: public int ieeerempi2 (EFP x) {
11659: int xf = x.flg;
11660: if (xf << 1 != 0) {
11661: this.flg = xf;
11662: return 0;
11663: }
11664:
11665: int xe = x.epp;
11666: long xd = x.dvl;
11667: long xc = x.cvl;
11668: int o;
11669: long t;
11670: if ((o = xe + 1) < 0 || o == 0 && ((t = xd - 0xc90fdaa22168c234L) < 0L ||
11671: t == 0L && xc >>> 1 <= 0xc4c6629L >>> 1)) {
11672: this.flg = xf;
11673: this.epp = xe;
11674: this.dvl = xd;
11675: this.cvl = xc;
11676: return 0;
11677: }
11678: if ((o = xe - 1) < 0 || o == 0 && ((t = xd - 0x96cbe3f9990e91a7L) < 0L ||
11679: t == 0L && xc >>> 1 <= 0x9394c9fL >>> 1)) {
11680: if (xf >= 0) {
11681: this.inner ().sub (x, PI_2).outer ().sub (PI_2A);
11682: return 1;
11683: } else {
11684: this.inner ().iadd (x, PI_2).outer ().add (PI_2A);
11685: return 3;
11686: }
11687: }
11688:
11689:
11690: long x0 = xd >>> -30;
11691: long x1 = xd >>> 3 & 0x7fffffffL;
11692: long x2 = (xd << 28 | xc >>> -28) & 0x7fffffffL;
11693:
11694:
11695: o = xe * 16913 >>> 19;
11696: long y0 = TWO_PI_ARRAY[o ];
11697: long y1 = TWO_PI_ARRAY[o + 1];
11698: long y2 = TWO_PI_ARRAY[o + 2];
11699: long y3 = TWO_PI_ARRAY[o + 3];
11700: long y4 = TWO_PI_ARRAY[o + 4];
11701: long y5 = TWO_PI_ARRAY[o + 5];
11702: long y6 = TWO_PI_ARRAY[o + 6];
11703: long y7 = TWO_PI_ARRAY[o + 7];
11704: long y8 = TWO_PI_ARRAY[o + 8];
11705:
11706:
11707:
11708:
11709:
11710:
11711:
11712:
11713:
11714:
11715:
11716:
11717:
11718:
11719:
11720:
11721:
11722:
11723:
11724:
11725:
11726:
11727:
11728:
11729:
11730:
11731:
11732:
11733:
11734:
11735:
11736:
11737:
11738: long z3 = (x2 * y8 >>> 31) + x1 * y8 + x2 * y7;
11739: long z2 = (z3 >>> 31) + x0 * y8 + x1 * y7 + x2 * y6;
11740: z3 = (z3 & 0x7fffffffL) + (z2 << 33 >>> 2) << 2;
11741: z2 = (z2 >>> 31) + x0 * y7 + x1 * y6 + x2 * y5;
11742: long z1 = (z2 >>> 31) + x0 * y6 + x1 * y5 + x2 * y4;
11743: z2 = (z2 & 0x7fffffffL) + (z1 << 33 >>> 2) << 2;
11744: z1 = (z1 >>> 31) + x0 * y5 + x1 * y4 + x2 * y3;
11745: long z0 = (z1 >>> 31) + x0 * y4 + x1 * y3 + x2 * y2;
11746: z1 = (z1 & 0x7fffffffL) + (z0 << 33 >>> 2) << 2;
11747: z0 = (z0 >>> 31) + x0 * y3 + x1 * y2 + x2 * y1 + (x0 * y2 + x1 * y1 + x2 * y0 << 31) << 2;
11748:
11749: z0 |= z1 >>> -2;
11750: z1 = z1 << 2 | z2 >>> -4;
11751: z2 = z2 << 4 | z3 >>> -6;
11752: z3 <<= 6;
11753:
11754: o = xe - o * 31;
11755: if (o != 0) {
11756: z0 = z0 << o | z1 >>> -o;
11757: z1 = z1 << o | z2 >>> -o;
11758: z2 = z2 << o | z3 >>> -o;
11759: z3 <<= o;
11760: }
11761:
11762: o = (int) (z0 >>> -2);
11763: if (xf < 0) {
11764: o = -o;
11765: }
11766:
11767: z0 = z0 << 2 | z1 >>> -2;
11768: z1 = z1 << 2 | z2 >>> -2;
11769: z2 = z2 << 2 | z3 >>> -2;
11770: z3 <<= 2;
11771:
11772:
11773: if (z0 < 0L) {
11774: o = xf >= 0 ? o + 1 : o - 1;
11775: t = z3 = -z3;
11776: t |= z2 = t == 0L ? -z2 : ~z2;
11777: t |= z1 = t == 0L ? -z1 : ~z1;
11778: z0 = t == 0L ? -z0 : ~z0;
11779: xf ^= M;
11780: }
11781: o &= 3;
11782:
11783: if (z0 < 0L) {
11784: xe = -1;
11785: } else if (z0 != 0L) {
11786: xe = Long.numberOfLeadingZeros (z0);
11787: z0 = z0 << xe | z1 >>> -xe;
11788: z1 = z1 << xe | z2 >>> -xe;
11789: z2 = z2 << xe | z3 >>> -xe;
11790: z3 <<= xe;
11791: xe = ~xe;
11792: } else if (z1 < 0L) {
11793: xe = -65;
11794: z0 = z1;
11795: z1 = z2;
11796: z2 = z3;
11797: z3 = 0L;
11798: } else if (z1 != 0L) {
11799: xe = Long.numberOfLeadingZeros (z1) + 64;
11800: z0 = z1 << xe | z2 >>> -xe;
11801: z1 = z2 << xe | z3 >>> -xe;
11802: z2 = z3 << xe;
11803: z3 = 0L;
11804: xe = ~xe;
11805: } else if (z2 < 0L) {
11806: xe = -129;
11807: z0 = z2;
11808: z1 = z3;
11809: z2 = 0L;
11810: z3 = 0L;
11811: } else if (z2 != 0L) {
11812: xe = Long.numberOfLeadingZeros (z2) + 128;
11813: z0 = z2 << xe | z3 >>> -xe;
11814: z1 = z3 << xe;
11815: z2 = 0L;
11816: z3 = 0L;
11817: xe = ~xe;
11818: } else if (z3 != 0L) {
11819: xe = Long.numberOfLeadingZeros (z3) + 192;
11820: z0 = z3 << xe;
11821: z1 = 0L;
11822: z2 = 0L;
11823: z3 = 0L;
11824: xe = ~xe;
11825: } else {
11826: this.flg = xf | Z;
11827: return o;
11828: }
11829:
11830: this.ifinish (xf, xe, z0, z1, z2 | z3);
11831:
11832: this.mul (PI_2);
11833:
11834: return o;
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:
11862:
11863:
11864:
11865:
11866:
11867:
11868:
11869:
11870:
11871:
11872:
11873:
11874:
11875:
11876:
11877:
11878:
11879:
11880:
11881:
11882:
11883:
11884:
11885:
11886:
11887:
11888:
11889: public final EFP inc () {
11890: return this.inc (this);
11891: }
11892: public final EFP inc (EFP x) {
11893:
11894:
11895: int xf = x.flg;
11896: if (xf << 1 != 0) {
11897: if (xf << 1 < 0) {
11898: this.flg = P;
11899: this.epp = 0;
11900: this.dvl = MSB;
11901: this.cvl = 0L;
11902: } else {
11903: this.flg = xf;
11904: }
11905: return this;
11906: }
11907:
11908: int xe = x.epp;
11909: if (xe < -LEN) {
11910:
11911: epbFpsr |= EPB_FPSR_X2;
11912: this.flg = P;
11913: this.epp = 0;
11914: this.dvl = MSB;
11915: this.cvl = 0L;
11916: return this;
11917: }
11918: long xd = x.dvl;
11919: long xc = x.cvl;
11920: if (LEN < xe) {
11921:
11922: epbFpsr |= EPB_FPSR_X2;
11923: return this.finish (xf, xe, xd, xc, 0L);
11924: }
11925: long xb = 0L;
11926: if (xe == 0) {
11927:
11928: if (xf < 0) {
11929:
11930: xd -= MSB;
11931: } else {
11932:
11933: xb = xc << -1;
11934: xc = xd << -1 | xc >>> 1;
11935: xd = (xd >>> 1) + (MSB >>> 1);
11936: xe++;
11937: }
11938: } else if (0 < xe) {
11939:
11940: if (xf < 0) {
11941:
11942: if (xe <= 63) {
11943: xd -= MSB >>> xe;
11944: } else {
11945: if (xc >>> ~xe != 0L) {
11946: xc -= MSB >>> xe;
11947: } else {
11948: xc |= MSB >> xe;
11949: xd--;
11950: }
11951: }
11952: } else {
11953:
11954: if (xe <= 63) {
11955: if ((xd += MSB >>> xe) >>> ~xe == 0L) {
11956: xb = xc << -1;
11957: xc = xd << -1 | xc >>> 1;
11958: xd = MSB | xd >>> 1;
11959: xe++;
11960: }
11961: } else {
11962: if ((xc += MSB >>> xe) >>> ~xe == 0L && ++xd == 0L) {
11963: xb = xc << -1;
11964: xc = xc >>> 1;
11965: xd = MSB;
11966: xe++;
11967: }
11968: }
11969: }
11970: } else {
11971:
11972: if (-63 <= xe) {
11973: xb = xc << xe;
11974: xc = xd << xe | xc >>> -xe;
11975: xd >>>= -xe;
11976: } else if (-64 == xe) {
11977: xb = xc;
11978: xc = xd;
11979: xd = 0L;
11980: } else {
11981: xb = xd << xe | xc >>> -xe;
11982: xc = xd >>> -xe;
11983: xd = 0L;
11984: }
11985: xe = 0;
11986: if (xf < 0) {
11987:
11988: if (xb != 0L) {
11989: xb = -xb;
11990: xc = -1L - xc;
11991: xd = MSB - 1L - xd;
11992: } else if (xc != 0L) {
11993: xc = -xc;
11994: xd = MSB - 1L - xd;
11995: } else {
11996: xd = MSB - xd;
11997: }
11998: xf ^= M;
11999: } else {
12000:
12001: xd |= MSB;
12002: }
12003: }
12004:
12005: if (xd >= 0L) {
12006: if (xd != 0L) {
12007: int o = Long.numberOfLeadingZeros (xd);
12008: xe -= o;
12009: xd = xd << o | xc >>> -o;
12010: xc = xc << o | xb >>> -o;
12011: xb <<= o;
12012: } else if (xc < 0L) {
12013: xe -= 64;
12014: xd = xc;
12015: xc = xb;
12016: xb = 0L;
12017: } else if (xc != 0L) {
12018: int o = 64 + Long.numberOfLeadingZeros (xc);
12019: xe -= o;
12020: xd = xc << o | xb >>> -o;
12021: xc = xb << o;
12022: xb = 0L;
12023: } else if (xb < 0L) {
12024: xe -= 128;
12025: xd = xb;
12026: xc = 0L;
12027: xb = 0L;
12028: } else if (xb != 0L) {
12029: int o = 128 + Long.numberOfLeadingZeros (xb);
12030: xe -= o;
12031: xd = xb << o;
12032: xc = 0L;
12033: xb = 0L;
12034: } else {
12035: this.flg = P | Z;
12036: return this;
12037: }
12038: }
12039: return this.finish (xf, xe, xd, xc, xb);
12040: }
12041:
12042:
12043:
12044:
12045:
12046:
12047:
12048:
12049:
12050: public boolean iseven () {
12051: int xf = this.flg;
12052: int xe = this.epp;
12053: return (xf << 1 != 0 ? xf << 3 >= 0 :
12054: xe < 0 ? false :
12055: xe > LEN - 1 ? true :
12056: xe <= 63 ? this.dvl << xe == 0L && this.cvl == 0L : this.cvl << xe == 0L);
12057: }
12058:
12059:
12060:
12061:
12062:
12063: public boolean isinf () {
12064: return this.flg << 2 < 0;
12065: }
12066:
12067:
12068:
12069:
12070:
12071:
12072:
12073:
12074:
12075: public boolean isint () {
12076: int xf = this.flg;
12077: int xe = this.epp;
12078: return (xf << 1 != 0 ? xf << 3 >= 0 :
12079: xe < 0 ? false :
12080: xe >= LEN - 1 ? true :
12081: xe <= 63 ? this.dvl << 1 << xe == 0L && this.cvl == 0L : this.cvl << xe == 0L);
12082: }
12083:
12084:
12085:
12086:
12087:
12088: public boolean isnan () {
12089: return this.flg << 3 < 0;
12090: }
12091:
12092:
12093:
12094:
12095:
12096:
12097:
12098:
12099:
12100: public boolean isodd () {
12101: int xf = this.flg;
12102: int xe = this.epp;
12103: return (xf << 1 != 0 ? false :
12104: xe < 0 ? false :
12105: xe > LEN - 1 ? false :
12106: xe <= 63 ? this.dvl << xe == MSB && this.cvl == 0L : this.cvl << xe == MSB);
12107: }
12108:
12109:
12110:
12111:
12112:
12113: public boolean isone () {
12114: return (this.flg == P &&
12115: this.epp == 0 &&
12116: this.dvl == MSB &&
12117: this.cvl == 0L);
12118: }
12119:
12120:
12121:
12122:
12123:
12124: public boolean iszero () {
12125: return this.flg << 1 < 0;
12126: }
12127:
12128:
12129:
12130:
12131:
12132:
12133:
12134:
12135:
12136:
12137:
12138: public boolean le (EFP y) {
12139: int xf = this.flg;
12140: int yf = y.flg;
12141: if ((xf | yf) << 1 != 0) {
12142: return EFP_LE_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
12143: }
12144:
12145: if (xf != yf) {
12146: return xf < yf;
12147: }
12148:
12149: int s;
12150: long t;
12151: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
12152: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
12153: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
12154: 0) <= 0;
12155: }
12156:
12157:
12158:
12159:
12160:
12161:
12162:
12163:
12164:
12165:
12166:
12167:
12168:
12169:
12170:
12171:
12172:
12173:
12174:
12175:
12176:
12177:
12178:
12179:
12180:
12181:
12182:
12183:
12184:
12185:
12186:
12187:
12188:
12189:
12190:
12191:
12192:
12193:
12194:
12195:
12196:
12197:
12198:
12199:
12200:
12201:
12202:
12203:
12204:
12205:
12206:
12207:
12208:
12209:
12210:
12211:
12212:
12213:
12214:
12215:
12216:
12217:
12218:
12219:
12220:
12221:
12222:
12223:
12224:
12225:
12226:
12227:
12228:
12229:
12230:
12231:
12232:
12233:
12234:
12235:
12236:
12237:
12238:
12239:
12240:
12241:
12242:
12243:
12244:
12245:
12246:
12247:
12248:
12249:
12250:
12251:
12252:
12253:
12254:
12255:
12256:
12257:
12258:
12259:
12260:
12261:
12262:
12263:
12264:
12265:
12266:
12267:
12268:
12269:
12270:
12271:
12272:
12273:
12274:
12275:
12276:
12277:
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: public final EFP log () {
12429: return this.log (this);
12430: }
12431: public final EFP log (EFP x) {
12432: int xf = x.flg;
12433: if (xf != 0) {
12434: if (xf << 3 < 0) {
12435: this.flg = N;
12436: } else if (xf << 1 < 0) {
12437: epbFpsr |= EPB_FPSR_DZ;
12438: epbExceptionOperandExponent = xf & M;
12439: epbExceptionOperandMantissa = 0x0000000000000000L;
12440: this.flg = M | I;
12441: } else if (xf >= 0) {
12442: this.flg = P | I;
12443: } else {
12444: epbFpsr |= EPB_FPSR_OE;
12445: if (xf << 2 < 0) {
12446: epbExceptionOperandExponent = M | 0x7fff << 16;
12447: epbExceptionOperandMantissa = 0x0000000000000000L;
12448: } else {
12449: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12450: epbExceptionOperandMantissa = x.dvl;
12451: }
12452: this.flg = N;
12453: }
12454: return this;
12455: }
12456:
12457: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
12458: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
12459: return this;
12460: }
12461:
12462: this.inner ();
12463: if (true) {
12464:
12465: if ((x.epp == -1 && x.dvl >>> 32 == 0xffffffff00000000L >>> 32) ||
12466: (x.epp == 0 && x.dvl >>> 31 == 0x8000000000000000L >>> 31)) {
12467:
12468:
12469: EFP t = new EFP ().dec (x);
12470: return this.cub (t).div3 ().sub (new EFP ().squ (t).div2 ()).outer ().add (t);
12471: }
12472: }
12473: epbFpsr |= EPB_FPSR_X2;
12474: EFP v = new EFP (x);
12475: v.epp = v.dvl >= 0xb504f333f9de6484L ? -1 : 0;
12476: int k = x.epp - v.epp;
12477: if (true) {
12478: EFP u = new EFP ().dec (v).div (v.inc ());
12479: v.isqu (u);
12480:
12481:
12482:
12483:
12484:
12485:
12486:
12487:
12488:
12489:
12490:
12491:
12492:
12493:
12494:
12495:
12496: this.imul (LOG_C27, v)
12497: .iadd (LOG_C25).imul (v)
12498: .iadd (LOG_C23).imul (v)
12499: .iadd (LOG_C21).imul (v)
12500: .iadd (LOG_C19).imul (v)
12501: .iadd (LOG_C17).imul (v)
12502: .iadd (LOG_C15).imul (v)
12503: .iadd (LOG_C13).imul (v)
12504: .iadd (LOG_C11).imul (v)
12505: .iadd (LOG_C9).imul (v)
12506: .iadd (LOG_C7).imul (v)
12507: .iadd (LOG_C5).imul (v)
12508: .iadd (LOG_C3).imul (v)
12509: .iadd (LOG_C1).imul (u)
12510: .iadd (v.muli (LOG_2, k)).iadd (v.muli (LOG_2A, k));
12511: } else {
12512: EFP vv1 = new EFP ().dec (v);
12513: if (vv1.flg << 1 < 0) {
12514: this.muli (LOG_2, k);
12515: } else {
12516: EFP yy = ZERO;
12517: if (-1023 < vv1.epp) {
12518:
12519: long s = Double.doubleToLongBits (Math.log1p (Double.longBitsToDouble ((long) (vv1.flg | 1023 + vv1.epp << 20) << 32 | vv1.dvl << 1 >>> 12)));
12520: if (s != 0L) {
12521: int sh = (int) (s >>> 32);
12522: yy = new EFP (sh & M, (sh >>> 20 & 2047) - 1023, MSB | s << 12 >>> 1, 0L);
12523: }
12524: }
12525:
12526: vv1.expm1 (yy);
12527:
12528:
12529: v.dec ().sub (vv1);
12530: this.rcp (vv1.inc ()).imul (v).iadd (yy)
12531: .iadd (v.muli (LOG_2, k)).iadd (v.muli (LOG_2A, k));
12532: }
12533: }
12534: return outer ().finish ();
12535: }
12536:
12537:
12538:
12539:
12540:
12541:
12542:
12543:
12544:
12545:
12546:
12547:
12548:
12549:
12550:
12551:
12552:
12553:
12554:
12555:
12556:
12557:
12558:
12559:
12560:
12561:
12562:
12563:
12564:
12565:
12566:
12567:
12568:
12569:
12570:
12571:
12572:
12573:
12574:
12575:
12576:
12577:
12578:
12579:
12580:
12581:
12582:
12583:
12584:
12585:
12586:
12587:
12588:
12589:
12590:
12591:
12592: public final EFP log10 () {
12593: return this.log10 (this);
12594: }
12595: public final EFP log10 (EFP x) {
12596:
12597: int xf = x.flg;
12598: if (xf != 0) {
12599: if (xf << 3 < 0) {
12600: this.flg = N;
12601: } else if (xf << 1 < 0) {
12602: epbFpsr |= EPB_FPSR_DZ;
12603: epbExceptionOperandExponent = xf & M;
12604: epbExceptionOperandMantissa = 0x0000000000000000L;
12605: this.flg = M | I;
12606: } else if (xf >= 0) {
12607: epbExceptionOperandExponent = 0x7fff << 16;
12608: epbExceptionOperandMantissa = 0x0000000000000000L;
12609: this.flg = P | I;
12610: } else {
12611: epbFpsr |= EPB_FPSR_OE;
12612: if (xf << 2 < 0) {
12613: epbExceptionOperandExponent = M | 0x7fff << 16;
12614: epbExceptionOperandMantissa = 0x0000000000000000L;
12615: } else {
12616: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12617: epbExceptionOperandMantissa = x.dvl;
12618: }
12619: this.flg = N;
12620: }
12621: return this;
12622: }
12623:
12624: int xe = x.epp;
12625:
12626: if (xe == 0 && x.dvl == MSB && x.cvl == 0L) {
12627: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
12628: return this;
12629: }
12630:
12631: if (3 <= xe && xe <= 129) {
12632: EFP t = ACCURATE_LOG10_BASE[xe];
12633: if (t != null && x.dvl == t.dvl && x.cvl == t.cvl) {
12634:
12635: epbFpsr |= EPB_FPSR_X2;
12636:
12637:
12638: return this.seti ((xe + 1) * 617 >> 11);
12639: }
12640: }
12641:
12642: this.inner ();
12643: epbFpsr |= EPB_FPSR_X2;
12644: EFP v = new EFP (x);
12645: v.epp = v.dvl >= 0xb504f333f9de6484L ? -1 : 0;
12646: int k = x.epp - v.epp;
12647: EFP u = new EFP ().dec (v).div (v.inc ());
12648: v.isqu (u);
12649: this.imul (LOG10_C27, v)
12650: .iadd (LOG10_C25).imul (v)
12651: .iadd (LOG10_C23).imul (v)
12652: .iadd (LOG10_C21).imul (v)
12653: .iadd (LOG10_C19).imul (v)
12654: .iadd (LOG10_C17).imul (v)
12655: .iadd (LOG10_C15).imul (v)
12656: .iadd (LOG10_C13).imul (v)
12657: .iadd (LOG10_C11).imul (v)
12658: .iadd (LOG10_C9).imul (v)
12659: .iadd (LOG10_C7).imul (v)
12660: .iadd (LOG10_C5).imul (v)
12661: .iadd (LOG10_C3).imul (v)
12662: .iadd (LOG10_C1).imul (u)
12663: .iadd (u.muli (LOG10_2, k));
12664: u.muli (LOG10_2A, k);
12665: return this.outer ().add (u);
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:
12716:
12717:
12718:
12719:
12720:
12721:
12722:
12723:
12724:
12725:
12726:
12727:
12728:
12729:
12730:
12731:
12732:
12733:
12734:
12735:
12736:
12737:
12738:
12739:
12740:
12741:
12742: public final EFP log1p () {
12743: return this.log1p (this);
12744: }
12745: public final EFP log1p (EFP x) {
12746: int xf = x.flg;
12747: if (xf << 1 != 0) {
12748: if (xf << 3 < 0) {
12749: this.flg = N;
12750: } else if (xf << 1 < 0) {
12751: this.flg = xf;
12752: } else if (xf >= 0) {
12753: this.flg = P | I;
12754: } else {
12755: epbFpsr |= EPB_FPSR_OE;
12756: epbExceptionOperandExponent = M | 0x7fff << 16;
12757: epbExceptionOperandMantissa = 0x0000000000000000L;
12758: this.flg = N;
12759: }
12760: return this;
12761: }
12762:
12763: if (xf < 0) {
12764: if (x.epp == 0 && x.dvl == MSB && x.cvl == 0L) {
12765: epbFpsr |= EPB_FPSR_DZ;
12766: epbExceptionOperandExponent = M | 0x3fff << 16;
12767: epbExceptionOperandMantissa = 0x8000000000000000L;
12768: this.flg = M | I;
12769: return this;
12770: } else if (x.epp >= 0) {
12771: epbFpsr |= EPB_FPSR_OE;
12772: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12773: epbExceptionOperandMantissa = x.dvl;
12774: this.flg = N;
12775: return this;
12776: }
12777: }
12778: epbFpsr |= EPB_FPSR_X2;
12779:
12780: if (LOG1P_A.le (x) && x.le (LOG1P_B)) {
12781: int savedFpsr = epbFpsr;
12782: this.inner ();
12783: if (this == x) {
12784: x = new EFP (x);
12785: }
12786: EFP u = new EFP ().iadd (x, TWO).rcpdiv (x);
12787: EFP v = new EFP ().isqu (u);
12788:
12789:
12790:
12791:
12792:
12793:
12794:
12795:
12796:
12797:
12798:
12799:
12800:
12801:
12802:
12803: this.imul (LOG_C27, v)
12804: .iadd (LOG_C25).imul (v)
12805: .iadd (LOG_C23).imul (v)
12806: .iadd (LOG_C21).imul (v)
12807: .iadd (LOG_C19).imul (v)
12808: .iadd (LOG_C17).imul (v)
12809: .iadd (LOG_C15).imul (v)
12810: .iadd (LOG_C13).imul (v)
12811: .iadd (LOG_C11).imul (v)
12812: .iadd (LOG_C9).imul (v)
12813: .iadd (LOG_C7).imul (v)
12814: .iadd (LOG_C5).imul (v)
12815: .iadd (LOG_C3).imul (v)
12816: .iadd (LOG_C1).outer ().mul (u);
12817: return this.originLowerLower (x).correctUnderflow (savedFpsr);
12818: }
12819: return this.inner ().inc (x).outer ().log ();
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:
12866:
12867:
12868:
12869:
12870:
12871:
12872:
12873:
12874:
12875:
12876:
12877:
12878:
12879:
12880:
12881:
12882:
12883:
12884:
12885:
12886:
12887:
12888:
12889:
12890:
12891:
12892:
12893:
12894:
12895:
12896:
12897:
12898:
12899:
12900:
12901:
12902:
12903:
12904:
12905:
12906:
12907:
12908:
12909:
12910:
12911:
12912:
12913:
12914:
12915:
12916:
12917:
12918:
12919:
12920:
12921:
12922:
12923:
12924:
12925:
12926:
12927:
12928:
12929:
12930:
12931:
12932:
12933:
12934: public final EFP log2 () {
12935: return this.log2 (this);
12936: }
12937: public final EFP log2 (EFP x) {
12938:
12939: int xf = x.flg;
12940: if (xf != 0) {
12941: if (xf << 3 < 0) {
12942: this.flg = N;
12943: } else if (xf << 1 < 0) {
12944: epbFpsr |= EPB_FPSR_DZ;
12945: epbExceptionOperandExponent = xf & M;
12946: epbExceptionOperandMantissa = 0x0000000000000000L;
12947: this.flg = M | I;
12948: } else if (xf >= 0) {
12949: this.flg = P | I;
12950: } else {
12951: epbFpsr |= EPB_FPSR_OE;
12952: if (xf << 2 < 0) {
12953: epbExceptionOperandExponent = M | 0x7fff << 16;
12954: epbExceptionOperandMantissa = 0x0000000000000000L;
12955: } else {
12956: epbExceptionOperandExponent = M | 0x3fff + x.epp << 16;
12957: epbExceptionOperandMantissa = x.dvl;
12958: }
12959: this.flg = N;
12960: }
12961: return this;
12962: }
12963:
12964:
12965: if (x.dvl == MSB && x.cvl == 0L) {
12966: if (x.epp == 0) {
12967: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
12968: } else {
12969:
12970: epbFpsr |= EPB_FPSR_X2;
12971: this.seti (x.epp);
12972: }
12973: return this;
12974: }
12975:
12976: this.inner ();
12977: epbFpsr |= EPB_FPSR_X2;
12978: EFP v = new EFP (x);
12979: v.epp = v.dvl >= 0xb504f333f9de6484L ? -1 : 0;
12980: int k = x.epp - v.epp;
12981: EFP u = new EFP ().dec (v).div (v.inc ());
12982: v.isqu (u);
12983: this.imul (LOG2_C27, v)
12984: .iadd (LOG2_C25).imul (v)
12985: .iadd (LOG2_C23).imul (v)
12986: .iadd (LOG2_C21).imul (v)
12987: .iadd (LOG2_C19).imul (v)
12988: .iadd (LOG2_C17).imul (v)
12989: .iadd (LOG2_C15).imul (v)
12990: .iadd (LOG2_C13).imul (v)
12991: .iadd (LOG2_C11).imul (v)
12992: .iadd (LOG2_C9).imul (v)
12993: .iadd (LOG2_C7).imul (v)
12994: .iadd (LOG2_C5).imul (v)
12995: .iadd (LOG2_C3).imul (v)
12996: .iadd (LOG2_C1).imul (u);
12997: u.seti (k);
12998: return this.outer ().add (u);
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:
13058:
13059:
13060:
13061:
13062:
13063:
13064:
13065:
13066:
13067:
13068:
13069:
13070:
13071:
13072:
13073:
13074: public final EFP lgamma () {
13075: return this.lgamma (this);
13076: }
13077: public final EFP lgamma (EFP x) {
13078: int xf = x.flg;
13079: if (xf != 0) {
13080: this.flg = (xf == (P | Z) || xf == (P | I) ? P | I :
13081: N);
13082: return this;
13083: }
13084:
13085: this.inner ();
13086: x = new EFP (x);
13087: EFP d = null;
13088: if (x.lt (THIRTEEN)) {
13089: d = new EFP (ONE);
13090: do {
13091: d.mul (x);
13092: x.inc ();
13093: } while (x.lt (THIRTEEN));
13094: }
13095: EFP t = new EFP ().rcp (x);
13096: EFP t2 = new EFP ().squ (t);
13097: this.mul (LGAMMA_C14, t2)
13098: .add (LGAMMA_C13).mul (t2)
13099: .add (LGAMMA_C12).mul (t2)
13100: .add (LGAMMA_C11).mul (t2)
13101: .add (LGAMMA_C10).mul (t2)
13102: .add (LGAMMA_C9).mul (t2)
13103: .add (LGAMMA_C8).mul (t2)
13104: .add (LGAMMA_C7).mul (t2)
13105: .add (LGAMMA_C6).mul (t2)
13106: .add (LGAMMA_C5).mul (t2)
13107: .add (LGAMMA_C4).mul (t2)
13108: .add (LGAMMA_C3).mul (t2)
13109: .add (LGAMMA_C2).mul (t2)
13110: .add (LGAMMA_C1).mul (t)
13111: .add (LOGTWOPI_2).sub (x);
13112: t.sub (x, ONE_2);
13113: this.add (x.log ().mul (t));
13114: if (d != null) {
13115: this.sub (d.log ());
13116: }
13117: return this.outer ().finish ();
13118: }
13119:
13120:
13121:
13122:
13123:
13124:
13125:
13126:
13127:
13128:
13129:
13130: public boolean lt (EFP y) {
13131: int xf = this.flg;
13132: int yf = y.flg;
13133: if ((xf | yf) << 1 != 0) {
13134: return EFP_LT_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0;
13135: }
13136:
13137: if (xf != yf) {
13138: return xf < yf;
13139: }
13140:
13141: int s;
13142: long t;
13143: return (xf >= 0 ? 1 : -1) * ((s = this.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
13144: (t = this.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
13145: (t = (this.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
13146: 0) < 0;
13147: }
13148:
13149:
13150:
13151:
13152:
13153:
13154:
13155:
13156:
13157:
13158:
13159: public final EFP max (EFP y) {
13160: return this.max (this, y);
13161: }
13162: public final EFP max (EFP x, EFP y) {
13163: if ((x.flg | y.flg) << 3 < 0) {
13164: this.flg = N;
13165: } else if (x.compareTo (y) >= 0) {
13166: this.flg = x.flg;
13167: this.epp = x.epp;
13168: this.dvl = x.dvl;
13169: this.cvl = x.cvl;
13170: } else {
13171: this.flg = y.flg;
13172: this.epp = y.epp;
13173: this.dvl = y.dvl;
13174: this.cvl = y.cvl;
13175: }
13176: return this;
13177: }
13178:
13179:
13180:
13181:
13182:
13183:
13184:
13185:
13186:
13187:
13188:
13189: public final EFP min (EFP y) {
13190: return this.min (this, y);
13191: }
13192: public final EFP min (EFP x, EFP y) {
13193: if ((x.flg | y.flg) << 3 < 0) {
13194: this.flg = N;
13195: } else if (x.compareTo (y) <= 0) {
13196: this.flg = x.flg;
13197: this.epp = x.epp;
13198: this.dvl = x.dvl;
13199: this.cvl = x.cvl;
13200: } else {
13201: this.flg = y.flg;
13202: this.epp = y.epp;
13203: this.dvl = y.dvl;
13204: this.cvl = y.cvl;
13205: }
13206: return this;
13207: }
13208:
13209:
13210:
13211:
13212:
13213:
13214:
13215:
13216:
13217:
13218:
13219:
13220:
13221:
13222:
13223:
13224:
13225:
13226:
13227:
13228:
13229:
13230:
13231:
13232:
13233:
13234:
13235:
13236:
13237:
13238:
13239:
13240:
13241:
13242:
13243:
13244:
13245:
13246:
13247:
13248:
13249:
13250:
13251:
13252:
13253:
13254:
13255:
13256:
13257:
13258:
13259:
13260:
13261:
13262:
13263: public final EFP mul (EFP y) {
13264: int xf = this.flg;
13265: int yf = y.flg;
13266: {
13267: int o;
13268: if ((o = xf | yf) << 1 != 0) {
13269: if (o << 3 < 0) {
13270: this.flg = N;
13271: } else if ((o &= (Z | I)) == (Z | I)) {
13272: epbFpsr |= EPB_FPSR_OE;
13273: if (yf << 1 < 0) {
13274: epbExceptionOperandExponent = yf & M;
13275: epbExceptionOperandMantissa = 0x0000000000000000L;
13276: } else {
13277: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13278: epbExceptionOperandMantissa = 0x0000000000000000L;
13279: }
13280: this.flg = N;
13281: } else {
13282: this.flg = (xf ^ yf) & M | o;
13283: }
13284: return this;
13285: }
13286: }
13287:
13288: int zf = xf ^ yf;
13289:
13290: int ze = this.epp + y.epp;
13291:
13292:
13293:
13294:
13295:
13296:
13297:
13298: long xh = this.dvl;
13299: long yh = y.dvl;
13300: long xl = (xh << -2 | this.cvl >>> 2) >>> -30;
13301:
13302:
13303:
13304: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13305: long xm = xh << 32 >>> -30;
13306:
13307: long ym = yh << 32 >>> -30;
13308: xh >>>= 32;
13309: yh >>>= 32;
13310:
13311:
13312:
13313:
13314:
13315:
13316:
13317:
13318:
13319:
13320:
13321:
13322:
13323:
13324: long zb = xl * yl;
13325: long zc = xl * yh + yl * xh + xm * ym;
13326: long zd = xh * yh;
13327: xl *= ym;
13328: yl *= xm;
13329: xm *= yh;
13330: ym *= xh;
13331: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13332: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13333: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13334: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13335: zb <<= 4;
13336: zc <<= 4;
13337:
13338:
13339: if (zd < 0L) {
13340: ze++;
13341: } else {
13342: zd = zd << 1 | zc >>> -1;
13343: zc <<= 1;
13344: }
13345: return this.finish2 (zf, ze, zd, zc, zb);
13346: }
13347: public final EFP imul (EFP y) {
13348: int xf = this.flg;
13349: int yf = y.flg;
13350: {
13351: int o;
13352: if ((o = xf | yf) << 1 != 0) {
13353: if (o << 3 < 0) {
13354: this.flg = N;
13355: } else if ((o &= (Z | I)) == (Z | I)) {
13356: epbFpsr |= EPB_FPSR_OE;
13357: if (yf << 1 < 0) {
13358: epbExceptionOperandExponent = yf & M;
13359: epbExceptionOperandMantissa = 0x0000000000000000L;
13360: } else {
13361: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13362: epbExceptionOperandMantissa = 0x0000000000000000L;
13363: }
13364: this.flg = N;
13365: } else {
13366: this.flg = (xf ^ yf) & M | o;
13367: }
13368: return this;
13369: }
13370: }
13371:
13372: int zf = xf ^ yf;
13373:
13374: int ze = this.epp + y.epp;
13375:
13376:
13377:
13378:
13379:
13380:
13381:
13382: long xh = this.dvl;
13383: long yh = y.dvl;
13384: long xl = (xh << -2 | this.cvl >>> 2) >>> -30;
13385:
13386:
13387:
13388: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13389: long xm = xh << 32 >>> -30;
13390:
13391: long ym = yh << 32 >>> -30;
13392: xh >>>= 32;
13393: yh >>>= 32;
13394:
13395:
13396:
13397:
13398:
13399:
13400:
13401:
13402:
13403:
13404:
13405:
13406:
13407:
13408: long zb = xl * yl;
13409: long zc = xl * yh + yl * xh + xm * ym;
13410: long zd = xh * yh;
13411: xl *= ym;
13412: yl *= xm;
13413: xm *= yh;
13414: ym *= xh;
13415: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13416: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13417: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13418: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13419: zb <<= 4;
13420: zc <<= 4;
13421:
13422:
13423: if (zd < 0L) {
13424: ze++;
13425: } else {
13426: zd = zd << 1 | zc >>> -1;
13427: zc <<= 1;
13428: }
13429: return this.ifinish (zf, ze, zd, zc, zb);
13430: }
13431: public final EFP mul (EFP x, EFP y) {
13432: int xf = x.flg;
13433: int yf = y.flg;
13434: {
13435: int o;
13436: if ((o = xf | yf) << 1 != 0) {
13437: if (o << 3 < 0) {
13438: this.flg = N;
13439: } else if ((o &= (Z | I)) == (Z | I)) {
13440: epbFpsr |= EPB_FPSR_OE;
13441: if (yf << 1 < 0) {
13442: epbExceptionOperandExponent = yf & M;
13443: epbExceptionOperandMantissa = 0x0000000000000000L;
13444: } else {
13445: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13446: epbExceptionOperandMantissa = 0x0000000000000000L;
13447: }
13448: this.flg = N;
13449: } else {
13450: this.flg = (xf ^ yf) & M | o;
13451: }
13452: return this;
13453: }
13454: }
13455:
13456: int zf = xf ^ yf;
13457:
13458: int ze = x.epp + y.epp;
13459:
13460:
13461:
13462:
13463:
13464:
13465:
13466: long xh = x.dvl;
13467: long yh = y.dvl;
13468: long xl = (xh << -2 | x.cvl >>> 2) >>> -30;
13469:
13470:
13471:
13472: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13473: long xm = xh << 32 >>> -30;
13474:
13475: long ym = yh << 32 >>> -30;
13476: xh >>>= 32;
13477: yh >>>= 32;
13478:
13479:
13480:
13481:
13482:
13483:
13484:
13485:
13486:
13487:
13488:
13489:
13490:
13491:
13492: long zb = xl * yl;
13493: long zc = xl * yh + yl * xh + xm * ym;
13494: long zd = xh * yh;
13495: xl *= ym;
13496: yl *= xm;
13497: xm *= yh;
13498: ym *= xh;
13499: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13500: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13501: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13502: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13503: zb <<= 4;
13504: zc <<= 4;
13505:
13506:
13507: if (zd < 0L) {
13508: ze++;
13509: } else {
13510: zd = zd << 1 | zc >>> -1;
13511: zc <<= 1;
13512: }
13513: return this.finish2 (zf, ze, zd, zc, zb);
13514: }
13515: public final EFP imul (EFP x, EFP y) {
13516: int xf = x.flg;
13517: int yf = y.flg;
13518: {
13519: int o;
13520: if ((o = xf | yf) << 1 != 0) {
13521: if (o << 3 < 0) {
13522: this.flg = N;
13523: } else if ((o &= (Z | I)) == (Z | I)) {
13524: epbFpsr |= EPB_FPSR_OE;
13525: if (yf << 1 < 0) {
13526: epbExceptionOperandExponent = yf & M;
13527: epbExceptionOperandMantissa = 0x0000000000000000L;
13528: } else {
13529: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13530: epbExceptionOperandMantissa = 0x0000000000000000L;
13531: }
13532: this.flg = N;
13533: } else {
13534: this.flg = (xf ^ yf) & M | o;
13535: }
13536: return this;
13537: }
13538: }
13539:
13540: int zf = xf ^ yf;
13541:
13542: int ze = x.epp + y.epp;
13543:
13544:
13545:
13546:
13547:
13548:
13549:
13550: long xh = x.dvl;
13551: long yh = y.dvl;
13552: long xl = (xh << -2 | x.cvl >>> 2) >>> -30;
13553:
13554:
13555:
13556: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13557: long xm = xh << 32 >>> -30;
13558:
13559: long ym = yh << 32 >>> -30;
13560: xh >>>= 32;
13561: yh >>>= 32;
13562:
13563:
13564:
13565:
13566:
13567:
13568:
13569:
13570:
13571:
13572:
13573:
13574:
13575:
13576: long zb = xl * yl;
13577: long zc = xl * yh + yl * xh + xm * ym;
13578: long zd = xh * yh;
13579: xl *= ym;
13580: yl *= xm;
13581: xm *= yh;
13582: ym *= xh;
13583: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13584: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13585: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13586: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13587: zb <<= 4;
13588: zc <<= 4;
13589:
13590:
13591: if (zd < 0L) {
13592: ze++;
13593: } else {
13594: zd = zd << 1 | zc >>> -1;
13595: zc <<= 1;
13596: }
13597: return this.ifinish (zf, ze, zd, zc, zb);
13598: }
13599:
13600:
13601:
13602:
13603:
13604:
13605:
13606:
13607:
13608:
13609:
13610:
13611:
13612:
13613:
13614:
13615:
13616:
13617:
13618:
13619:
13620:
13621:
13622:
13623:
13624:
13625:
13626:
13627:
13628:
13629:
13630:
13631:
13632:
13633:
13634:
13635:
13636:
13637:
13638:
13639:
13640:
13641:
13642:
13643:
13644:
13645:
13646:
13647:
13648:
13649:
13650:
13651:
13652:
13653:
13654:
13655:
13656:
13657:
13658:
13659:
13660:
13661:
13662:
13663:
13664:
13665:
13666:
13667:
13668:
13669:
13670:
13671:
13672:
13673:
13674:
13675:
13676:
13677:
13678:
13679:
13680:
13681:
13682:
13683:
13684:
13685:
13686:
13687:
13688:
13689:
13690:
13691:
13692:
13693: public final EFP mul2 () {
13694: return this.finish (this.flg, this.epp + 1, this.dvl, this.cvl, 0L);
13695: }
13696: public final EFP imul2 () {
13697: this.epp++;
13698: return this;
13699: }
13700: public final EFP mul2 (EFP x) {
13701: return this.finish (x.flg, x.epp + 1, x.dvl, x.cvl, 0L);
13702: }
13703: public final EFP imul2 (EFP x) {
13704: this.flg = x.flg;
13705: this.epp = x.epp + 1;
13706: this.dvl = x.dvl;
13707: this.cvl = x.cvl;
13708: return this;
13709: }
13710:
13711:
13712:
13713:
13714:
13715:
13716:
13717:
13718:
13719:
13720:
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: public final EFP mul3 () {
13764: return this.muli (this, 3);
13765: }
13766: public final EFP mul3 (EFP x) {
13767:
13768: int xf = x.flg;
13769: if (xf << 1 != 0) {
13770: this.flg = xf;
13771: return this;
13772: }
13773:
13774: int ze = x.epp + 1;
13775: long zd = x.dvl;
13776: long zc = x.cvl;
13777: long t = zc;
13778: zc += (zc >>> 1);
13779: zd += (zd >>> 1) + ((zc & ~t) >>> -1);
13780: if (zd >= 0L) {
13781: zc = zd << -1 | zc >>> 1;
13782: zd = MSB | zd >>> 1;
13783: ze++;
13784: }
13785: return this.finish (xf, ze, zd, zc, 0L);
13786: }
13787:
13788:
13789:
13790:
13791:
13792:
13793:
13794:
13795: public final EFP muli (int n) {
13796: return this.muli (this, n);
13797: }
13798: public final EFP muli (EFP x, int n) {
13799:
13800: int xf = x.flg;
13801: if (n == 0) {
13802: this.flg = (xf & (I | N)) != 0 ? N : xf | Z;
13803: return this;
13804: }
13805: if (xf << 1 != 0) {
13806: this.flg = xf << 3 < 0 ? N : xf ^ (n & M);
13807: return this;
13808: }
13809:
13810: int ze = x.epp;
13811: long zd = x.dvl;
13812: long zc = x.cvl;
13813: if (n < 0) {
13814: xf ^= M;
13815: if (n == 0x80000000) {
13816: ze += 31;
13817: if ((short) ze != ze) {
13818: epbFpsr |= EPB_FPSR_OF;
13819: epbExceptionOperandExponent = xf;
13820: epbExceptionOperandMantissa = zd;
13821: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
13822: }
13823: this.flg = xf;
13824: this.epp = ze;
13825: this.dvl = zd;
13826: this.cvl = zc;
13827: return this;
13828: }
13829: n = -n;
13830: }
13831: if (n > 1) {
13832: long y = (long) n;
13833:
13834:
13835:
13836:
13837:
13838:
13839:
13840:
13841:
13842: zc = (zc >>> 32) * y;
13843: long t = (zd & 0xffffffffL) * y + (zc >>> 32);
13844: zc = t << 32 | (zc & 0xffffffffL);
13845: zd = (zd >>> 32) * y + (t >>> 32);
13846:
13847: int o = Long.numberOfLeadingZeros (zd);
13848: ze += 32 - o;
13849: if (o > 0) {
13850: zd = zd << o | zc >>> -o;
13851: zc <<= o;
13852: }
13853: }
13854: return this.finish (xf, ze, zd, zc, 0L);
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:
13887:
13888:
13889:
13890:
13891:
13892:
13893:
13894:
13895:
13896:
13897:
13898:
13899:
13900:
13901:
13902:
13903:
13904:
13905:
13906:
13907:
13908:
13909: public final EFP mulpi () {
13910: return this.mul (this, PI);
13911: }
13912: public final EFP mulpi (EFP x) {
13913: return this.mul (x, PI);
13914: }
13915:
13916:
13917:
13918:
13919:
13920:
13921:
13922:
13923:
13924:
13925:
13926: public final EFP imulw (EFP w, EFP x, EFP y) {
13927: int xf = x.flg;
13928: int yf = y.flg;
13929: {
13930: int o;
13931: if ((o = xf | yf) << 1 != 0) {
13932: if (o << 3 < 0) {
13933: this.flg = N;
13934: } else if ((o &= (Z | I)) == (Z | I)) {
13935: epbFpsr |= EPB_FPSR_OE;
13936: if (yf << 1 < 0) {
13937: epbExceptionOperandExponent = yf & M;
13938: epbExceptionOperandMantissa = 0x0000000000000000L;
13939: } else {
13940: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
13941: epbExceptionOperandMantissa = 0x0000000000000000L;
13942: }
13943: this.flg = N;
13944: } else {
13945: this.flg = (xf ^ yf) & M | o;
13946: }
13947: w.flg = this.flg;
13948: return this;
13949: }
13950: }
13951:
13952: int zf = xf ^ yf;
13953:
13954: int ze = x.epp + y.epp;
13955:
13956:
13957:
13958:
13959:
13960:
13961:
13962: long xh = x.dvl;
13963: long yh = y.dvl;
13964: long xl = (xh << -2 | x.cvl >>> 2) >>> -30;
13965:
13966:
13967:
13968: long yl = (yh << -2 | y.cvl >>> 2) >>> -30;
13969: long xm = xh << 32 >>> -30;
13970:
13971: long ym = yh << 32 >>> -30;
13972: xh >>>= 32;
13973: yh >>>= 32;
13974:
13975:
13976:
13977:
13978:
13979:
13980:
13981:
13982:
13983:
13984:
13985:
13986:
13987:
13988: long zb = xl * yl;
13989: long zc = xl * yh + yl * xh + xm * ym;
13990: long zd = xh * yh;
13991: xl *= ym;
13992: yl *= xm;
13993: xm *= yh;
13994: ym *= xh;
13995: zb += (xl << -30 >>> 4) + (yl << -30 >>> 4);
13996: zc += (xm << -30 >>> 4) + (ym << -30 >>> 4);
13997: zc += (xl >>> 30) + (yl >>> 30) + (zb >>> -4);
13998: zd += (xm >>> 30) + (ym >>> 30) + (zc >>> -4);
13999: zb <<= 4;
14000: zc = zc << 4 | zb >>> -4;
14001: zb <<= 4;
14002:
14003:
14004: if (zd < 0L) {
14005: ze++;
14006: } else {
14007: zd = zd << 1 | zc >>> -1;
14008: zc = zc << 1 | zb >>> -1;
14009: zb <<= 1;
14010: }
14011:
14012:
14013:
14014:
14015:
14016:
14017:
14018:
14019:
14020:
14021: int wf = zf;
14022: int we = ze - LEN;
14023: long wd = zc << LEN - 64 | zb >>> -(LEN - 64);
14024: long wc = zb << LEN - 64;
14025: zc &= -LSB;
14026:
14027:
14028: if (wd < 0L && (zc & LSB | wd << 1 | wc) != 0L) {
14029:
14030: wf ^= M;
14031: wc = -(wc >>> 1);
14032: wd = -wd - (wc >>> -1);
14033: wc <<= 1;
14034:
14035: if ((zc += LSB) == 0L && ++zd == 0L) {
14036: zd = MSB;
14037: ze++;
14038: }
14039: }
14040:
14041: if (wd >= 0L) {
14042: if (wd != 0L) {
14043: int o = Long.numberOfLeadingZeros (wd);
14044: we -= o;
14045: wd = wd << o | wc >>> -o;
14046: wc <<= o;
14047: } else if (wc != 0L) {
14048: int o = Long.numberOfLeadingZeros (wc);
14049: we -= 64 + o;
14050: wd = wc << o;
14051: wc = 0L;
14052: } else {
14053: wf |= Z;
14054: }
14055: }
14056:
14057: if (ze > 32767) {
14058: epbFpsr |= EPB_FPSR_OF;
14059: epbExceptionOperandExponent = zf;
14060: epbExceptionOperandMantissa = zd;
14061: return this.sete (w.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | zf >>> 31]));
14062: } else if (ze < -32768 || wf << 1 >= 0 && we < -32768) {
14063: epbFpsr |= EPB_FPSR_UF;
14064: epbExceptionOperandExponent = zf;
14065: epbExceptionOperandMantissa = zd;
14066: return this.sete (w.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | zf >>> 31]));
14067: } else {
14068: this.flg = zf;
14069: this.epp = ze;
14070: this.dvl = zd;
14071: this.cvl = zc;
14072: w.flg = wf;
14073: w.epp = we;
14074: w.dvl = wd;
14075: w.cvl = wc;
14076: return this;
14077: }
14078: }
14079:
14080:
14081:
14082:
14083:
14084:
14085:
14086:
14087:
14088:
14089:
14090: public boolean ne (EFP y) {
14091: int xf = this.flg;
14092: int yf = y.flg;
14093: return ((xf | yf) << 1 != 0 ?
14094: EFP_NE_TABLE[xf >>> 28] << (yf >>> 28 - 1) < 0
14095: :
14096: xf != yf || this.epp != y.epp || this.dvl != y.dvl || this.cvl != y.cvl);
14097: }
14098:
14099:
14100:
14101:
14102:
14103:
14104:
14105:
14106:
14107:
14108:
14109:
14110:
14111:
14112:
14113:
14114:
14115:
14116:
14117:
14118:
14119:
14120:
14121:
14122:
14123:
14124:
14125:
14126:
14127:
14128:
14129:
14130:
14131:
14132:
14133:
14134:
14135:
14136:
14137:
14138:
14139:
14140:
14141:
14142:
14143:
14144:
14145:
14146:
14147:
14148:
14149:
14150:
14151:
14152:
14153:
14154:
14155:
14156: public final EFP neg () {
14157: return this.finish (0 <= this.flg << 3 ? this.flg ^ M : this.flg, this.epp, this.dvl, this.cvl, 0L);
14158: }
14159: public final EFP ineg () {
14160: if (0 <= this.flg << 3) {
14161: this.flg ^= M;
14162: }
14163: return this;
14164: }
14165: public final EFP neg (boolean b) {
14166: return this.finish (b && 0 <= this.flg << 3 ? this.flg ^ M : this.flg, this.epp, this.dvl, this.cvl, 0L);
14167: }
14168: public final EFP ineg (boolean b) {
14169: if (b && 0 <= this.flg << 3) {
14170: this.flg ^= M;
14171: }
14172: return this;
14173: }
14174: public final EFP neg (EFP x) {
14175: return this.finish (0 <= x.flg << 3 ? x.flg ^ M : x.flg, x.epp, x.dvl, x.cvl, 0L);
14176: }
14177: public final EFP ineg (EFP x) {
14178: this.flg = 0 <= x.flg << 3 ? x.flg ^ M : x.flg;
14179: this.epp = x.epp;
14180: this.dvl = x.dvl;
14181: this.cvl = x.cvl;
14182: return this;
14183: }
14184: public final EFP neg (EFP x, boolean b) {
14185: return this.finish (b && 0 <= x.flg << 3 ? x.flg ^ M : x.flg, x.epp, x.dvl, x.cvl, 0L);
14186: }
14187: public final EFP ineg (EFP x, boolean b) {
14188: this.flg = b && 0 <= x.flg << 3 ? x.flg ^ M : x.flg;
14189: this.epp = x.epp;
14190: this.dvl = x.dvl;
14191: this.cvl = x.cvl;
14192: return this;
14193: }
14194:
14195:
14196:
14197:
14198:
14199:
14200:
14201:
14202:
14203:
14204: public final EFP negdec () {
14205: return this.inner ().dec ().outer ().neg (0 <= this.flg << 1);
14206: }
14207: public final EFP negdec (EFP x) {
14208: return this.inner ().dec (x).outer ().neg (0 <= this.flg << 1);
14209: }
14210:
14211:
14212:
14213:
14214:
14215: public final EFP negset0 () {
14216: this.flg = M | Z;
14217:
14218:
14219:
14220: return this;
14221: }
14222:
14223:
14224:
14225:
14226:
14227: public final EFP negset1 () {
14228: this.flg = M;
14229: this.epp = 0;
14230: this.dvl = MSB;
14231: this.cvl = 0L;
14232: return this;
14233: }
14234:
14235:
14236:
14237:
14238:
14239: public final EFP negsetinf () {
14240: this.flg = M | I;
14241:
14242:
14243:
14244: return this;
14245: }
14246:
14247:
14248:
14249:
14250:
14251:
14252:
14253:
14254:
14255: public final EFP negsub (EFP y) {
14256: int xf = y.flg;
14257: int xe = y.epp;
14258: long xd = y.dvl;
14259: long xc = y.cvl;
14260: long xb = 0L;
14261: int yf = this.flg;
14262: if ((xf | yf) << 1 != 0) {
14263: if ((xf | yf) << 3 < 0) {
14264: this.flg = N;
14265: return this;
14266: }
14267: if ((xf & yf) << 2 < 0 && xf == yf) {
14268: epbFpsr |= EPB_FPSR_OE;
14269: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
14270: epbExceptionOperandMantissa = 0x0000000000000000L;
14271: this.flg = N;
14272: return this;
14273: }
14274: if ((xf & yf) << 1 < 0 && xf == yf) {
14275: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14276: return this;
14277: }
14278: if (xf << 1 < 0 || yf << 2 < 0) {
14279: xf = yf ^ M;
14280: xe = this.epp;
14281: xd = this.dvl;
14282: xc = this.cvl;
14283: }
14284:
14285: } else {
14286:
14287: yf ^= M;
14288: long yd = this.dvl;
14289: long yc = this.cvl;
14290: int o = xe - this.epp;
14291: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
14292:
14293: xf = yf;
14294: xe += o = -o;
14295: xd = yd;
14296: xc = yc;
14297: yf = y.flg;
14298: yd = y.dvl;
14299: yc = y.cvl;
14300: }
14301:
14302:
14303: if (0 < o) {
14304: if (o <= 63) {
14305: xb = yc << -o;
14306: yc = yd << -o | yc >>> o;
14307: yd >>>= o;
14308: } else if (o == 64) {
14309: xb = yc;
14310: yc = yd;
14311: yd = 0L;
14312: } else if (o <= 127) {
14313: xb = yd << -o | yc;
14314: yc = yd >>> o;
14315: yd = 0L;
14316: } else {
14317: xb = yd | yc;
14318: yc = 0L;
14319: yd = 0L;
14320: }
14321: }
14322:
14323: if (xf == yf) {
14324:
14325: xb |= yc << 62;
14326:
14327: xc = xd << 63 | xc >>> 1;
14328: xd >>>= 1;
14329: yc = yd << 63 | yc >>> 1;
14330: yd >>>= 1;
14331:
14332: yc >>>= 1;
14333: xc >>>= 1;
14334:
14335: xc += yc;
14336: xd += yd + (xc >>> 63);
14337:
14338: xc <<= 1;
14339:
14340: if (xd < 0L) {
14341: xe++;
14342: } else {
14343: xd = xd << 1 | xc >>> 63;
14344: xc <<= 1;
14345: }
14346: } else {
14347:
14348: xb |= yc << 63;
14349:
14350: yc >>>= 1;
14351: xc >>>= 1;
14352:
14353:
14354: if (xb != 0L) {
14355: xc--;
14356: }
14357: xc -= yc;
14358: xd -= yd + (xc >>> 63);
14359:
14360: xc <<= 1;
14361:
14362: if (0L <= xd) {
14363: if (xd != 0L) {
14364: xe -= o = Long.numberOfLeadingZeros (xd);
14365: xd = xd << o | xc >>> -o;
14366: xc <<= o;
14367: } else if (xc != 0L) {
14368: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
14369: xd = xc << o;
14370: xc = 0L;
14371: } else {
14372: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14373: }
14374: }
14375: }
14376: }
14377: return this.finish (xf, xe, xd, xc, xb);
14378: }
14379: public final EFP negsub (EFP x, EFP y) {
14380: int xf = y.flg;
14381: int xe = y.epp;
14382: long xd = y.dvl;
14383: long xc = y.cvl;
14384: long xb = 0L;
14385: int yf = x.flg;
14386: if ((xf | yf) << 1 != 0) {
14387: if ((xf | yf) << 3 < 0) {
14388: this.flg = N;
14389: return this;
14390: }
14391: if ((xf & yf) << 2 < 0 && xf == yf) {
14392: epbFpsr |= EPB_FPSR_OE;
14393: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
14394: epbExceptionOperandMantissa = 0x0000000000000000L;
14395: this.flg = N;
14396: return this;
14397: }
14398: if ((xf & yf) << 1 < 0 && xf == yf) {
14399: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14400: return this;
14401: }
14402: if (xf << 1 < 0 || yf << 2 < 0) {
14403: xf = yf ^ M;
14404: xe = x.epp;
14405: xd = x.dvl;
14406: xc = x.cvl;
14407: }
14408:
14409: } else {
14410:
14411: yf ^= M;
14412: long yd = x.dvl;
14413: long yc = x.cvl;
14414: int o = xe - x.epp;
14415: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
14416:
14417: xf = yf;
14418: xe += o = -o;
14419: xd = yd;
14420: xc = yc;
14421: yf = y.flg;
14422: yd = y.dvl;
14423: yc = y.cvl;
14424: }
14425:
14426:
14427: if (0 < o) {
14428: if (o <= 63) {
14429: xb = yc << -o;
14430: yc = yd << -o | yc >>> o;
14431: yd >>>= o;
14432: } else if (o == 64) {
14433: xb = yc;
14434: yc = yd;
14435: yd = 0L;
14436: } else if (o <= 127) {
14437: xb = yd << -o | yc;
14438: yc = yd >>> o;
14439: yd = 0L;
14440: } else {
14441: xb = yd | yc;
14442: yc = 0L;
14443: yd = 0L;
14444: }
14445: }
14446:
14447: if (xf == yf) {
14448:
14449: xb |= yc << 62;
14450:
14451: xc = xd << 63 | xc >>> 1;
14452: xd >>>= 1;
14453: yc = yd << 63 | yc >>> 1;
14454: yd >>>= 1;
14455:
14456: yc >>>= 1;
14457: xc >>>= 1;
14458:
14459: xc += yc;
14460: xd += yd + (xc >>> 63);
14461:
14462: xc <<= 1;
14463:
14464: if (xd < 0L) {
14465: xe++;
14466: } else {
14467: xd = xd << 1 | xc >>> 63;
14468: xc <<= 1;
14469: }
14470: } else {
14471:
14472: xb |= yc << 63;
14473:
14474: yc >>>= 1;
14475: xc >>>= 1;
14476:
14477:
14478: if (xb != 0L) {
14479: xc--;
14480: }
14481: xc -= yc;
14482: xd -= yd + (xc >>> 63);
14483:
14484: xc <<= 1;
14485:
14486: if (0L <= xd) {
14487: if (xd != 0L) {
14488: xe -= o = Long.numberOfLeadingZeros (xd);
14489: xd = xd << o | xc >>> -o;
14490: xc <<= o;
14491: } else if (xc != 0L) {
14492: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
14493: xd = xc << o;
14494: xc = 0L;
14495: } else {
14496: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
14497: }
14498: }
14499: }
14500: }
14501: return this.finish (xf, xe, xd, xc, xb);
14502: }
14503:
14504:
14505:
14506:
14507:
14508:
14509:
14510:
14511:
14512:
14513:
14514:
14515:
14516:
14517:
14518:
14519:
14520:
14521:
14522:
14523:
14524:
14525:
14526:
14527:
14528:
14529:
14530: public final EFP nextdowne () {
14531: return this.nextdowne (this);
14532: }
14533: public final EFP nextdowne (EFP x) {
14534: int xf = x.flg;
14535: int xe = x.epp;
14536: long xd = x.dvl;
14537: long xc = x.cvl;
14538: if (xf << 1 != 0) {
14539: if (xf << 1 < 0) {
14540: xf = M;
14541: xe = -32768;
14542: xd = MSB;
14543: xc = 0L;
14544: } else if (xf == (P | I)) {
14545: xf = P;
14546: xe = 32767;
14547: xd = -1L;
14548: xc = -1L << 128 - LEN;
14549: }
14550:
14551: } else if (xf >= 0) {
14552: if (xc != 0L) {
14553: xc -= 1L << 128 - LEN;
14554: } else if (xd != MSB) {
14555: xc = -1L << 128 - LEN;
14556: xd--;
14557: } else if (xe > -32768) {
14558: xc = -1L << 128 - LEN;
14559: xd = -1L;
14560: xe--;
14561: } else {
14562: epbFpsr |= EPB_FPSR_UF;
14563: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
14564: epbExceptionOperandMantissa = xd;
14565: return this.set0 ();
14566: }
14567: } else {
14568: if (xc != -1L << 128 - LEN) {
14569: xc += (1L << 128 - LEN);
14570: } else if (xd != -1L) {
14571: xc = 0L;
14572: xd++;
14573: } else if (xe < 32767) {
14574: xc = 0L;
14575: xd = MSB;
14576: xe++;
14577: } else {
14578: epbFpsr |= EPB_FPSR_OF;
14579: epbExceptionOperandExponent = xf;
14580: epbExceptionOperandMantissa = xd;
14581: return this.negsetinf ();
14582: }
14583: }
14584: this.flg = xf;
14585: this.epp = xe;
14586: this.dvl = xd;
14587: this.cvl = xc;
14588: return this;
14589: }
14590: public final EFP nextdownd () {
14591: return this.nextdowne (this).roundd (EPB_MODE_RM);
14592: }
14593: public final EFP nextdownd (EFP x) {
14594: return this.nextdowne (x).roundd (EPB_MODE_RM);
14595: }
14596: public final EFP nextdownf () {
14597: return this.nextdowne (this).roundf (EPB_MODE_RM);
14598: }
14599: public final EFP nextdownf (EFP x) {
14600: return this.nextdowne (x).roundf (EPB_MODE_RM);
14601: }
14602: public final EFP nextdowng () {
14603: return this.nextdowne (this).roundg (EPB_MODE_RM);
14604: }
14605: public final EFP nextdowng (EFP x) {
14606: return this.nextdowne (x).roundg (EPB_MODE_RM);
14607: }
14608: public final EFP nextdownx () {
14609: return this.nextdowne (this).roundx (EPB_MODE_RM);
14610: }
14611: public final EFP nextdownx (EFP x) {
14612: return this.nextdowne (x).roundx (EPB_MODE_RM);
14613: }
14614: public final EFP nextdowny () {
14615: return this.nextdowne (this).roundy (EPB_MODE_RM);
14616: }
14617: public final EFP nextdowny (EFP x) {
14618: return this.nextdowne (x).roundy (EPB_MODE_RM);
14619: }
14620: public final EFP nextdown (int prec) {
14621: switch (prec) {
14622: case EPB_PREC_EXD:
14623: return this.nextdowne (this).roundx (EPB_MODE_RM);
14624: case EPB_PREC_SGL:
14625: return this.nextdowne (this).roundf (EPB_MODE_RM);
14626: case EPB_PREC_DBL:
14627: case EPB_PREC_DBL3:
14628: return this.nextdowne (this).roundd (EPB_MODE_RM);
14629: case EPB_PREC_TPL:
14630: return this.nextdowne (this).roundy (EPB_MODE_RM);
14631: case EPB_PREC_XSG:
14632: return this.nextdowne (this).roundg (EPB_MODE_RM);
14633: }
14634: return this.nextdowne (this);
14635: }
14636: public final EFP nextdown (EFP x, int prec) {
14637: switch (prec) {
14638: case EPB_PREC_EXD:
14639: return this.nextdowne (x).roundx (EPB_MODE_RM);
14640: case EPB_PREC_SGL:
14641: return this.nextdowne (x).roundf (EPB_MODE_RM);
14642: case EPB_PREC_DBL:
14643: case EPB_PREC_DBL3:
14644: return this.nextdowne (x).roundd (EPB_MODE_RM);
14645: case EPB_PREC_TPL:
14646: return this.nextdowne (x).roundy (EPB_MODE_RM);
14647: case EPB_PREC_XSG:
14648: return this.nextdowne (x).roundg (EPB_MODE_RM);
14649: }
14650: return this.nextdowne (x);
14651: }
14652:
14653:
14654:
14655:
14656:
14657:
14658:
14659:
14660:
14661:
14662:
14663:
14664:
14665:
14666:
14667:
14668:
14669:
14670:
14671:
14672:
14673:
14674:
14675:
14676:
14677:
14678:
14679: public final EFP nextupe () {
14680: return this.nextupe (this);
14681: }
14682: public final EFP nextupe (EFP x) {
14683: int xf = x.flg;
14684: int xe = x.epp;
14685: long xd = x.dvl;
14686: long xc = x.cvl;
14687: if (xf << 1 != 0) {
14688: if (xf << 1 < 0) {
14689: xf = P;
14690: xe = -32768;
14691: xd = MSB;
14692: xc = 0L;
14693: } else if (xf == (M | I)) {
14694: xf = M;
14695: xe = 32767;
14696: xd = -1L;
14697: xc = -1L << 128 - LEN;
14698: }
14699:
14700: } else if (xf >= 0) {
14701: if (xc != -1L << 128 - LEN) {
14702: xc += (1L << 128 - LEN);
14703: } else if (xd != -1L) {
14704: xc = 0L;
14705: xd++;
14706: } else if (xe < 32767) {
14707: xc = 0L;
14708: xd = MSB;
14709: xe++;
14710: } else {
14711: epbFpsr |= EPB_FPSR_OF;
14712: epbExceptionOperandExponent = xf;
14713: epbExceptionOperandMantissa = xd;
14714: return this.setinf ();
14715: }
14716: } else {
14717: if (xc != 0L) {
14718: xc -= 1L << 128 - LEN;
14719: } else if (xd != MSB) {
14720: xc = -1L << 128 - LEN;
14721: xd--;
14722: } else if (xe > -32768) {
14723: xc = -1L << 128 - LEN;
14724: xd = -1L;
14725: xe--;
14726: } else {
14727: epbFpsr |= EPB_FPSR_UF;
14728: epbExceptionOperandExponent = xf;
14729: epbExceptionOperandMantissa = xd;
14730: return this.negset0 ();
14731: }
14732: }
14733: this.flg = xf;
14734: this.epp = xe;
14735: this.dvl = xd;
14736: this.cvl = xc;
14737: return this;
14738: }
14739: public final EFP nextupd () {
14740: return this.nextupe (this).roundd (EPB_MODE_RP);
14741: }
14742: public final EFP nextupd (EFP x) {
14743: return this.nextupe (x).roundd (EPB_MODE_RP);
14744: }
14745: public final EFP nextupf () {
14746: return this.nextupe (this).roundf (EPB_MODE_RP);
14747: }
14748: public final EFP nextupf (EFP x) {
14749: return this.nextupe (x).roundf (EPB_MODE_RP);
14750: }
14751: public final EFP nextupg () {
14752: return this.nextupe (this).roundg (EPB_MODE_RP);
14753: }
14754: public final EFP nextupg (EFP x) {
14755: return this.nextupe (x).roundg (EPB_MODE_RP);
14756: }
14757: public final EFP nextupx () {
14758: return this.nextupe (this).roundx (EPB_MODE_RP);
14759: }
14760: public final EFP nextupx (EFP x) {
14761: return this.nextupe (x).roundx (EPB_MODE_RP);
14762: }
14763: public final EFP nextupy () {
14764: return this.nextupe (this).roundy (EPB_MODE_RP);
14765: }
14766: public final EFP nextupy (EFP x) {
14767: return this.nextupe (x).roundy (EPB_MODE_RP);
14768: }
14769: public final EFP nextup (int prec) {
14770: switch (prec) {
14771: case EPB_PREC_EXD:
14772: return this.nextupe (this).roundx (EPB_MODE_RP);
14773: case EPB_PREC_SGL:
14774: return this.nextupe (this).roundf (EPB_MODE_RP);
14775: case EPB_PREC_DBL:
14776: case EPB_PREC_DBL3:
14777: return this.nextupe (this).roundd (EPB_MODE_RP);
14778: case EPB_PREC_TPL:
14779: return this.nextupe (this).roundy (EPB_MODE_RP);
14780: case EPB_PREC_XSG:
14781: return this.nextupe (this).roundg (EPB_MODE_RP);
14782: }
14783: return this.nextupe (this);
14784: }
14785: public final EFP nextup (EFP x, int prec) {
14786: switch (prec) {
14787: case EPB_PREC_EXD:
14788: return this.nextupe (x).roundx (EPB_MODE_RP);
14789: case EPB_PREC_SGL:
14790: return this.nextupe (x).roundf (EPB_MODE_RP);
14791: case EPB_PREC_DBL:
14792: case EPB_PREC_DBL3:
14793: return this.nextupe (x).roundd (EPB_MODE_RP);
14794: case EPB_PREC_TPL:
14795: return this.nextupe (x).roundy (EPB_MODE_RP);
14796: case EPB_PREC_XSG:
14797: return this.nextupe (x).roundg (EPB_MODE_RP);
14798: }
14799: return this.nextupe (x);
14800: }
14801:
14802:
14803:
14804:
14805:
14806:
14807:
14808:
14809:
14810:
14811:
14812:
14813:
14814: public final EFP parse (String s) {
14815: int i = 0;
14816: int l = s.length ();
14817: char c = i < l ? s.charAt (i++) : '\0';
14818:
14819: int f;
14820: if (c == '-') {
14821: f = M;
14822: c = i < l ? s.charAt (i++) : '\0';
14823: } else {
14824: f = P;
14825: if (c == '+') {
14826: c = i < l ? s.charAt (i++) : '\0';
14827: }
14828: }
14829:
14830: if (i + 1 < l && (c | 0x20) == 'i' && (s.charAt (i) | 0x20) == 'n' && (s.charAt (i + 1) | 0x20) == 'f') {
14831: this.flg = f | I;
14832: return this;
14833: }
14834:
14835: this.inner ();
14836: this.flg = P | Z;
14837: boolean nan = true;
14838:
14839: int r = 10;
14840: if (c == '$') {
14841: c = i < l ? s.charAt (i++) : '\0';
14842: r = 16;
14843: } else if (c == '@') {
14844: c = i < l ? s.charAt (i++) : '\0';
14845: r = 8;
14846: } else if (c == '%') {
14847: c = i < l ? s.charAt (i++) : '\0';
14848: r = 2;
14849: } else if (c == '0') {
14850: nan = false;
14851: c = i < l ? s.charAt (i++) : '\0';
14852: if ((c | 0x20) == 'x') {
14853: c = i < l ? s.charAt (i++) : '\0';
14854: r = 16;
14855: } else if ((c | 0x20) == 'o') {
14856: c = i < l ? s.charAt (i++) : '\0';
14857: r = 8;
14858: } else if ((c | 0x20) == 'b') {
14859: c = i < l ? s.charAt (i++) : '\0';
14860: r = 2;
14861: }
14862: }
14863:
14864: {
14865: int t = Character.digit (c, r);
14866: if (t >= 0) {
14867: nan = false;
14868: do {
14869: this.imul (EFP_DIGIT[r]).iadd (EFP_DIGIT[t]);
14870: c = i < l ? s.charAt (i++) : '\0';
14871: t = Character.digit (c, r);
14872: } while (t >= 0);
14873: }
14874: }
14875:
14876: int o = 0;
14877: if (c == '.') {
14878: c = i < l ? s.charAt (i++) : '\0';
14879: int t = Character.digit (c, r);
14880: if (t >= 0) {
14881: nan = false;
14882: do {
14883: o--;
14884: this.imul (EFP_DIGIT[r]).iadd (EFP_DIGIT[t]);
14885: c = i < l ? s.charAt (i++) : '\0';
14886: t = Character.digit (c, r);
14887: } while (t >= 0);
14888: if (r == 8) {
14889: o *= 3;
14890: } else if (r == 16) {
14891: o <<= 2;
14892: }
14893: }
14894: }
14895:
14896: if (nan) {
14897: this.flg = N;
14898: return this.outer ();
14899: }
14900:
14901: if (this.flg << 1 < 0) {
14902: this.flg = f | Z;
14903: return this.outer ();
14904: }
14905:
14906: if ((c | 0x20) == (r == 10 ? 'e' : 'p')) {
14907: c = i < l ? s.charAt (i++) : '\0';
14908: int m;
14909: if (c == '-') {
14910: m = -1;
14911: c = i < l ? s.charAt (i++) : '\0';
14912: } else {
14913: m = 1;
14914: if (c == '+') {
14915: c = i < l ? s.charAt (i++) : '\0';
14916: }
14917: }
14918: if ('0' <= c && c <= '9') {
14919: int t = 0;
14920: do {
14921: t = t * 10 + (c - '0');
14922: if (t >= 100000000) {
14923: this.outer ();
14924: if (m >= 0) {
14925:
14926: epbFpsr |= EPB_FPSR_OF;
14927: epbExceptionOperandExponent = 0;
14928: epbExceptionOperandMantissa = 0L;
14929: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | f >>> 31]).finish ();
14930: } else {
14931:
14932: epbFpsr |= EPB_FPSR_UF;
14933: epbExceptionOperandExponent = 0;
14934: epbExceptionOperandMantissa = 0L;
14935: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | f >>> 31]).finish ();
14936: }
14937: }
14938: c = i < l ? s.charAt (i++) : '\0';
14939: } while ('0' <= c && c <= '9');
14940: o += m * t;
14941: }
14942: }
14943: if (r != 10) {
14944: this.shl (o);
14945: } else if (o > 0) {
14946:
14947: EFP t = new EFP (ONE);
14948: for (int j = 0, m = o; m != 0; j++, m >>>= 1) {
14949: if ((m & 1) != 0) {
14950: t.imul (EFP_TEN_POWER_P[j]);
14951: }
14952: }
14953: this.imul (t);
14954: } else if (o < 0) {
14955:
14956: EFP t = new EFP (ONE);
14957: for (int j = 0, m = -o; m != 0; j++, m >>>= 1) {
14958: if ((m & 1) != 0) {
14959: t.imul (EFP_TEN_POWER_P[j]);
14960: }
14961: }
14962: this.div (t);
14963: }
14964:
14965: return this.outer ().neg (f < 0);
14966: }
14967:
14968:
14969:
14970:
14971:
14972:
14973:
14974:
14975:
14976:
14977:
14978:
14979:
14980:
14981:
14982:
14983:
14984:
14985:
14986:
14987:
14988:
14989:
14990:
14991: public final EFP pow (EFP y) {
14992: return this.pow (this, y);
14993: }
14994: public final EFP pow (EFP x, EFP y) {
14995: int xf = x.flg;
14996: int yf = y.flg;
14997: if (yf << 1 != 0) {
14998: if (yf << 1 < 0) {
14999: this.flg = P;
15000: this.epp = 0;
15001: this.dvl = MSB;
15002: this.cvl = 0L;
15003: return this;
15004: } else {
15005: int s;
15006: this.flg = (yf << 3 < 0 ||
15007: xf << 3 < 0 ||
15008: (s = x.cmp1abs ()) == 0 ? N :
15009: (s ^ yf) >= 0 ? P | I :
15010: P | Z);
15011: return this;
15012: }
15013: } else if (xf << 1 != 0) {
15014: this.flg = (xf << 3 < 0 ? N :
15015: xf >= 0 ?
15016: (xf << 2 ^ yf) >= 0 ? P | Z :
15017: P | I :
15018:
15019: y.isodd () ?
15020: (xf << 2 ^ yf) >= 0 ? M | Z :
15021: M | I :
15022:
15023:
15024:
15025:
15026: (xf << 2 ^ yf) >= 0 ? P | Z :
15027: P | I);
15028: return this;
15029: } else if (xf < 0) {
15030: this.inner ();
15031: if (y.iseven ()) {
15032: EFP w = new EFP ();
15033: this.imulw (w, new EFP ().ineg (x).log2 (), y);
15034: if (this.epp >= 16) {
15035: this.flg = this.flg >= 0 ? P | I : P | Z;
15036: return this.outer ();
15037: } else {
15038: int k = this.geti ();
15039: return this.frac ().iadd (w).exp2 ().outer ().shl (k);
15040: }
15041: } else if (y.isodd ()) {
15042: EFP w = new EFP ();
15043: this.imulw (w, new EFP ().ineg (x).log2 (), y);
15044: if (this.epp >= 16) {
15045: this.flg = this.flg >= 0 ? M | I : M | Z;
15046: return this.outer ();
15047: } else {
15048: int k = this.geti ();
15049: return this.frac ().iadd (w).exp2 ().shl (k).outer ().neg ();
15050: }
15051: } else {
15052: this.flg = N;
15053: return this.outer ();
15054: }
15055: } else {
15056: this.inner ();
15057: EFP w = new EFP ();
15058: this.imulw (w, new EFP ().log2 (x), y);
15059: if (this.epp >= 16) {
15060: this.flg = this.flg >= 0 ? P | I : P | Z;
15061: return this.outer ();
15062: } else {
15063: int k = this.geti ();
15064: return this.frac ().iadd (w).exp2 ().outer ().shl (k);
15065: }
15066: }
15067: }
15068:
15069:
15070:
15071:
15072:
15073:
15074:
15075:
15076: public final EFP powi (int n) {
15077: return this.powi (this, n);
15078: }
15079: public final EFP powi (EFP x, int n) {
15080: int xf = x.flg;
15081: if (n == 0) {
15082:
15083: this.flg = P;
15084: this.epp = 0;
15085: this.dvl = MSB;
15086: this.cvl = 0L;
15087: return this;
15088: } else if (xf << 1 != 0) {
15089: this.flg = (xf << 3 < 0 ? N :
15090: xf >= 0 ?
15091: (xf << 2 ^ n) >= 0 ? P | Z :
15092: P | I :
15093:
15094: (n & 1) != 0 ?
15095: (xf << 2 ^ n) >= 0 ? M | Z :
15096: M | I :
15097:
15098:
15099:
15100:
15101: (xf << 2 ^ n) >= 0 ? P | Z :
15102: P | I);
15103: return this;
15104: } else {
15105:
15106: int t = n >= 0 ? n : -n;
15107: if (t >>> 16 != 0) {
15108:
15109: int xe = x.epp;
15110: long xd = x.dvl;
15111: if (xe == 0 && xd >>> -16 == 0x8000L ||
15112: xe == -1 && xd >>> -16 == 0xffffL) {
15113: return this.pow (x, new EFP (n));
15114: }
15115: }
15116: this.inner ();
15117: EFP w = new EFP (x);
15118: if ((t & 1) == 0) {
15119:
15120: this.flg = P;
15121: this.epp = 0;
15122: this.dvl = MSB;
15123: this.cvl = 0L;
15124: } else {
15125:
15126: this.flg = xf;
15127: this.epp = x.epp;
15128: this.dvl = x.dvl;
15129: this.cvl = x.cvl;
15130: }
15131: while ((t >>>= 1) != 0) {
15132: w.squ ();
15133: if ((t & 1) != 0) {
15134: this.mul (w);
15135: }
15136: }
15137: if (n < 0) {
15138: this.rcp ();
15139: }
15140: return this.outer ().finish ();
15141: }
15142: }
15143:
15144:
15145:
15146:
15147:
15148:
15149:
15150:
15151: public final EFP quo (EFP y) {
15152: return this.quo (this, y);
15153: }
15154: public final EFP quo (EFP x, EFP y) {
15155: int xf = x.flg;
15156: int yf = y.flg;
15157: if ((xf | yf) << 1 != 0) {
15158: this.flg = ((xf | yf) << 3 != 0 || (xf & yf & (Z | I)) != 0 ? N :
15159: (xf ^ yf) & M | ((xf & Z | yf & I) != 0 ? Z : I));
15160: return this;
15161: }
15162:
15163: int zf = xf ^ yf;
15164: int ze = x.epp - y.epp;
15165: if (ze < 0) {
15166: this.flg = zf | Z;
15167: return this;
15168: }
15169:
15170: long r01 = x.dvl;
15171: long y01 = y.dvl;
15172: long r2 = (r01 << -2 | x.cvl >>> 2) >>> 33;
15173: long y2 = (y01 << -2 | y.cvl >>> 2) >>> 33;
15174: r01 >>>= 2;
15175: y01 >>>= 2;
15176: long y0 = y01 >>> 31;
15177: long y1 = y01 & 0x7fffffffL;
15178:
15179: boolean qq;
15180: if (r01 < y01 || (r01 == y01 && r2 < y2)) {
15181: if (ze == 0) {
15182: this.flg = zf | Z;
15183: return this;
15184: }
15185: qq = false;
15186: } else {
15187: qq = true;
15188: r2 -= y2;
15189: r01 -= y01;
15190: if (r2 < 0L) {
15191: r2 += 0x80000000L;
15192: r01--;
15193: }
15194: }
15195: long q0, q1, q2;
15196:
15197: q0 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
15198: r01 = (r01 - q0 * y0 << 31) + r2 - q0 * y1;
15199: if (r01 < 0L) {
15200: q0--;
15201: r01 += y01;
15202: }
15203: r2 = q0 * y2 + 0x7fffffffL;
15204: r01 -= r2 >> 31;
15205: r2 = ~r2 & 0x7fffffffL;
15206: if (r01 < 0L) {
15207: q0--;
15208: r2 += y2;
15209: r01 += y01 + (r2 >> 31);
15210: r2 &= 0x7fffffffL;
15211: }
15212: if (ze <= 31) {
15213: q0 &= ~0x7fffffffL >> ze;
15214: q1 = q2 = 0L;
15215: } else {
15216:
15217: q1 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
15218: r01 = (r01 - q1 * y0 << 31) + r2 - q1 * y1;
15219: if (r01 < 0L) {
15220: q1--;
15221: r01 += y01;
15222: }
15223: r2 = q1 * y2 + 0x7fffffffL;
15224: r01 -= r2 >> 31;
15225: r2 = ~r2 & 0x7fffffffL;
15226: if (r01 < 0L) {
15227: q1--;
15228: r2 += y2;
15229: r01 += y01 + (r2 >> 31);
15230: r2 &= 0x7fffffffL;
15231: }
15232: if (ze <= 62) {
15233: q1 &= ~0x7fffffffL >> ze - 31;
15234: q2 = 0L;
15235: } else {
15236:
15237: q2 = r01 >> 31 == y0 ? 0x7fffffffL : r01 / y0;
15238: r01 = (r01 - q2 * y0 << 31) + r2 - q2 * y1;
15239: if (r01 < 0L) {
15240: q2--;
15241: r01 += y01;
15242: }
15243: r2 = q2 * y2 + 0x7fffffffL;
15244: r01 -= r2 >> 31;
15245: r2 = ~r2 & 0x7fffffffL;
15246: if (r01 < 0L) {
15247: q2--;
15248:
15249:
15250:
15251: }
15252: if (ze <= 93) {
15253: q2 &= ~0x7fffffffL >> ze - 62;
15254: }
15255: }
15256: }
15257:
15258:
15259: if (qq) {
15260: q0 = MSB | q0 << 32 | q1 << 1 | q2 >>> 30;
15261: q2 <<= -30;
15262: } else {
15263: ze--;
15264: q0 = q0 << -31 | q1 << 2 | q2 >>> 29;
15265: q2 <<= -29;
15266: }
15267: return this.finish (zf, ze, q0, q2, 0L);
15268: }
15269:
15270:
15271:
15272:
15273:
15274:
15275:
15276:
15277:
15278:
15279:
15280:
15281:
15282:
15283:
15284:
15285:
15286:
15287:
15288:
15289:
15290:
15291:
15292:
15293:
15294:
15295:
15296:
15297:
15298:
15299:
15300:
15301:
15302:
15303:
15304:
15305:
15306:
15307:
15308:
15309:
15310:
15311:
15312:
15313:
15314:
15315:
15316:
15317:
15318:
15319:
15320:
15321:
15322: public final EFP rad () {
15323: return this.mul (this, TO_RAD);
15324: }
15325: public final EFP rad (EFP x) {
15326: return this.mul (x, TO_RAD);
15327: }
15328:
15329:
15330:
15331:
15332:
15333:
15334:
15335:
15336:
15337:
15338: public final EFP random () {
15339: int xf = P;
15340: int xe = -1;
15341: long xd = epbRand48 ();
15342: long xc = epbRand48 ();
15343: xd = xd << 16 | xc >>> 32;
15344: xc = xc << 32 & -LSB;
15345: if (xd != 0L) {
15346: int o = Long.numberOfLeadingZeros (xd);
15347: if (o > 0) {
15348: xe -= o;
15349: xd = xd << o | xc >>> -o;
15350: xc <<= o;
15351: }
15352: } else if (xc != 0L) {
15353: int o = Long.numberOfLeadingZeros (xc);
15354: xe -= 64 + o;
15355: xd = xc << o;
15356: xc = 0L;
15357: } else {
15358: xf = P | Z;
15359: }
15360: return this.finish (xf, xe, xd, xc, 0L);
15361: }
15362:
15363:
15364:
15365:
15366:
15367:
15368:
15369:
15370:
15371:
15372:
15373:
15374:
15375:
15376:
15377:
15378:
15379:
15380:
15381:
15382:
15383:
15384:
15385:
15386:
15387:
15388:
15389:
15390:
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: public final EFP rcp () {
15424: return this.div (ONE, this);
15425: }
15426: public final EFP rcp (EFP x) {
15427: if (false) {
15428: return this.div (ONE, x);
15429: } else {
15430: int xf = x.flg;
15431: if (xf << 1 != 0) {
15432: if (xf << 1 < 0) {
15433: epbFpsr |= EPB_FPSR_DZ;
15434: epbExceptionOperandExponent = xf & M;
15435: epbExceptionOperandMantissa = 0x0000000000000000L;
15436: this.flg = xf ^ (Z | I);
15437: } else if (xf << 2 < 0) {
15438: this.flg = xf ^ (Z | I);
15439: } else {
15440: this.flg = N;
15441: }
15442: return this;
15443: }
15444:
15445: this.inner ();
15446: long s = Double.doubleToLongBits (1.0 / Double.longBitsToDouble ((long) 1023 << 52 | x.dvl << 1 >>> 12));
15447: EFP t = new EFP (xf, (int) (s >>> 52) - 1023 - x.epp, MSB | s << 12 >>> 1, 0L);
15448:
15449: this.imul2 (t);
15450: t.isqu ().imul (x);
15451: return this.outer ().sub (t);
15452: }
15453: }
15454:
15455:
15456:
15457:
15458:
15459:
15460:
15461:
15462:
15463: public final EFP rcpdiv (EFP y) {
15464: return this.div (y, this);
15465: }
15466: public final EFP rcpdiv (EFP x, EFP y) {
15467: return this.div (y, x);
15468: }
15469:
15470:
15471:
15472:
15473:
15474:
15475:
15476:
15477:
15478:
15479:
15480:
15481:
15482:
15483:
15484:
15485:
15486:
15487:
15488:
15489:
15490:
15491:
15492:
15493:
15494:
15495:
15496: public final EFP rem (EFP y) {
15497: return this.rem (this, y);
15498: }
15499: public final EFP rem (EFP x, EFP y) {
15500: int xf = x.flg;
15501: int yf = y.flg;
15502: epbFpsr &= 0xff00ffff;
15503: if ((xf | yf) << 1 != 0) {
15504: if ((xf | yf) << 3 < 0) {
15505: this.flg = N;
15506: } else if (xf << 2 < 0 ||
15507: yf << 1 < 0) {
15508:
15509: epbFpsr |= EPB_FPSR_OE;
15510: if (yf << 1 < 0) {
15511: epbExceptionOperandExponent = yf & M;
15512: epbExceptionOperandMantissa = 0x0000000000000000L;
15513: } else if (yf << 2 < 0) {
15514: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
15515: epbExceptionOperandMantissa = 0x0000000000000000L;
15516: } else {
15517: epbExceptionOperandExponent = yf & M | 0x3fff + y.epp << 16;
15518: epbExceptionOperandMantissa = y.dvl;
15519: }
15520: this.flg = N;
15521: } else if (xf << 1 < 0) {
15522: epbFpsr |= ((xf ^ yf) & M) >>> 8;
15523: this.flg = xf;
15524: } else {
15525: epbFpsr |= ((xf ^ yf) & M) >>> 8;
15526: this.finish (xf, x.epp, x.dvl, x.cvl, 0L);
15527: }
15528: return this;
15529: }
15530:
15531: epbFpsr |= ((xf ^ yf) & M) >>> 8;
15532: if (false) {
15533: this.inner ();
15534:
15535: int s;
15536: long t;
15537: if ((s = x.epp - y.epp) < 0 ||
15538: s == 0 && ((t = x.dvl - y.dvl) < 0L ||
15539: t == 0L && (x.cvl >>> 1) - (y.cvl >>> 1) < 0L)) {
15540:
15541: this.flg = xf;
15542: this.epp = x.epp;
15543: this.dvl = x.dvl;
15544: this.cvl = x.cvl;
15545: } else {
15546: EFP xx = x != this ? x : new EFP (x);
15547: EFP yy = y != this ? y : new EFP (y);
15548: this.divrz (xx, yy).trunc ();
15549: epbQuotient = this.geti32abs ();
15550: epbFpsr |= (epbQuotient & 127) << 16;
15551: EFP ww = new EFP ();
15552: this.imulw (ww, this, yy).negsub (xx).sub (ww);
15553: if (this.flg << 1 < 0) {
15554: this.flg = xf | Z;
15555: }
15556: }
15557: return this.outer ().finish ();
15558: } else {
15559: this.inner ();
15560: int ye = y.epp;
15561: long yd = y.dvl;
15562: long yc = y.cvl;
15563: long yc1 = yc >>> 1;
15564: this.epp = x.epp;
15565: this.dvl = x.dvl;
15566: this.cvl = x.cvl;
15567: int i;
15568: long l;
15569: int q = 0;
15570: if ((i = this.epp - ye) > 0 ||
15571: i == 0 && ((l = this.dvl - yd) > 0L ||
15572: l == 0L && this.cvl >>> 1 >= yc1)) {
15573: this.flg = P;
15574: EFP t = new EFP (P, 0, yd, yc);
15575: do {
15576: t.epp = i = (l = this.dvl - yd) > 0L || l == 0L && this.cvl >>> 1 >= yc1 ? this.epp : this.epp - 1;
15577: if ((i -= ye) <= 31) {
15578: q |= 1 << i;
15579: }
15580: this.sub (t);
15581: } while (this.flg == 0 &&
15582: ((i = this.epp - ye) > 0 ||
15583: i == 0 && ((l = this.dvl - yd) > 0L ||
15584: l == 0L && this.cvl >>> 1 >= yc1)));
15585: this.flg |= xf;
15586: } else {
15587: this.flg = xf;
15588: }
15589: epbQuotient = q;
15590: epbFpsr |= (q & 127) << 16;
15591: return this.outer ().finish ();
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:
15620:
15621:
15622:
15623:
15624:
15625:
15626:
15627:
15628:
15629:
15630:
15631:
15632:
15633:
15634:
15635:
15636:
15637:
15638:
15639:
15640:
15641:
15642:
15643:
15644:
15645:
15646:
15647:
15648:
15649:
15650: public final EFP rint () {
15651: return this.rint (this);
15652: }
15653: public final EFP rint (EFP x) {
15654: int xf = x.flg;
15655: if (xf << 1 != 0) {
15656: this.flg = xf;
15657: return this;
15658: }
15659:
15660: int xe = x.epp;
15661: long xd = x.dvl;
15662: long xc = x.cvl;
15663: if (xe < 0) {
15664: epbFpsr |= EPB_FPSR_X2;
15665: if (xe < -1 || xd == MSB && xc == 0L) {
15666: this.flg = xf | Z;
15667: } else {
15668: this.flg = xf;
15669: this.epp = 0;
15670: this.dvl = MSB;
15671: this.cvl = 0L;
15672: }
15673: return this;
15674: }
15675:
15676: long m = MSB >> xe;
15677: if (xe <= 62) {
15678: if ((xd & ~m | xc) != 0L) {
15679: epbFpsr |= EPB_FPSR_X2;
15680: long t = xd;
15681: xd &= m;
15682: if ((t & -(m >> 1)) != 0L && (t & (-m | ~(m >> 1)) | xc) != 0L) {
15683: xd -= m;
15684: if (xd >= 0L) {
15685: xd = MSB;
15686: xe++;
15687: if ((short) xe != xe) {
15688: epbFpsr |= EPB_FPSR_OF;
15689: epbExceptionOperandExponent = xf;
15690: epbExceptionOperandMantissa = xd;
15691: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
15692: }
15693: }
15694: }
15695: xc = 0L;
15696: }
15697: } else if (xe == 63) {
15698: if (xc != 0L) {
15699: epbFpsr |= EPB_FPSR_X2;
15700: if (xc < 0L && (xd << -1 | xc << 1) != 0L) {
15701: xd++;
15702: if (xd >= 0L) {
15703: xd = MSB;
15704: xe++;
15705: if ((short) xe != xe) {
15706: epbFpsr |= EPB_FPSR_OF;
15707: epbExceptionOperandExponent = xf;
15708: epbExceptionOperandMantissa = xd;
15709: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
15710: }
15711: }
15712: }
15713: xc = 0L;
15714: }
15715: } else if (xe <= LEN - 2) {
15716: if ((xc & ~m) != 0L) {
15717: epbFpsr |= EPB_FPSR_X2;
15718: long t = xc;
15719: xc &= m;
15720: if ((t & -(m >> 1)) != 0L && (t & (-m | ~(m >> 1))) != 0L) {
15721: xc -= m;
15722: if ((t ^ xc) < 0L) {
15723: xd++;
15724: if (xd >= 0L) {
15725: xd = MSB;
15726: xe++;
15727: if ((short) xe != xe) {
15728: epbFpsr |= EPB_FPSR_OF;
15729: epbExceptionOperandExponent = xf;
15730: epbExceptionOperandMantissa = xd;
15731: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
15732: }
15733: }
15734: }
15735: }
15736: }
15737: }
15738:
15739: return finish (xf, xe, xd, xc, 0L);
15740: }
15741:
15742:
15743:
15744:
15745:
15746:
15747:
15748:
15749:
15750:
15751: public final EFP round () {
15752: return this.round (this, EPB_MODE_RN);
15753: }
15754: public final EFP round (int roundingMode) {
15755: return this.round (this, roundingMode);
15756: }
15757: public final EFP round (EFP x) {
15758: return this.round (x, EPB_MODE_RN);
15759: }
15760: public final EFP round (EFP x, int roundingMode) {
15761: return (roundingMode == EPB_MODE_RN ? this.rint (x) :
15762: roundingMode == EPB_MODE_RM ? this.floor (x) :
15763: roundingMode == EPB_MODE_RP ? this.ceil (x) :
15764: this.trunc (x));
15765: }
15766:
15767:
15768:
15769:
15770:
15771:
15772:
15773:
15774:
15775:
15776:
15777:
15778: public final EFP roundd () {
15779: return this.roundd (this, EPB_MODE_RN);
15780: }
15781: public final EFP roundd (int roundingMode) {
15782: return this.roundd (this, roundingMode);
15783: }
15784: public final EFP roundd (EFP x) {
15785: return this.roundd (x, EPB_MODE_RN);
15786: }
15787: public final EFP roundd (EFP x, int roundingMode) {
15788: int xf = x.flg;
15789: if (xf << 1 != 0) {
15790: this.flg = xf;
15791: return this;
15792: }
15793:
15794: int xe = x.epp;
15795: long xd = x.dvl;
15796: long xc = x.cvl;
15797: if (xe < -1075) {
15798: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
15799: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
15800: epbExceptionOperandMantissa = xd;
15801: return this.sete (UNFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15802: }
15803: if (1023 < xe) {
15804: if (true) {
15805: epbFpsr |= EPB_FPSR_OF;
15806: if ((xd << 53 | xc) != 0L) {
15807: epbFpsr |= EPB_FPSR_X2;
15808: }
15809: } else {
15810: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
15811: }
15812: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
15813: epbExceptionOperandMantissa = xd;
15814: return this.sete (OVFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15815: }
15816: long xb = 0L;
15817: int o = xe <= -1023 ? 11 + -1022 - xe : 11;
15818: if (o < 64) {
15819: xb = xc << -o;
15820: xc = xd << -o | xc >>> o;
15821: xd >>>= o;
15822: } else {
15823: xb = xc;
15824: xc = xd;
15825: xd = 0L;
15826: }
15827: if ((xc | xb) != 0L) {
15828: epbFpsr |= EPB_FPSR_X2;
15829: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
15830: epbExceptionOperandMantissa = x.dvl;
15831: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
15832: roundingMode == EPB_MODE_RM && xf < 0 ||
15833: roundingMode == EPB_MODE_RP && 0 <= xf) {
15834: xd++;
15835: if (xd >>> 53 != 0L) {
15836: xd = 1L << 52;
15837: xe++;
15838: if (1023 < xe) {
15839: epbFpsr |= EPB_FPSR_OF;
15840: return this.sete (OVFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15841: }
15842: } else if (11 < o) {
15843: if (xd << o - 1 < 0L) {
15844: xe++;
15845:
15846: if (xe == -1022) {
15847:
15848: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
15849: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
15850: epbExceptionOperandMantissa = xd;
15851: }
15852:
15853: }
15854: }
15855: }
15856:
15857: if (xe <= -1023) {
15858: epbFpsr |= EPB_FPSR_UF;
15859: if (xd == 0L) {
15860: return this.sete (UNFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15861: }
15862: }
15863: } else {
15864: if (xe <= -1023) {
15865: epbFpsr |= EPB_FPSR_UF;
15866: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
15867: epbExceptionOperandMantissa = x.dvl;
15868: if (xd == 0L) {
15869: return this.sete (UNFL_RESULTS[EPB_PREC_DBL << 3 | roundingMode << 1 | xf >>> 31]);
15870: }
15871: }
15872: }
15873: xd <<= Long.numberOfLeadingZeros (xd);
15874:
15875: this.flg = xf;
15876: this.epp = xe;
15877: this.dvl = xd;
15878: this.cvl = 0L;
15879: return this;
15880: }
15881:
15882:
15883:
15884:
15885:
15886:
15887:
15888:
15889:
15890:
15891:
15892:
15893: public final EFP roundf () {
15894: return this.roundf (this, EPB_MODE_RN);
15895: }
15896: public final EFP roundf (int roundingMode) {
15897: return this.roundf (this, roundingMode);
15898: }
15899: public final EFP roundf (EFP x) {
15900: return this.roundf (x, EPB_MODE_RN);
15901: }
15902: public final EFP roundf (EFP x, int roundingMode) {
15903: int xf = x.flg;
15904: if (xf << 1 != 0) {
15905: this.flg = xf;
15906: return this;
15907: }
15908:
15909: int xe = x.epp;
15910: long xd = x.dvl;
15911: long xc = x.cvl;
15912: if (xe < -150) {
15913: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
15914: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
15915: epbExceptionOperandMantissa = xd;
15916: return this.sete (UNFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
15917: }
15918: if (127 < xe) {
15919: if (true) {
15920: epbFpsr |= EPB_FPSR_OF;
15921: if ((xd << 24 | xc) != 0L) {
15922: epbFpsr |= EPB_FPSR_X2;
15923: }
15924: } else {
15925: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
15926: }
15927: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
15928: epbExceptionOperandMantissa = xd;
15929: return this.sete (OVFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
15930: }
15931: long xb = 0L;
15932: int o = xe <= -127 ? 40 + -126 - xe : 40;
15933: if (o < 64) {
15934: xb = xc << -o;
15935: xc = xd << -o | xc >>> o;
15936: xd >>>= o;
15937: } else {
15938: xb = xc;
15939: xc = xd;
15940: xd = 0L;
15941: }
15942: if ((xc | xb) != 0L) {
15943: epbFpsr |= EPB_FPSR_X2;
15944: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
15945: epbExceptionOperandMantissa = x.dvl;
15946: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << -1 | xc << 1 | xb) != 0L ||
15947: roundingMode == EPB_MODE_RM && xf < 0 ||
15948: roundingMode == EPB_MODE_RP && 0 <= xf) {
15949: xd++;
15950: if (xd >>> 24 != 0L) {
15951: xd = 1L << 23;
15952: xe++;
15953: if (127 < xe) {
15954: epbFpsr |= EPB_FPSR_OF;
15955: return this.sete (OVFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
15956: }
15957: } else if (40 < o) {
15958: if (xd << o - 1 < 0L) {
15959: xe++;
15960:
15961: if (xe == -126) {
15962:
15963: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
15964: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
15965: epbExceptionOperandMantissa = xd;
15966: }
15967:
15968: }
15969: }
15970: }
15971:
15972: if (xe <= -127) {
15973: epbFpsr |= EPB_FPSR_UF;
15974: if (xd == 0L) {
15975: return this.sete (UNFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
15976: }
15977: }
15978: } else {
15979: if (xe <= -127) {
15980: epbFpsr |= EPB_FPSR_UF;
15981: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
15982: epbExceptionOperandMantissa = x.dvl;
15983: if (xd == 0L) {
15984: return this.sete (UNFL_RESULTS[EPB_PREC_SGL << 3 | roundingMode << 1 | xf >>> 31]);
15985: }
15986: }
15987: }
15988: xd <<= Long.numberOfLeadingZeros (xd);
15989:
15990: this.flg = xf;
15991: this.epp = xe;
15992: this.dvl = xd;
15993: this.cvl = 0L;
15994: return this;
15995: }
15996:
15997:
15998:
15999:
16000:
16001:
16002:
16003:
16004:
16005:
16006:
16007:
16008: public final EFP roundg () {
16009: return this.roundg (this, EPB_MODE_RN);
16010: }
16011: public final EFP roundg (int roundingMode) {
16012: return this.roundg (this, roundingMode);
16013: }
16014: public final EFP roundg (EFP x) {
16015: return this.roundg (x, EPB_MODE_RN);
16016: }
16017: public final EFP roundg (EFP x, int roundingMode) {
16018: int xf = x.flg;
16019: if (xf << 1 != 0) {
16020: this.flg = xf;
16021: return this;
16022: }
16023:
16024: int xe = x.epp;
16025: long xd = x.dvl;
16026: long xc = x.cvl;
16027: if (xe < -16407) {
16028: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16029: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16030: epbExceptionOperandMantissa = xd;
16031: return this.sete (UNFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16032: }
16033: if (16383 < xe) {
16034: if (true) {
16035: epbFpsr |= EPB_FPSR_OF;
16036: if ((xd << 24 | xc) != 0L) {
16037: epbFpsr |= EPB_FPSR_X2;
16038: }
16039: } else {
16040: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16041: }
16042: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16043: epbExceptionOperandMantissa = xd;
16044: return this.sete (OVFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16045: }
16046: long xb = 0L;
16047: int o = xe <= -16384 ? 40 + -16383 - xe : 40;
16048: if (o < 64) {
16049: xb = xc << -o;
16050: xc = xd << -o | xc >>> o;
16051: xd >>>= o;
16052: } else {
16053: xb = xc;
16054: xc = xd;
16055: xd = 0L;
16056: }
16057: if ((xc | xb) != 0L) {
16058: epbFpsr |= EPB_FPSR_X2;
16059: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16060: epbExceptionOperandMantissa = x.dvl;
16061: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << -1 | xc << 1 | xb) != 0L ||
16062: roundingMode == EPB_MODE_RM && xf < 0 ||
16063: roundingMode == EPB_MODE_RP && 0 <= xf) {
16064: xd++;
16065: if (xd >>> 24 != 0L) {
16066: xd = 1L << 23;
16067: xe++;
16068: if (16383 < xe) {
16069: epbFpsr |= EPB_FPSR_OF;
16070: return this.sete (OVFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16071: }
16072: } else if (40 < o) {
16073: if (xd << o - 1 < 0L) {
16074: xe++;
16075:
16076:
16077:
16078:
16079:
16080:
16081:
16082:
16083: }
16084: }
16085: }
16086:
16087: if (xe <= -16384) {
16088: epbFpsr |= EPB_FPSR_UF;
16089: if (xd == 0L) {
16090: return this.sete (UNFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16091: }
16092: }
16093: } else {
16094: if (xe <= -16384) {
16095: epbFpsr |= EPB_FPSR_UF;
16096: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16097: epbExceptionOperandMantissa = x.dvl;
16098: if (xd == 0L) {
16099: return this.sete (UNFL_RESULTS[EPB_PREC_XSG << 3 | roundingMode << 1 | xf >>> 31]);
16100: }
16101: }
16102: }
16103: xd <<= Long.numberOfLeadingZeros (xd);
16104:
16105: this.flg = xf;
16106: this.epp = xe;
16107: this.dvl = xd;
16108: this.cvl = 0L;
16109: return this;
16110: }
16111:
16112:
16113:
16114:
16115:
16116:
16117:
16118:
16119:
16120:
16121:
16122:
16123: public final EFP roundi () {
16124: return this.roundi (this, EPB_MODE_RN);
16125: }
16126: public final EFP roundi (int roundingMode) {
16127: return this.roundi (this, roundingMode);
16128: }
16129: public final EFP roundi (EFP x) {
16130: return this.roundi (x, EPB_MODE_RN);
16131: }
16132: public final EFP roundi (EFP x, int roundingMode) {
16133: return this.seti (x.geti (roundingMode));
16134: }
16135:
16136:
16137:
16138:
16139:
16140:
16141:
16142:
16143:
16144:
16145:
16146:
16147: public final EFP roundl () {
16148: return this.roundl (this, EPB_MODE_RN);
16149: }
16150: public final EFP roundl (int roundingMode) {
16151: return this.roundl (this, roundingMode);
16152: }
16153: public final EFP roundl (EFP x) {
16154: return this.roundl (x, EPB_MODE_RN);
16155: }
16156: public final EFP roundl (EFP x, int roundingMode) {
16157: return this.setl (x.getl (roundingMode));
16158: }
16159:
16160:
16161:
16162:
16163:
16164:
16165:
16166:
16167:
16168: public final EFP roundmand () {
16169: return this.roundmand (this, EPB_MODE_RN);
16170: }
16171: public final EFP roundmand (int roundingMode) {
16172: return this.roundmand (this, roundingMode);
16173: }
16174: public final EFP roundmand (EFP x) {
16175: return this.roundmand (x, EPB_MODE_RN);
16176: }
16177: public final EFP roundmand (EFP x, int roundingMode) {
16178: int xf = x.flg;
16179: if (xf << 1 != 0) {
16180: this.flg = xf;
16181: return this;
16182: }
16183:
16184: int xe = x.epp;
16185: long xd = x.dvl;
16186: long xc = x.cvl;
16187: long xb = 0L;
16188: xb = xc << -11;
16189: xc = xd << -11 | xc >>> 11;
16190: xd >>>= 11;
16191: if ((xc | xb) != 0L) {
16192: epbFpsr |= EPB_FPSR_X2;
16193: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16194: epbExceptionOperandMantissa = x.dvl;
16195: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16196: roundingMode == EPB_MODE_RM && xf < 0 ||
16197: roundingMode == EPB_MODE_RP && 0 <= xf) {
16198: xd++;
16199: if (xd >>> 53 != 0L) {
16200: xd = 1L << 52;
16201: xe++;
16202: }
16203: }
16204:
16205: }
16206: xd <<= 11;
16207:
16208: this.flg = xf;
16209: this.epp = xe;
16210: this.dvl = xd;
16211: this.cvl = 0L;
16212: return this;
16213: }
16214:
16215:
16216:
16217:
16218:
16219:
16220:
16221:
16222:
16223: public final EFP roundmanf () {
16224: return this.roundmanf (this, EPB_MODE_RN);
16225: }
16226: public final EFP roundmanf (int roundingMode) {
16227: return this.roundmanf (this, roundingMode);
16228: }
16229: public final EFP roundmanf (EFP x) {
16230: return this.roundmanf (x, EPB_MODE_RN);
16231: }
16232: public final EFP roundmanf (EFP x, int roundingMode) {
16233: int xf = x.flg;
16234: if (xf << 1 != 0) {
16235: this.flg = xf;
16236: return this;
16237: }
16238:
16239: int xe = x.epp;
16240: long xd = x.dvl;
16241: long xc = x.cvl;
16242: long xb = 0L;
16243: xb = xc << -40;
16244: xc = xd << -40 | xc >>> 40;
16245: xd >>>= 40;
16246: if ((xc | xb) != 0L) {
16247: epbFpsr |= EPB_FPSR_X2;
16248: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16249: epbExceptionOperandMantissa = x.dvl;
16250: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16251: roundingMode == EPB_MODE_RM && xf < 0 ||
16252: roundingMode == EPB_MODE_RP && 0 <= xf) {
16253: xd++;
16254: if (xd >>> 24 != 0L) {
16255: xd = 1L << 23;
16256: xe++;
16257: }
16258: }
16259:
16260: }
16261: xd <<= 40;
16262:
16263: this.flg = xf;
16264: this.epp = xe;
16265: this.dvl = xd;
16266: this.cvl = 0L;
16267: return this;
16268: }
16269:
16270:
16271:
16272:
16273:
16274:
16275:
16276:
16277:
16278: public final EFP roundmanx () {
16279: return this.roundmanx (this, EPB_MODE_RN);
16280: }
16281: public final EFP roundmanx (int roundingMode) {
16282: return this.roundmanx (this, roundingMode);
16283: }
16284: public final EFP roundmanx (EFP x) {
16285: return this.roundmanx (x, EPB_MODE_RN);
16286: }
16287: public final EFP roundmanx (EFP x, int roundingMode) {
16288: int xf = x.flg;
16289: if (xf << 1 != 0) {
16290: this.flg = xf;
16291: return this;
16292: }
16293:
16294: int xe = x.epp;
16295: long xd = x.dvl;
16296: long xc = x.cvl;
16297: long xb = 0L;
16298: if ((xc | xb) != 0L) {
16299: epbFpsr |= EPB_FPSR_X2;
16300: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16301: epbExceptionOperandMantissa = x.dvl;
16302: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16303: roundingMode == EPB_MODE_RM && xf < 0 ||
16304: roundingMode == EPB_MODE_RP && 0 <= xf) {
16305: xd++;
16306: if (xd == 0L) {
16307: xd = MSB;
16308: xe++;
16309: }
16310: }
16311:
16312: }
16313: xd <<= Long.numberOfLeadingZeros (xd);
16314:
16315: this.flg = xf;
16316: this.epp = xe;
16317: this.dvl = xd;
16318: this.cvl = 0L;
16319: return this;
16320: }
16321:
16322:
16323:
16324:
16325:
16326:
16327:
16328:
16329:
16330: public final EFP roundmany () {
16331: return this.roundmany (this, EPB_MODE_RN);
16332: }
16333: public final EFP roundmany (int roundingMode) {
16334: return this.roundmany (this, roundingMode);
16335: }
16336: public final EFP roundmany (EFP x) {
16337: return this.roundmany (x, EPB_MODE_RN);
16338: }
16339: public final EFP roundmany (EFP x, int roundingMode) {
16340: int xf = x.flg;
16341: if (xf << 1 != 0) {
16342: this.flg = xf;
16343: return this;
16344: }
16345:
16346: int xe = x.epp;
16347: long xd = x.dvl;
16348: long xc = x.cvl;
16349: long xb = 0L;
16350: xb = xc << -48;
16351: xc = xd << -48 | xc >>> 48;
16352: xd >>>= 48;
16353: if (xb != 0L) {
16354: epbFpsr |= EPB_FPSR_X2;
16355: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16356: epbExceptionOperandMantissa = x.dvl;
16357: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1) != 0L ||
16358: roundingMode == EPB_MODE_RM && xf < 0 ||
16359: roundingMode == EPB_MODE_RP && 0 <= xf) {
16360: xc++;
16361: if (xc == 0L) {
16362: xd++;
16363: if (xd >>> 16 != 0L) {
16364: xd = 1L << 15;
16365: xe++;
16366: }
16367: }
16368: }
16369:
16370: }
16371: xd = xd << 48 | xc >>> -48;
16372: xc <<= 48;
16373:
16374: this.flg = xf;
16375: this.epp = xe;
16376: this.dvl = xd;
16377: this.cvl = xc;
16378: return this;
16379: }
16380:
16381:
16382:
16383:
16384:
16385:
16386:
16387:
16388:
16389:
16390:
16391:
16392: public final EFP roundx () {
16393: return this.roundx (this, EPB_MODE_RN);
16394: }
16395: public final EFP roundx (int roundingMode) {
16396: return this.roundx (this, roundingMode);
16397: }
16398: public final EFP roundx2 (int roundingMode) {
16399: return this.roundx2 (this, roundingMode);
16400: }
16401: public final EFP roundx (EFP x) {
16402: return this.roundx (x, EPB_MODE_RN);
16403: }
16404: public final EFP roundx (EFP x, int roundingMode) {
16405: int xf = x.flg;
16406: if (xf << 1 != 0) {
16407: this.flg = xf;
16408: return this;
16409: }
16410:
16411: int xe = x.epp;
16412: long xd = x.dvl;
16413: long xc = x.cvl;
16414: if (xe < -16447) {
16415: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16416: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16417: epbExceptionOperandMantissa = xd;
16418: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16419: }
16420: if (16383 < xe) {
16421: if (true) {
16422: epbFpsr |= EPB_FPSR_OF;
16423: if (xc != 0L) {
16424: epbFpsr |= EPB_FPSR_X2;
16425: }
16426: } else {
16427: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16428: }
16429: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16430: epbExceptionOperandMantissa = xd;
16431: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16432: }
16433: long xb = 0L;
16434: int o = xe <= -16384 ? 0 + -16383 - xe : 0;
16435: if (o == 0) {
16436: } else if (o < 64) {
16437: xb = xc << -o;
16438: xc = xd << -o | xc >>> o;
16439: xd >>>= o;
16440: } else {
16441: xb = xc;
16442: xc = xd;
16443: xd = 0L;
16444: }
16445: if ((xc | xb) != 0L) {
16446: epbFpsr |= EPB_FPSR_X2;
16447: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16448: epbExceptionOperandMantissa = x.dvl;
16449: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16450: roundingMode == EPB_MODE_RM && xf < 0 ||
16451: roundingMode == EPB_MODE_RP && 0 <= xf) {
16452: xd++;
16453: if (xd == 0L) {
16454: xd = MSB;
16455: xe++;
16456: if (16383 < xe) {
16457: epbFpsr |= EPB_FPSR_OF;
16458: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16459: }
16460: } else if (0 < o) {
16461: if (xd << o - 1 < 0L) {
16462: xe++;
16463:
16464:
16465:
16466:
16467:
16468:
16469:
16470:
16471: }
16472: }
16473: }
16474:
16475: if (xe <= -16384) {
16476: epbFpsr |= EPB_FPSR_UF;
16477: if (xd == 0L) {
16478: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16479: }
16480: }
16481: } else {
16482: if (xe <= -16384) {
16483: epbFpsr |= EPB_FPSR_UF;
16484: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16485: epbExceptionOperandMantissa = x.dvl;
16486: if (xd == 0L) {
16487: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16488: }
16489: }
16490: }
16491: xd <<= Long.numberOfLeadingZeros (xd);
16492:
16493: this.flg = xf;
16494: this.epp = xe;
16495: this.dvl = xd;
16496: this.cvl = 0L;
16497: return this;
16498: }
16499: public final EFP roundx2 (EFP x, int roundingMode) {
16500: int xf = x.flg;
16501: if (xf << 1 != 0) {
16502: this.flg = xf;
16503: return this;
16504: }
16505:
16506: int xe = x.epp;
16507: long xd = x.dvl;
16508: long xc = x.cvl;
16509: if (xe < -16447) {
16510: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16511: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16512: epbExceptionOperandMantissa = xd;
16513: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16514: }
16515: if (16383 < xe) {
16516: if (true) {
16517: epbFpsr |= EPB_FPSR_OF;
16518: if (xc != 0L) {
16519: epbFpsr |= EPB_FPSR_X2;
16520: }
16521: } else {
16522: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16523: }
16524: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16525: epbExceptionOperandMantissa = xd;
16526: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16527: }
16528: long xb = 0L;
16529: int o = xe <= -16384 ? 0 + -16383 - xe : 0;
16530: if (o == 0) {
16531: } else if (o < 64) {
16532: xb = xc << -o;
16533: xc = xd << -o | xc >>> o;
16534: xd >>>= o;
16535: } else {
16536: xb = xc;
16537: xc = xd;
16538: xd = 0L;
16539: }
16540: if ((xc | xb) != 0L) {
16541: epbFpsr |= EPB_FPSR_X2;
16542: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16543: epbExceptionOperandMantissa = x.dvl;
16544: if (roundingMode == EPB_MODE_RN && xc < 0L && (xd << 63 | xc << 1 | xb) != 0L ||
16545: roundingMode == EPB_MODE_RM && xf < 0 ||
16546: roundingMode == EPB_MODE_RP && 0 <= xf) {
16547: xd++;
16548: if (xd == 0L) {
16549: xd = MSB;
16550: xe++;
16551: if (16383 < xe) {
16552: epbFpsr |= EPB_FPSR_OF;
16553: return this.sete (OVFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16554: }
16555: } else if (0 < o) {
16556: if (xd << o - 1 < 0L) {
16557: xe++;
16558:
16559: if (xe == -16383) {
16560:
16561: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16562: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16563: epbExceptionOperandMantissa = xd;
16564: }
16565:
16566: }
16567: }
16568: }
16569:
16570: if (xe <= -16384) {
16571: epbFpsr |= EPB_FPSR_UF;
16572: if (xd == 0L) {
16573: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16574: }
16575: }
16576: } else {
16577: if (xe <= -16384) {
16578: epbFpsr |= EPB_FPSR_UF;
16579: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16580: epbExceptionOperandMantissa = x.dvl;
16581: if (xd == 0L) {
16582: return this.sete (UNFL_RESULTS[EPB_PREC_EXD << 3 | roundingMode << 1 | xf >>> 31]);
16583: }
16584: }
16585: }
16586: xd <<= Long.numberOfLeadingZeros (xd);
16587:
16588: this.flg = xf;
16589: this.epp = xe;
16590: this.dvl = xd;
16591: this.cvl = 0L;
16592: return this;
16593: }
16594:
16595:
16596:
16597:
16598:
16599:
16600:
16601:
16602:
16603:
16604:
16605:
16606: public final EFP roundy () {
16607: return this.roundy (this, EPB_MODE_RN);
16608: }
16609: public final EFP roundy (int roundingMode) {
16610: return this.roundy (this, roundingMode);
16611: }
16612: public final EFP roundy2 (int roundingMode) {
16613: return this.roundy2 (this, roundingMode);
16614: }
16615: public final EFP roundy (EFP x) {
16616: return this.roundy (x, EPB_MODE_RN);
16617: }
16618: public final EFP roundy (EFP x, int roundingMode) {
16619: int xf = x.flg;
16620: if (xf << 1 != 0) {
16621: this.flg = xf;
16622: return this;
16623: }
16624:
16625: int xe = x.epp;
16626: long xd = x.dvl;
16627: long xc = x.cvl;
16628: if (xe < -16463) {
16629: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16630: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16631: epbExceptionOperandMantissa = xd;
16632: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16633: }
16634: if (16383 < xe) {
16635: if (true) {
16636: epbFpsr |= EPB_FPSR_OF;
16637: if (xc << 16 != 0L) {
16638: epbFpsr |= EPB_FPSR_X2;
16639: }
16640: } else {
16641: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16642: }
16643: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16644: epbExceptionOperandMantissa = xd;
16645: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16646: }
16647: long xb = 0L;
16648: long xa = 0L;
16649: int o = xe <= -16384 ? 48 + -16383 - xe : 48;
16650: if (o < 64) {
16651: xb = xc << -o;
16652: xc = xd << -o | xc >>> o;
16653: xd >>>= o;
16654: } else if (o == 64) {
16655: xb = xc;
16656: xc = xd;
16657: xd = 0L;
16658: } else if (o < 128) {
16659: xa = xc << -o;
16660: xb = xd << -o | xc >>> o;
16661: xc = xd >>> o;
16662: xd = 0L;
16663: } else {
16664: xa = xc;
16665: xb = xd;
16666: xc = 0L;
16667: xd = 0L;
16668: }
16669: if ((xb | xa) != 0L) {
16670: epbFpsr |= EPB_FPSR_X2;
16671: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16672: epbExceptionOperandMantissa = x.dvl;
16673: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1 | xa) != 0L ||
16674: roundingMode == EPB_MODE_RM && xf < 0 ||
16675: roundingMode == EPB_MODE_RP && 0 <= xf) {
16676: xc++;
16677: if (xc == 0L) {
16678: xd++;
16679: if (xd >>> 16 != 0L) {
16680:
16681: xe++;
16682: if (16383 < xe) {
16683: epbFpsr |= EPB_FPSR_OF;
16684: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16685: }
16686: } else if (48 < o) {
16687: if (xd << o - 1 < 0L) {
16688: xe++;
16689:
16690:
16691:
16692:
16693:
16694:
16695:
16696:
16697: }
16698: }
16699: }
16700: }
16701:
16702: if (xe <= -16384) {
16703: epbFpsr |= EPB_FPSR_UF;
16704: if ((xd | xc) == 0L) {
16705: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16706: }
16707: }
16708: } else {
16709: if (xe <= -16384) {
16710: epbFpsr |= EPB_FPSR_UF;
16711: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16712: epbExceptionOperandMantissa = x.dvl;
16713: if ((xd | xc) == 0L) {
16714: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16715: }
16716: }
16717: }
16718: if (xd != 0L) {
16719: o = Long.numberOfLeadingZeros (xd);
16720: xd = xd << o | xc >>> -o;
16721: xc <<= o;
16722: } else {
16723: xd = xc << Long.numberOfLeadingZeros (xc);
16724: xc = 0L;
16725: }
16726:
16727: this.flg = xf;
16728: this.epp = xe;
16729: this.dvl = xd;
16730: this.cvl = xc;
16731: return this;
16732: }
16733: public final EFP roundy2 (EFP x, int roundingMode) {
16734: int xf = x.flg;
16735: if (xf << 1 != 0) {
16736: this.flg = xf;
16737: return this;
16738: }
16739:
16740: int xe = x.epp;
16741: long xd = x.dvl;
16742: long xc = x.cvl;
16743: if (xe < -16463) {
16744: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16745: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16746: epbExceptionOperandMantissa = xd;
16747: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16748: }
16749: if (16383 < xe) {
16750: if (true) {
16751: epbFpsr |= EPB_FPSR_OF;
16752: if (xc << 16 != 0L) {
16753: epbFpsr |= EPB_FPSR_X2;
16754: }
16755: } else {
16756: epbFpsr |= EPB_FPSR_OF | EPB_FPSR_X2;
16757: }
16758: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + xe << 16;
16759: epbExceptionOperandMantissa = xd;
16760: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16761: }
16762: long xb = 0L;
16763: long xa = 0L;
16764: int o = xe <= -16384 ? 48 + -16383 - xe : 48;
16765: if (o < 64) {
16766: xb = xc << -o;
16767: xc = xd << -o | xc >>> o;
16768: xd >>>= o;
16769: } else if (o == 64) {
16770: xb = xc;
16771: xc = xd;
16772: xd = 0L;
16773: } else if (o < 128) {
16774: xa = xc << -o;
16775: xb = xd << -o | xc >>> o;
16776: xc = xd >>> o;
16777: xd = 0L;
16778: } else {
16779: xa = xc;
16780: xb = xd;
16781: xc = 0L;
16782: xd = 0L;
16783: }
16784: if ((xb | xa) != 0L) {
16785: epbFpsr |= EPB_FPSR_X2;
16786: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16787: epbExceptionOperandMantissa = x.dvl;
16788: if (roundingMode == EPB_MODE_RN && xb < 0L && (xc << 63 | xb << 1 | xa) != 0L ||
16789: roundingMode == EPB_MODE_RM && xf < 0 ||
16790: roundingMode == EPB_MODE_RP && 0 <= xf) {
16791: xc++;
16792: if (xc == 0L) {
16793: xd++;
16794: if (xd >>> 16 != 0L) {
16795:
16796: xe++;
16797: if (16383 < xe) {
16798: epbFpsr |= EPB_FPSR_OF;
16799: return this.sete (OVFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16800: }
16801: } else if (48 < o) {
16802: if (xd << o - 1 < 0L) {
16803: xe++;
16804:
16805: if (xe == -16383) {
16806:
16807: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16808: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + xe << 16;
16809: epbExceptionOperandMantissa = xd;
16810: }
16811:
16812: }
16813: }
16814: }
16815: }
16816:
16817: if (xe <= -16384) {
16818: epbFpsr |= EPB_FPSR_UF;
16819: if ((xd | xc) == 0L) {
16820: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16821: }
16822: }
16823: } else {
16824: if (xe <= -16384) {
16825: epbFpsr |= EPB_FPSR_UF;
16826: epbExceptionOperandExponent = x.flg & M | 0x3fff + 0x6000 + x.epp << 16;
16827: epbExceptionOperandMantissa = x.dvl;
16828: if ((xd | xc) == 0L) {
16829: return this.sete (UNFL_RESULTS[EPB_PREC_TPL << 3 | roundingMode << 1 | xf >>> 31]);
16830: }
16831: }
16832: }
16833: if (xd != 0L) {
16834: o = Long.numberOfLeadingZeros (xd);
16835: xd = xd << o | xc >>> -o;
16836: xc <<= o;
16837: } else {
16838: xd = xc << Long.numberOfLeadingZeros (xc);
16839: xc = 0L;
16840: }
16841:
16842: this.flg = xf;
16843: this.epp = xe;
16844: this.dvl = xd;
16845: this.cvl = xc;
16846: return this;
16847: }
16848:
16849:
16850:
16851:
16852:
16853:
16854:
16855:
16856: public final EFP scale (EFP y) {
16857: return this.scale (this, y);
16858: }
16859: public final EFP scale (EFP x, EFP y) {
16860: int xf = x.flg;
16861: int yf = y.flg;
16862: if ((xf | yf) << 1 != 0) {
16863: if ((xf | yf) << 3 < 0) {
16864: this.flg = N;
16865: } else if (yf << 1 < 0) {
16866: this.finish (x.flg, x.epp, x.dvl, x.cvl, 0L);
16867: } else if (yf << 2 < 0) {
16868: epbFpsr |= EPB_FPSR_OE;
16869: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
16870: epbExceptionOperandMantissa = 0x0000000000000000L;
16871: this.flg = N;
16872: } else if (xf << 1 < 0) {
16873: this.flg = xf;
16874: } else if (xf << 2 < 0) {
16875: this.flg = xf;
16876: }
16877: return this;
16878: }
16879:
16880:
16881:
16882: int i = (16 <= y.epp ? yf < 0 ? -1 << 16 : 1 << 16 :
16883: y.geti ());
16884: if (i <= -1 << 14) {
16885: epbFpsr |= EPB_FPSR_UF | EPB_FPSR_X2;
16886: if (i <= -1 << 16) {
16887: epbExceptionOperandExponent = xf;
16888: epbExceptionOperandMantissa = x.dvl;
16889: } else {
16890: epbExceptionOperandExponent = xf | 0x3fff + 0x6000 + i << 16;
16891: epbExceptionOperandMantissa = x.dvl;
16892: }
16893: return this.sete (UNFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
16894: }
16895: if (1 << 14 <= i) {
16896: epbFpsr |= EPB_FPSR_OF;
16897: if (1 << 16 <= i) {
16898: epbExceptionOperandExponent = xf;
16899: epbExceptionOperandMantissa = x.dvl;
16900: } else {
16901: epbExceptionOperandExponent = xf | 0x3fff - 0x6000 + i << 16;
16902: epbExceptionOperandMantissa = x.dvl;
16903: }
16904: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
16905: }
16906: return this.finish2 (xf, x.epp + i, x.dvl, x.cvl, 0L);
16907: }
16908:
16909:
16910:
16911:
16912:
16913:
16914:
16915:
16916:
16917:
16918:
16919:
16920:
16921:
16922:
16923:
16924:
16925:
16926:
16927:
16928:
16929:
16930:
16931:
16932:
16933:
16934:
16935:
16936:
16937:
16938:
16939:
16940:
16941:
16942:
16943:
16944:
16945:
16946:
16947:
16948:
16949:
16950:
16951:
16952:
16953:
16954:
16955:
16956:
16957:
16958:
16959:
16960:
16961:
16962:
16963:
16964: public final EFP sec () {
16965: return this.sec (this);
16966: }
16967: public final EFP sec (EFP x) {
16968: return this.inner ().cos (x).outer ().rcp ();
16969: }
16970:
16971:
16972:
16973:
16974:
16975:
16976:
16977:
16978:
16979:
16980:
16981:
16982:
16983:
16984:
16985:
16986:
16987:
16988:
16989:
16990:
16991:
16992:
16993:
16994:
16995:
16996:
16997:
16998:
16999:
17000:
17001:
17002:
17003:
17004:
17005:
17006:
17007:
17008:
17009:
17010:
17011:
17012:
17013:
17014:
17015:
17016:
17017:
17018:
17019:
17020:
17021:
17022:
17023:
17024:
17025:
17026:
17027:
17028:
17029:
17030: public final EFP sech () {
17031: return this.sech (this);
17032: }
17033: public final EFP sech (EFP x) {
17034: return this.inner ().cosh (x).outer ().rcp ();
17035: }
17036:
17037:
17038:
17039:
17040:
17041: public final EFP set0 () {
17042: this.flg = P | Z;
17043:
17044:
17045:
17046: return this;
17047: }
17048:
17049:
17050:
17051:
17052:
17053: public final EFP set1 () {
17054: this.flg = P;
17055: this.epp = 0;
17056: this.dvl = MSB;
17057: this.cvl = 0L;
17058: return this;
17059: }
17060:
17061:
17062:
17063:
17064:
17065:
17066:
17067:
17068:
17069:
17070:
17071:
17072:
17073:
17074:
17075:
17076:
17077:
17078:
17079:
17080: public final EFP setapery () {
17081: epbFpsr |= EPB_FPSR_X2;
17082: return this.sete (ROUNDED_APERY[epbRoundingMode]).finish ();
17083: }
17084:
17085:
17086:
17087:
17088:
17089:
17090:
17091:
17092:
17093:
17094:
17095:
17096:
17097:
17098:
17099:
17100:
17101:
17102:
17103: public final EFP setcatalan () {
17104: epbFpsr |= EPB_FPSR_X2;
17105: return this.sete (ROUNDED_CATALAN[epbRoundingMode]).finish ();
17106: }
17107:
17108:
17109:
17110:
17111:
17112:
17113:
17114:
17115: public final EFP setd (double d) {
17116: return this.setd01 (Double.doubleToLongBits (d));
17117: }
17118: public final EFP setd01 (byte[] b, int a) {
17119: return this.setd01 ((long) (b[a ] << 24 | (b[a + 1] & 255) << 16 | (char) (b[a + 2] << 8 | b[a + 3] & 255)) << 32 |
17120: (long) (b[a + 4] << 24 | (b[a + 5] & 255) << 16 | (char) (b[a + 6] << 8 | b[a + 7] & 255)) & 0xffffffffL);
17121: }
17122: public final EFP setd01 (long l) {
17123: int zf = (int) (l >>> 32) & M;
17124: int ze = ((int) (l >>> 52) & 0x7ff) - 1023;
17125: long zd = 0L;
17126: l &= -1L >>> 12;
17127: if (ze == 1024) {
17128: if (l == 0L) {
17129: zf |= I;
17130: } else {
17131: if (l << 12 >= 0L) {
17132: epbFpsr |= EPB_FPSR_SN;
17133: epbExceptionOperandExponent = 0x7fff << 16;
17134: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17135: }
17136: zf = N;
17137: }
17138: } else if (ze >= -1022) {
17139: zd = MSB | l << 11;
17140: } else if (l == 0L) {
17141: zf |= Z;
17142: } else {
17143: int o = Long.numberOfLeadingZeros (l);
17144: ze -= o - 12;
17145: zd = l << o;
17146: }
17147: this.flg = zf;
17148: this.epp = ze;
17149: this.dvl = zd;
17150: this.cvl = 0L;
17151:
17152:
17153: return this;
17154: }
17155:
17156:
17157:
17158:
17159:
17160:
17161:
17162:
17163: public final EFP sete (EFP x) {
17164: this.flg = x.flg;
17165: this.epp = x.epp;
17166: this.dvl = x.dvl;
17167: this.cvl = x.cvl;
17168: return this;
17169: }
17170:
17171:
17172:
17173:
17174:
17175:
17176:
17177:
17178:
17179:
17180:
17181:
17182:
17183:
17184:
17185:
17186:
17187:
17188: public final EFP seteuler () {
17189: epbFpsr |= EPB_FPSR_X2;
17190: return this.sete (ROUNDED_EULER[epbRoundingMode]).finish ();
17191: }
17192:
17193:
17194:
17195:
17196:
17197:
17198:
17199:
17200: public final EFP setf (float f) {
17201: return this.setf0 (Float.floatToIntBits (f));
17202: }
17203: public final EFP setf0 (byte[] b, int a) {
17204: return this.setf0 (b[a] << 24 | (b[a + 1] & 255) << 16 | (char) (b[a + 2] << 8 | b[a + 3] & 255));
17205: }
17206: public final EFP setf0 (int i) {
17207: int zf = i & M;
17208: int ze = (i >>> 23 & 0xff) - 127;
17209: long zd = 0L;
17210: i &= -1 >>> 9;
17211: if (ze == 128) {
17212: if (i == 0) {
17213: zf |= I;
17214: } else {
17215: if (i << 9 >= 0) {
17216: epbFpsr |= EPB_FPSR_SN;
17217: epbExceptionOperandExponent = 0x7fff << 16;
17218: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17219: }
17220: zf = N;
17221: }
17222: } else if (ze >= -126) {
17223: zd = (long) (1 << 23 | i) << 32 + 8;
17224: } else if (i == 0) {
17225: zf |= Z;
17226: } else {
17227: int o = Integer.numberOfLeadingZeros (i);
17228: ze -= o - 9;
17229: zd = (long) i << 32 + o;
17230: }
17231: this.flg = zf;
17232: this.epp = ze;
17233: this.dvl = zd;
17234: this.cvl = 0L;
17235:
17236:
17237: return this;
17238: }
17239:
17240:
17241:
17242:
17243:
17244: public final EFP seti (int i) {
17245: if (i == 0) {
17246: this.flg = P | Z;
17247: return this;
17248: }
17249: int zf = P;
17250: if (i < 0) {
17251: zf = M;
17252: i = -i;
17253: }
17254: int ze = 31 - Integer.numberOfLeadingZeros (i);
17255: long zd = (long) i << 63 - ze;
17256: return this.finish (zf, ze, zd, 0L, 0L);
17257: }
17258:
17259:
17260:
17261:
17262:
17263: public final EFP setinf () {
17264: this.flg = P | I;
17265:
17266:
17267:
17268: return this;
17269: }
17270:
17271:
17272:
17273:
17274:
17275: public final EFP setl (long l) {
17276: if (l == 0L) {
17277: this.flg = P | Z;
17278: return this;
17279: }
17280: int zf = P;
17281: if (l < 0L) {
17282: zf = M;
17283: l = -l;
17284: }
17285: int ze = 63 - Long.numberOfLeadingZeros (l);
17286: long zd = l << ~ze;
17287: return this.finish (zf, ze, zd, 0L, 0L);
17288: }
17289:
17290:
17291:
17292:
17293:
17294:
17295:
17296: public final EFP setmax () {
17297: return this.finish (P, 32767, 0xffffffffffffffffL, 0xffffffffffffffffL << 128 - LEN, 0L);
17298: }
17299:
17300:
17301:
17302:
17303:
17304:
17305:
17306: public final EFP setmin () {
17307: return this.finish (M, -32767, MSB, 0L, 0L);
17308: }
17309:
17310:
17311:
17312:
17313:
17314: public final EFP setnan () {
17315: this.flg = N;
17316:
17317:
17318:
17319: return this;
17320: }
17321:
17322:
17323:
17324:
17325:
17326:
17327:
17328:
17329:
17330:
17331:
17332:
17333:
17334:
17335:
17336:
17337:
17338:
17339: public final EFP setnapier () {
17340: epbFpsr |= EPB_FPSR_X2;
17341: return this.sete (ROUNDED_NAPIER[epbRoundingMode]).finish ();
17342: }
17343:
17344:
17345:
17346:
17347:
17348:
17349: public final EFP setp012 (byte[] b, int a) {
17350: return this.setp012 (b[a] << 24 | (b[a + 1] & 255) << 16 | (char) (b[a + 2] << 8 | b[a + 3] & 255),
17351: (long) (b[a + 4] << 24 | (b[a + 5] & 255) << 16 | (char) (b[a + 6] << 8 | b[a + 7] & 255)) << 32 |
17352: (long) (b[a + 8] << 24 | (b[a + 9] & 255) << 16 | (char) (b[a + 10] << 8 | b[a + 11] & 255)) & 0xffffffffL);
17353: }
17354: public final EFP setp012 (int u, long v) {
17355: int zf = u & M;
17356: int e = XEiJ.FMT_DCB4[u >>> 16 & 0xfff];
17357: int m0 = XEiJ.FMT_DCB4[u & 0x000f];
17358: int m1 = XEiJ.FMT_DCB4[(char) (v >>> 48)];
17359: int m2 = XEiJ.FMT_DCB4[(char) (v >>> 32)];
17360: int m3 = XEiJ.FMT_DCB4[(char) (v >>> 16)];
17361: int m4 = XEiJ.FMT_DCB4[(char) v ];
17362: {
17363: int t = m0 | m1 | m2 | m3 | m4;
17364: if ((u & 0x30000000) != 0 ||
17365: (e | t) < 0) {
17366: if (v == 0L) {
17367: this.flg = zf | I;
17368: } else {
17369: if (v << 1 >= 0L) {
17370: epbFpsr |= EPB_FPSR_SN;
17371: epbExceptionOperandExponent = 0x7fff << 16;
17372: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17373: }
17374: this.flg = N;
17375: }
17376: return this;
17377: }
17378: if (t == 0) {
17379: this.flg = zf | Z;
17380: return this;
17381: }
17382: }
17383:
17384:
17385: int savedMode = epbRoundingMode;
17386: int savedFpsr = epbFpsr;
17387: epbFpsr = 0;
17388:
17389: this.inner ();
17390: EFP t = new EFP ();
17391: this.setl ((long) (m0 * 100000000 + m1 * 10000 + m2)).imul (TENXP3).iadd (t.setl ((long) (m3 * 10000 + m4)));
17392:
17393:
17394: this.flg |= zf;
17395:
17396: if (u << 1 < 0) {
17397: e = -e;
17398: }
17399: e -= 16;
17400: if (e < 0) {
17401: e = -e;
17402: t.set1 ();
17403: for (int i = 0; e != 0; i++, e >>>= 1) {
17404: if ((e & 1) != 0) {
17405: t.imul (EFP_TEN_POWER_P[i]);
17406: }
17407: }
17408: epbRoundingPrec = EPB_PREC_EXD;
17409: epbRoundingMode = savedMode;
17410: this.div (t);
17411: } else {
17412: t.set1 ();
17413: for (int i = 0; e != 0; i++, e >>>= 1) {
17414: if ((e & 1) != 0) {
17415: t.imul (EFP_TEN_POWER_P[i]);
17416: }
17417: }
17418: epbRoundingPrec = EPB_PREC_EXD;
17419: epbRoundingMode = savedMode;
17420: this.mul (t);
17421: }
17422: this.outer ();
17423:
17424: epbFpsr = savedFpsr | epbFpsr >>> 1 & EPB_FPSR_X1;
17425:
17426:
17427: return this.finish ();
17428: }
17429:
17430:
17431:
17432:
17433:
17434:
17435:
17436:
17437:
17438:
17439:
17440:
17441:
17442:
17443:
17444:
17445:
17446:
17447:
17448:
17449:
17450:
17451:
17452:
17453:
17454:
17455:
17456:
17457:
17458:
17459:
17460:
17461:
17462:
17463:
17464:
17465:
17466:
17467:
17468:
17469:
17470:
17471:
17472:
17473:
17474:
17475:
17476:
17477:
17478:
17479:
17480:
17481:
17482:
17483:
17484:
17485:
17486:
17487: public final EFP setpi () {
17488: epbFpsr |= EPB_FPSR_X2;
17489: return this.sete (ROUNDED_PI[epbRoundingMode]).finish ();
17490: }
17491:
17492:
17493:
17494:
17495:
17496:
17497:
17498: public final EFP setx012 (byte[] b, int a) {
17499: return this.setx012 (b[a] << 24 | (b[a + 1] & 255) << 16 | (char) (b[a + 2] << 8 | b[a + 3] & 255),
17500: (long) (b[a + 4] << 24 | (b[a + 5] & 255) << 16 | (char) (b[a + 6] << 8 | b[a + 7] & 255)) << 32 |
17501: (long) (b[a + 8] << 24 | (b[a + 9] & 255) << 16 | (char) (b[a + 10] << 8 | b[a + 11] & 255)) & 0xffffffffL);
17502: }
17503: public final EFP setx012 (int i, long l) {
17504: int zf = i & M;
17505: int ze = (i >>> 16 & 32767) - 16383;
17506: if (ze == 16384) {
17507: if (l == 0L) {
17508: this.flg = zf | I;
17509: } else {
17510: if (l << 1 >= 0L) {
17511: epbFpsr |= EPB_FPSR_SN;
17512: epbExceptionOperandExponent = 0x7fff << 16;
17513: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17514: }
17515: this.flg = N;
17516: }
17517: return this;
17518: }
17519: if (l == 0L) {
17520: this.flg = zf | Z;
17521: return this;
17522: }
17523: if (l >= 0L) {
17524: int o = Long.numberOfLeadingZeros (l);
17525: ze -= o;
17526: l <<= o;
17527: }
17528: this.flg = zf;
17529: this.epp = ze;
17530: this.dvl = l;
17531: this.cvl = 0L;
17532:
17533:
17534: return this;
17535: }
17536:
17537:
17538:
17539:
17540:
17541:
17542:
17543: public final EFP sety012 (byte[] b, int a) {
17544: return this.sety012 (b[a] << 24 | (b[a + 1] & 255) << 16 | (char) (b[a + 2] << 8 | b[a + 3] & 255),
17545: (long) (b[a + 4] << 24 | (b[a + 5] & 255) << 16 | (char) (b[a + 6] << 8 | b[a + 7] & 255)) << 32 |
17546: (long) (b[a + 8] << 24 | (b[a + 9] & 255) << 16 | (char) (b[a + 10] << 8 | b[a + 11] & 255)) & 0xffffffffL);
17547: }
17548: public final EFP sety012 (int i, long l) {
17549: int zf = i & M;
17550: int ze = (i >>> 16 & 32767) - 16383;
17551: if (ze == 16384) {
17552: if (l == 0L) {
17553: this.flg = zf | I;
17554: } else {
17555: if (l << 1 >= 0L) {
17556: epbFpsr |= EPB_FPSR_SN;
17557: epbExceptionOperandExponent = 0x7fff << 16;
17558: epbExceptionOperandMantissa = 0xbfffffffffffffffL;
17559: }
17560: this.flg = N;
17561: }
17562: return this;
17563: }
17564: long m = (long) i << 48;
17565: if (l == 0L && m == 0L) {
17566: this.flg = zf | Z;
17567: return this;
17568: }
17569: if (l >= 0L) {
17570: if (l != 0L) {
17571: int o = Long.numberOfLeadingZeros (l);
17572: ze -= o;
17573: l = l << o | m >>> -o;
17574: m <<= o;
17575: } else {
17576: int o = 64 + Long.numberOfLeadingZeros (m);
17577: ze -= o;
17578: l = m << o;
17579: m = 0L;
17580: }
17581: }
17582: this.flg = zf;
17583: this.epp = ze;
17584: this.dvl = l;
17585: this.cvl = m;
17586:
17587:
17588: return this;
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:
17644:
17645:
17646:
17647:
17648:
17649:
17650:
17651: public final EFP sgn () {
17652: return this.sgn (this);
17653: }
17654: public final EFP sgn (EFP x) {
17655: int xf = x.flg;
17656: if ((xf & (Z | N)) != 0) {
17657: this.flg = xf;
17658: } else {
17659: this.flg = xf & M;
17660: this.epp = 0;
17661: this.dvl = MSB;
17662: this.cvl = 0L;
17663: }
17664: return this;
17665: }
17666:
17667:
17668:
17669:
17670:
17671:
17672:
17673:
17674:
17675:
17676:
17677:
17678:
17679:
17680:
17681:
17682:
17683:
17684:
17685:
17686:
17687:
17688:
17689:
17690:
17691:
17692:
17693:
17694:
17695:
17696:
17697: public final EFP sgnsub (EFP y) {
17698: return this.sgnsub (this, y);
17699: }
17700: public final EFP sgnsub (EFP x, EFP y) {
17701: int xf = x.flg;
17702: int yf = y.flg;
17703: if ((xf | yf) << 1 != 0) {
17704: if ((xf & yf) << 1 < 0 && xf == yf) {
17705: this.flg = P | Z;
17706: } else if ((xf & yf) << 2 < 0 && xf == yf ||
17707: (xf | yf) << 3 < 0) {
17708: this.flg = N;
17709: } else if ((xf << 1 | yf << 2) < 0) {
17710: if (yf << 1 < 0) {
17711: this.flg = yf ^ M;
17712: } else {
17713: this.flg = yf & M ^ M;
17714: this.epp = 0;
17715: this.dvl = MSB;
17716: this.cvl = 0L;
17717: }
17718: } else {
17719: this.flg = xf & M;
17720: this.epp = 0;
17721: this.dvl = MSB;
17722: this.cvl = 0L;
17723: }
17724: } else if (xf != yf) {
17725: this.flg = xf >= 0 ? P : M;
17726: this.epp = 0;
17727: this.dvl = MSB;
17728: this.cvl = 0L;
17729: } else {
17730: int s;
17731: long t;
17732: s = (xf >= 0 ? 1 : -1) * ((s = x.epp - y.epp) != 0 ? s >= 0 ? 1 : -1 :
17733: (t = x.dvl - y.dvl) != 0L ? t >= 0L ? 1 : -1 :
17734: (t = (x.cvl >>> 1) - (y.cvl >>> 1)) != 0L ? t >= 0L ? 1 : -1 :
17735: 0);
17736: if (s != 0) {
17737: this.flg = s >= 0 ? P : M;
17738: this.epp = 0;
17739: this.dvl = MSB;
17740: this.cvl = 0L;
17741: } else {
17742: this.flg = P | Z;
17743: }
17744: }
17745: return this;
17746: }
17747:
17748:
17749:
17750:
17751:
17752:
17753:
17754:
17755: public final EFP shl (int n) {
17756:
17757: n = Math.max (-65536, Math.min (65536, n));
17758: return this.finish (this.flg, this.epp + n, this.dvl, this.cvl, 0L);
17759: }
17760: public final EFP shl (EFP x, int n) {
17761:
17762: n = Math.max (-65536, Math.min (65536, n));
17763: return this.finish (x.flg, x.epp + n, x.dvl, x.cvl, 0L);
17764: }
17765:
17766:
17767:
17768:
17769:
17770:
17771:
17772:
17773: public final EFP shr (int n) {
17774:
17775: n = Math.max (-65536, Math.min (65536, n));
17776: return this.finish (this.flg, this.epp - n, this.dvl, this.cvl, 0L);
17777: }
17778: public final EFP shr (EFP x, int n) {
17779:
17780: n = Math.max (-65536, Math.min (65536, n));
17781: return this.finish (x.flg, x.epp - n, x.dvl, x.cvl, 0L);
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:
17838:
17839:
17840:
17841:
17842:
17843:
17844:
17845:
17846:
17847:
17848:
17849:
17850:
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:
17884:
17885:
17886:
17887:
17888:
17889:
17890: public final EFP sin () {
17891: return this.sin (this);
17892: }
17893: public final EFP sin (EFP x) {
17894: int xf = x.flg;
17895: if (xf << 1 != 0) {
17896: if (xf << 1 < 0) {
17897: this.flg = xf;
17898: } else if (xf << 2 < 0) {
17899: epbFpsr |= EPB_FPSR_OE;
17900: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
17901: epbExceptionOperandMantissa = 0x0000000000000000L;
17902: this.flg = N;
17903: } else {
17904: this.flg = N;
17905: }
17906: return this;
17907: }
17908:
17909: int savedFpsr = epbFpsr;
17910: this.inner ();
17911: if (this == x) {
17912: x = new EFP (x);
17913: }
17914: EFP u = new EFP ();
17915: EFP u2 = new EFP ();
17916: int k = u.ieeerempi2 (x);
17917: if (false) {
17918: EFP s = new EFP ();
17919: EFP t = new EFP ();
17920: u2.isqu (u);
17921: if ((k & 1) == 0) {
17922:
17923: s.flg = u.flg;
17924: s.epp = u.epp;
17925: s.dvl = u.dvl;
17926: s.cvl = u.cvl;
17927:
17928: t.flg = P | Z;
17929:
17930: this.flg = s.flg;
17931: this.epp = s.epp;
17932: this.dvl = s.dvl;
17933: this.cvl = s.cvl;
17934: for (int twok1 = 3; this.ne (t); twok1 += 2) {
17935: s.imul (u2).divi ((1 - twok1) * twok1);
17936:
17937: t.flg = this.flg;
17938: t.epp = this.epp;
17939: t.dvl = this.dvl;
17940: t.cvl = this.cvl;
17941: this.iadd (s);
17942: }
17943: } else {
17944:
17945: s.flg = P;
17946: s.epp = 0;
17947: s.dvl = MSB;
17948: s.cvl = 0L;
17949:
17950: t.flg = P | Z;
17951:
17952: this.flg = s.flg;
17953: this.epp = s.epp;
17954: this.dvl = s.dvl;
17955: this.cvl = s.cvl;
17956: for (int twok = 2; this.ne (t); twok += 2) {
17957: s.imul (u2).divi ((1 - twok) * twok);
17958:
17959: t.flg = this.flg;
17960: t.epp = this.epp;
17961: t.dvl = this.dvl;
17962: t.cvl = this.cvl;
17963: this.iadd (s);
17964: }
17965: }
17966: } else {
17967: if ((k & 1) == 0) {
17968: u2.isqu (u);
17969: this.imul (SIN_C21, u2)
17970: .iadd (SIN_C19).imul (u2)
17971: .iadd (SIN_C17).imul (u2)
17972: .iadd (SIN_C15).imul (u2)
17973: .iadd (SIN_C13).imul (u2)
17974: .iadd (SIN_C11).imul (u2)
17975: .iadd (SIN_C9).imul (u2)
17976: .iadd (SIN_C7).imul (u2)
17977: .iadd (SIN_C5).imul (u2)
17978: .iadd (SIN_C3).imul (u2)
17979: .iadd (SIN_C1).imul (u);
17980: } else {
17981: u2.isqu (u);
17982: this.imul (COS_C20, u2)
17983: .iadd (COS_C18).imul (u2)
17984: .iadd (COS_C16).imul (u2)
17985: .iadd (COS_C14).imul (u2)
17986: .iadd (COS_C12).imul (u2)
17987: .iadd (COS_C10).imul (u2)
17988: .iadd (COS_C8).imul (u2)
17989: .iadd (COS_C6).imul (u2)
17990: .iadd (COS_C4).imul (u2)
17991: .iadd (COS_C2).imul (u2)
17992: .iadd (COS_C0);
17993: }
17994: }
17995: this.outer ().neg (k << 30 < 0);
17996:
17997:
17998:
17999: if (this.flg << 1 == 0 && this.epp == 0) {
18000: if (this.flg < 0) {
18001: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
18002: this.sete (NEXTUP_MINUSONE[epbRoundingPrec]);
18003: }
18004: } else {
18005: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
18006: this.sete (NEXTDOWN_PLUSONE[epbRoundingPrec]);
18007: }
18008: }
18009: }
18010: return this.originUpperLower (x).correctUnderflow (savedFpsr);
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:
18077:
18078:
18079:
18080:
18081:
18082:
18083:
18084:
18085:
18086:
18087:
18088:
18089:
18090:
18091: public final EFP sinh () {
18092: return this.sinh (this);
18093: }
18094: public final EFP sinh (EFP x) {
18095: int xf = x.flg;
18096: if (xf << 1 != 0) {
18097: this.flg = xf;
18098: return this;
18099: }
18100:
18101: epbFpsr |= EPB_FPSR_X2;
18102: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
18103: epbExceptionOperandMantissa = x.dvl;
18104: if (15 <= x.epp) {
18105: epbFpsr |= EPB_FPSR_OF;
18106: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | xf >>> 31]).finish ();
18107: }
18108: if (x.epp < -3) {
18109: int savedFpsr = epbFpsr;
18110: this.inner ();
18111: if (this == x) {
18112: x = new EFP (x);
18113: }
18114: EFP x2 = new EFP ().isqu (x);
18115: this.imul (SINH_C13, x2)
18116: .iadd (SINH_C11).imul (x2)
18117: .iadd (SINH_C9).imul (x2)
18118: .iadd (SINH_C7).imul (x2)
18119: .iadd (SINH_C5).imul (x2)
18120: .iadd (SINH_C3).imul (x2)
18121: .iadd (SINH_C1).outer ().mul (x);
18122: return this.originLowerUpper (x).correctUnderflow (savedFpsr);
18123: }
18124:
18125:
18126:
18127:
18128: this.inner ().abs (x).exp ();
18129: this.sub (new EFP ().rcp (this)).div2 ().outer ().neg (xf < 0);
18130: if (this.flg << 2 < 0) {
18131: epbFpsr |= EPB_FPSR_OF;
18132: return this.sete (OVFL_RESULTS[epbRoundingPrec << 3 | epbRoundingMode << 1 | this.flg >>> 31]).finish ();
18133: }
18134: return this;
18135: }
18136:
18137:
18138:
18139:
18140:
18141:
18142:
18143:
18144:
18145:
18146:
18147:
18148:
18149:
18150:
18151:
18152:
18153:
18154:
18155:
18156:
18157:
18158:
18159:
18160:
18161:
18162:
18163:
18164:
18165:
18166:
18167:
18168:
18169:
18170:
18171:
18172:
18173:
18174:
18175:
18176:
18177:
18178:
18179:
18180:
18181:
18182:
18183:
18184:
18185:
18186:
18187:
18188:
18189:
18190:
18191:
18192:
18193:
18194:
18195:
18196:
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:
18278:
18279:
18280:
18281:
18282:
18283:
18284: public final EFP sqrt () {
18285: return this.sqrt (this);
18286: }
18287: public final EFP sqrt (EFP x) {
18288: int xf = x.flg;
18289: if (xf != 0) {
18290: if (xf == M || xf == (M | I)) {
18291: epbFpsr |= EPB_FPSR_OE;
18292: if (xf << 2 < 0) {
18293: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
18294: epbExceptionOperandMantissa = 0x0000000000000000L;
18295: } else {
18296: epbExceptionOperandExponent = xf & M | 0x3fff + x.epp << 16;
18297: epbExceptionOperandMantissa = x.dvl;
18298: }
18299: this.flg = N;
18300: } else {
18301: this.flg = xf;
18302: }
18303: return this;
18304: }
18305:
18306: if (false) {
18307: this.inner ();
18308: EFP t = new EFP (ONE).max (x);
18309: EFP u = new EFP (x);
18310: EFP w = new EFP ();
18311: do {
18312:
18313: this.flg = t.flg;
18314: this.epp = t.epp;
18315: this.dvl = t.dvl;
18316: this.cvl = t.cvl;
18317: t.iadd (w.sete (u).div (t)).idiv2 ();
18318: } while (this.gt (t));
18319: return this.outer ().finish ();
18320: } else {
18321: if (this == x) {
18322: x = new EFP (x);
18323: }
18324: int xe = x.epp;
18325: if ((xe & 1) != 0 ? (x.dvl >>> -8) == 0xFF : (x.dvl >>> -9) == 0x100) {
18326:
18327:
18328: this.inner ();
18329: x.epp = -(xe & 1);
18330: x.dec ();
18331: this.imul (x, SQRT1PM1_C11).
18332: iadd (SQRT1PM1_C10).imul (x).
18333: iadd (SQRT1PM1_C9).imul (x).
18334: iadd (SQRT1PM1_C8).imul (x).
18335: iadd (SQRT1PM1_C7).imul (x).
18336: iadd (SQRT1PM1_C6).imul (x).
18337: iadd (SQRT1PM1_C5).imul (x).
18338: iadd (SQRT1PM1_C4).imul (x).
18339: iadd (SQRT1PM1_C3).imul (x).
18340: iadd (SQRT1PM1_C2).imul (x).
18341: iadd (SQRT1PM1_C1).imul (x);
18342: this.outer ().inc ();
18343: if (this.flg << 1 == 0) {
18344:
18345:
18346:
18347:
18348:
18349:
18350:
18351:
18352:
18353:
18354:
18355:
18356:
18357:
18358:
18359:
18360:
18361: this.epp += xe + 1 >> 1;
18362: this.finish ();
18363: }
18364: return this;
18365: }
18366:
18367:
18368:
18369:
18370:
18371:
18372:
18373:
18374:
18375:
18376:
18377: long s = Double.doubleToLongBits (Math.sqrt (Double.longBitsToDouble ((long) (1023 + (xe & 1)) << 52 | x.dvl << 1 >>> 12)));
18378: EFP t = new EFP (P, (int) (s >>> 52) - 1023 + (xe >> 1), MSB | s << 12 >>> 1, 0L);
18379: int savedFpsr = epbFpsr;
18380: this.inner ().div (x, t).iadd (t).outer ();
18381: this.epp--;
18382: epbFpsr = 0;
18383: this.finish ();
18384: savedFpsr |= epbFpsr & (EPB_FPSR_OF | EPB_FPSR_UF);
18385: this.inner ();
18386: t.squ (this);
18387: this.outer ();
18388: if ((epbFpsr & EPB_FPSR_X2) != 0 || !t.eq (x)) {
18389: savedFpsr |= EPB_FPSR_X2;
18390: epbExceptionOperandExponent = xf | 0x3fff + x.epp << 16;
18391: epbExceptionOperandMantissa = x.dvl;
18392: }
18393: epbFpsr = savedFpsr;
18394: return this;
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: public final EFP squ () {
18451: int xf = this.flg;
18452: if (xf << 1 != 0) {
18453: this.flg = xf << 3 < 0 ? N : xf & ~M;
18454: return this;
18455: }
18456:
18457:
18458: long zd = this.dvl;
18459: long zc = this.cvl;
18460: long zb = (zd << -2 | zc >>> 2) >>> -30;
18461: zc = zd << 32 >>> -30;
18462: zd >>>= 32;
18463:
18464:
18465: long t = zb * zb;
18466: long s = t & 0xffffffffL;
18467: t = (t >>> 30) + (zc * zb << 1);
18468: s |= t & 0xffffffffL;
18469: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18470: s |= t & 0xffffffffL;
18471: t = (t >>> 30) + (zd * zc << 1);
18472: zd = (t >>> 30) + zd * zd;
18473: zc = t << -30 | s;
18474: int ze = this.epp << 1;
18475: if (zd < 0L) {
18476: ze++;
18477: } else {
18478: zd = zd << 1 | zc >>> -1;
18479: zc <<= 1;
18480: }
18481: return this.finish (P, ze, zd, zc, 0L);
18482: }
18483: public final EFP isqu () {
18484: int xf = this.flg;
18485: if (xf << 1 != 0) {
18486: this.flg = xf << 3 < 0 ? N : xf & ~M;
18487: return this;
18488: }
18489:
18490:
18491: long zd = this.dvl;
18492: long zc = this.cvl;
18493: long zb = (zd << -2 | zc >>> 2) >>> -30;
18494: zc = zd << 32 >>> -30;
18495: zd >>>= 32;
18496:
18497:
18498: long t = zb * zb;
18499: long s = t & 0xffffffffL;
18500: t = (t >>> 30) + (zc * zb << 1);
18501: s |= t & 0xffffffffL;
18502: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18503: s |= t & 0xffffffffL;
18504: t = (t >>> 30) + (zd * zc << 1);
18505: zd = (t >>> 30) + zd * zd;
18506: zc = t << -30 | s;
18507: int ze = this.epp << 1;
18508: if (zd < 0L) {
18509: ze++;
18510: } else {
18511: zd = zd << 1 | zc >>> -1;
18512: zc <<= 1;
18513: }
18514: return this.ifinish (P, ze, zd, zc, 0L);
18515: }
18516: public final EFP squ (EFP x) {
18517:
18518:
18519: int xf = x.flg;
18520: if (xf << 1 != 0) {
18521: this.flg = xf << 3 < 0 ? N : xf & ~M;
18522: return this;
18523: }
18524:
18525:
18526: long zd = x.dvl;
18527: long zc = x.cvl;
18528: long zb = (zd << -2 | zc >>> 2) >>> -30;
18529: zc = zd << 32 >>> -30;
18530: zd >>>= 32;
18531:
18532:
18533: long t = zb * zb;
18534: long s = t & 0xffffffffL;
18535: t = (t >>> 30) + (zc * zb << 1);
18536: s |= t & 0xffffffffL;
18537: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18538: s |= t & 0xffffffffL;
18539: t = (t >>> 30) + (zd * zc << 1);
18540: zd = (t >>> 30) + zd * zd;
18541: zc = t << -30 | s;
18542: int ze = x.epp << 1;
18543: if (zd < 0L) {
18544: ze++;
18545: } else {
18546: zd = zd << 1 | zc >>> -1;
18547: zc <<= 1;
18548: }
18549: return this.finish (P, ze, zd, zc, 0L);
18550: }
18551: public final EFP isqu (EFP x) {
18552:
18553:
18554: int xf = x.flg;
18555: if (xf << 1 != 0) {
18556: this.flg = xf << 3 < 0 ? N : xf & ~M;
18557: return this;
18558: }
18559:
18560:
18561: long zd = x.dvl;
18562: long zc = x.cvl;
18563: long zb = (zd << -2 | zc >>> 2) >>> -30;
18564: zc = zd << 32 >>> -30;
18565: zd >>>= 32;
18566:
18567:
18568: long t = zb * zb;
18569: long s = t & 0xffffffffL;
18570: t = (t >>> 30) + (zc * zb << 1);
18571: s |= t & 0xffffffffL;
18572: t = (t >>> 30) + (zd * zb << 1) + zc * zc;
18573: s |= t & 0xffffffffL;
18574: t = (t >>> 30) + (zd * zc << 1);
18575: zd = (t >>> 30) + zd * zd;
18576: zc = t << -30 | s;
18577: int ze = x.epp << 1;
18578: if (zd < 0L) {
18579: ze++;
18580: } else {
18581: zd = zd << 1 | zc >>> -1;
18582: zc <<= 1;
18583: }
18584: return this.ifinish (P, ze, zd, zc, 0L);
18585: }
18586:
18587:
18588:
18589:
18590:
18591:
18592:
18593:
18594:
18595:
18596:
18597:
18598: public final EFP sub (EFP y) {
18599: int xf = this.flg;
18600: int xe = this.epp;
18601: long xd = this.dvl;
18602: long xc = this.cvl;
18603: long xb = 0L;
18604: int yf = y.flg;
18605: if ((xf | yf) << 1 != 0) {
18606: if ((xf | yf) << 3 < 0) {
18607: this.flg = N;
18608: return this;
18609: }
18610: if ((xf & yf) << 2 < 0 && xf == yf) {
18611: epbFpsr |= EPB_FPSR_OE;
18612: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
18613: epbExceptionOperandMantissa = 0x0000000000000000L;
18614: this.flg = N;
18615: return this;
18616: }
18617: if ((xf & yf) << 1 < 0 && xf == yf) {
18618: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18619: return this;
18620: }
18621: if (xf << 1 < 0 || yf << 2 < 0) {
18622: xf = yf ^ M;
18623: xe = y.epp;
18624: xd = y.dvl;
18625: xc = y.cvl;
18626: }
18627:
18628: } else {
18629:
18630: yf ^= M;
18631: long yd = y.dvl;
18632: long yc = y.cvl;
18633: int o = xe - y.epp;
18634: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
18635:
18636: xf = yf;
18637: xe += o = -o;
18638: xd = yd;
18639: xc = yc;
18640: yf = this.flg;
18641: yd = this.dvl;
18642: yc = this.cvl;
18643: }
18644:
18645:
18646: if (0 < o) {
18647: if (o <= 63) {
18648: xb = yc << -o;
18649: yc = yd << -o | yc >>> o;
18650: yd >>>= o;
18651: } else if (o == 64) {
18652: xb = yc;
18653: yc = yd;
18654: yd = 0L;
18655: } else if (o <= 127) {
18656: xb = yd << -o | yc;
18657: yc = yd >>> o;
18658: yd = 0L;
18659: } else {
18660: xb = yd | yc;
18661: yc = 0L;
18662: yd = 0L;
18663: }
18664: }
18665:
18666: if (xf == yf) {
18667:
18668: xb |= yc << 62;
18669:
18670: xc = xd << 63 | xc >>> 1;
18671: xd >>>= 1;
18672: yc = yd << 63 | yc >>> 1;
18673: yd >>>= 1;
18674:
18675: yc >>>= 1;
18676: xc >>>= 1;
18677:
18678: xc += yc;
18679: xd += yd + (xc >>> 63);
18680:
18681: xc <<= 1;
18682:
18683: if (xd < 0L) {
18684: xe++;
18685: } else {
18686: xd = xd << 1 | xc >>> 63;
18687: xc <<= 1;
18688: }
18689: } else {
18690:
18691: xb |= yc << 63;
18692:
18693: yc >>>= 1;
18694: xc >>>= 1;
18695:
18696:
18697: if (xb != 0L) {
18698: xc--;
18699: }
18700: xc -= yc;
18701: xd -= yd + (xc >>> 63);
18702:
18703: xc <<= 1;
18704:
18705: if (0L <= xd) {
18706: if (xd != 0L) {
18707: xe -= o = Long.numberOfLeadingZeros (xd);
18708: xd = xd << o | xc >>> -o;
18709: xc <<= o;
18710: } else if (xc != 0L) {
18711: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
18712: xd = xc << o;
18713: xc = 0L;
18714: } else {
18715: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18716: }
18717: }
18718: }
18719: }
18720: return this.finish (xf, xe, xd, xc, xb);
18721: }
18722: public final EFP sub (EFP x, EFP y) {
18723: int xf = x.flg;
18724: int xe = x.epp;
18725: long xd = x.dvl;
18726: long xc = x.cvl;
18727: long xb = 0L;
18728: int yf = y.flg;
18729: if ((xf | yf) << 1 != 0) {
18730: if ((xf | yf) << 3 < 0) {
18731: this.flg = N;
18732: return this;
18733: }
18734: if ((xf & yf) << 2 < 0 && xf == yf) {
18735: epbFpsr |= EPB_FPSR_OE;
18736: epbExceptionOperandExponent = yf & M | 0x7fff << 16;
18737: epbExceptionOperandMantissa = 0x0000000000000000L;
18738: this.flg = N;
18739: return this;
18740: }
18741: if ((xf & yf) << 1 < 0 && xf == yf) {
18742: this.flg = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18743: return this;
18744: }
18745: if (xf << 1 < 0 || yf << 2 < 0) {
18746: xf = yf ^ M;
18747: xe = y.epp;
18748: xd = y.dvl;
18749: xc = y.cvl;
18750: }
18751:
18752: } else {
18753:
18754: yf ^= M;
18755: long yd = y.dvl;
18756: long yc = y.cvl;
18757: int o = xe - y.epp;
18758: if (o < 0 || o == 0 && (xd < yd || xd == yd && xc >>> 1 < yc >>> 1)) {
18759:
18760: xf = yf;
18761: xe += o = -o;
18762: xd = yd;
18763: xc = yc;
18764: yf = x.flg;
18765: yd = x.dvl;
18766: yc = x.cvl;
18767: }
18768:
18769:
18770: if (0 < o) {
18771: if (o <= 63) {
18772: xb = yc << -o;
18773: yc = yd << -o | yc >>> o;
18774: yd >>>= o;
18775: } else if (o == 64) {
18776: xb = yc;
18777: yc = yd;
18778: yd = 0L;
18779: } else if (o <= 127) {
18780: xb = yd << -o | yc;
18781: yc = yd >>> o;
18782: yd = 0L;
18783: } else {
18784: xb = yd | yc;
18785: yc = 0L;
18786: yd = 0L;
18787: }
18788: }
18789:
18790: if (xf == yf) {
18791:
18792: xb |= yc << 62;
18793:
18794: xc = xd << 63 | xc >>> 1;
18795: xd >>>= 1;
18796: yc = yd << 63 | yc >>> 1;
18797: yd >>>= 1;
18798:
18799: yc >>>= 1;
18800: xc >>>= 1;
18801:
18802: xc += yc;
18803: xd += yd + (xc >>> 63);
18804:
18805: xc <<= 1;
18806:
18807: if (xd < 0L) {
18808: xe++;
18809: } else {
18810: xd = xd << 1 | xc >>> 63;
18811: xc <<= 1;
18812: }
18813: } else {
18814:
18815: xb |= yc << 63;
18816:
18817: yc >>>= 1;
18818: xc >>>= 1;
18819:
18820:
18821: if (xb != 0L) {
18822: xc--;
18823: }
18824: xc -= yc;
18825: xd -= yd + (xc >>> 63);
18826:
18827: xc <<= 1;
18828:
18829: if (0L <= xd) {
18830: if (xd != 0L) {
18831: xe -= o = Long.numberOfLeadingZeros (xd);
18832: xd = xd << o | xc >>> -o;
18833: xc <<= o;
18834: } else if (xc != 0L) {
18835: xe -= o = 64 + Long.numberOfLeadingZeros (xc);
18836: xd = xc << o;
18837: xc = 0L;
18838: } else {
18839: xf = epbRoundingMode == EPB_MODE_RM ? M | Z : P | Z;
18840: }
18841: }
18842: }
18843: }
18844: return this.finish (xf, xe, xd, xc, xb);
18845: }
18846:
18847:
18848:
18849:
18850:
18851:
18852:
18853:
18854:
18855:
18856:
18857:
18858:
18859:
18860:
18861:
18862:
18863:
18864:
18865:
18866:
18867:
18868:
18869:
18870:
18871:
18872:
18873:
18874:
18875:
18876:
18877:
18878:
18879:
18880:
18881:
18882:
18883:
18884:
18885:
18886:
18887:
18888:
18889:
18890:
18891:
18892:
18893:
18894:
18895:
18896:
18897:
18898:
18899:
18900:
18901:
18902:
18903:
18904:
18905:
18906:
18907:
18908:
18909:
18910:
18911:
18912:
18913:
18914:
18915:
18916:
18917:
18918:
18919:
18920:
18921:
18922:
18923:
18924:
18925:
18926:
18927:
18928:
18929:
18930:
18931:
18932:
18933:
18934:
18935:
18936:
18937:
18938:
18939:
18940:
18941:
18942:
18943:
18944:
18945:
18946:
18947:
18948:
18949:
18950:
18951:
18952:
18953:
18954:
18955:
18956:
18957:
18958:
18959:
18960:
18961:
18962:
18963:
18964:
18965:
18966:
18967:
18968:
18969:
18970:
18971:
18972:
18973:
18974:
18975:
18976:
18977:
18978:
18979:
18980:
18981:
18982:
18983:
18984:
18985: public final EFP tan () {
18986: return this.tan (this);
18987: }
18988: public final EFP tan (EFP x) {
18989: int xf = x.flg;
18990: if (xf << 1 != 0) {
18991: if (xf << 1 < 0) {
18992: this.flg = xf;
18993: } else if (xf << 2 < 0) {
18994: epbFpsr |= EPB_FPSR_OE;
18995: epbExceptionOperandExponent = xf & M | 0x7fff << 16;
18996: epbExceptionOperandMantissa = 0x0000000000000000L;
18997: this.flg = N;
18998: } else {
18999: this.flg = N;
19000: }
19001: return this;
19002: }
19003:
19004: if (false) {
19005: EFP c = new EFP ().inner ().cos (x);
19006: return this.sin (x).outer ().div (c);
19007: } else if (false) {
19008: this.inner ();
19009: EFP s = new EFP ();
19010: EFP t = new EFP ();
19011: EFP u = new EFP ().iabs (x);
19012: EFP u2 = new EFP ();
19013: int k = 0;
19014:
19015: if (u.epp >= -1 || (u.epp == -2 && u.dvl >= 0xc90fdaa22168c234L)) {
19016:
19017: s.iadd (u, PI_8).imul (FOUR_PI).trunc ();
19018:
19019: u.sub (t.imulw (u2, s, PI_4)).sub (u2).sub (t.imul (s, PI_4A));
19020: k = s.geti () & 3;
19021: }
19022: u2.isqu (u);
19023: this.imul (TAN_C33, u2)
19024: .iadd (TAN_C31).imul (u2)
19025: .iadd (TAN_C29).imul (u2)
19026: .iadd (TAN_C27).imul (u2)
19027: .iadd (TAN_C25).imul (u2)
19028: .iadd (TAN_C23).imul (u2)
19029: .iadd (TAN_C21).imul (u2)
19030: .iadd (TAN_C19).imul (u2)
19031: .iadd (TAN_C17).imul (u2)
19032: .iadd (TAN_C15).imul (u2)
19033: .iadd (TAN_C13).imul (u2)
19034: .iadd (TAN_C11).imul (u2)
19035: .iadd (TAN_C9).imul (u2)
19036: .iadd (TAN_C7).imul (u2)
19037: .iadd (TAN_C5).imul (u2)
19038: .iadd (TAN_C3).imul (u2)
19039: .iadd (TAN_C1).imul (u);
19040: if (k == 1) {
19041: t.negdec (this);
19042: this.inc ().div (t);
19043: } else if (k == 2) {
19044: this.rcp ().ineg ();
19045: } else if (k == 3) {
19046: t.inc (this);
19047: this.dec ().div (t);
19048: }
19049: return this.outer ().neg (xf < 0);
19050: } else {
19051: if (x.epp >= 16) {
19052: EFP c = new EFP ().inner ().cos (x);
19053: return this.sin (x).outer ().div (c);
19054: }
19055: int savedFpsr = epbFpsr;
19056: this.inner ();
19057: if (this == x) {
19058: x = new EFP (x);
19059: }
19060: if (x.epp < -3) {
19061: EFP x2 = new EFP ().isqu (x);
19062: this.imul (TAN8_C21, x2)
19063: .iadd (TAN8_C19).imul (x2)
19064: .iadd (TAN8_C17).imul (x2)
19065: .iadd (TAN8_C15).imul (x2)
19066: .iadd (TAN8_C13).imul (x2)
19067: .iadd (TAN8_C11).imul (x2)
19068: .iadd (TAN8_C9).imul (x2)
19069: .iadd (TAN8_C7).imul (x2)
19070: .iadd (TAN8_C5).imul (x2)
19071: .iadd (TAN8_C3).imul (x2)
19072: .iadd (TAN8_C1).outer ().mul (x);
19073: return this.originLowerUpper (x).correctUnderflow (savedFpsr);
19074: }
19075: EFP s = new EFP ();
19076: EFP t = new EFP ();
19077: EFP u = new EFP ().iabs (x);
19078: EFP u2 = new EFP ();
19079: s.iadd (u, TAN7_X).imul (TAN7_Y).trunc ();
19080:
19081: u.sub (t.imulw (u2, s, TAN7_Z)).sub (u2).sub (t.imul (s, TAN7_ZA));
19082: int k = s.geti () & 127;
19083: u2.isqu (u);
19084: this.imul (TAN7_C11, u2)
19085: .iadd (TAN7_C9).imul (u2)
19086: .iadd (TAN7_C7).imul (u2)
19087: .iadd (TAN7_C5).imul (u2)
19088: .iadd (TAN7_C3).imul (u2)
19089: .iadd (TAN7_C1).imul (u);
19090: if (k != 0) {
19091: if (k <= 63) {
19092: t = TAN7_T[k];
19093: s.imul (this, t).negdec ();
19094: this.iadd (t).div (s);
19095: } else if (k == 64) {
19096: this.rcp ().ineg ();
19097: } else {
19098: t = TAN7_T[128 - k];
19099: s.imul (this, t).inc ();
19100: this.sub (t).div (s);
19101: }
19102: }
19103: return this.outer ().neg (xf < 0);
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:
19172:
19173:
19174:
19175:
19176:
19177:
19178:
19179:
19180:
19181:
19182:
19183:
19184:
19185:
19186:
19187:
19188:
19189:
19190:
19191:
19192:
19193:
19194:
19195:
19196:
19197:
19198:
19199:
19200:
19201:
19202:
19203:
19204:
19205:
19206:
19207:
19208:
19209:
19210:
19211:
19212:
19213:
19214:
19215:
19216:
19217:
19218:
19219:
19220:
19221:
19222:
19223:
19224:
19225:
19226:
19227:
19228:
19229:
19230:
19231:
19232:
19233:
19234:
19235:
19236:
19237:
19238:
19239:
19240:
19241:
19242:
19243:
19244:
19245:
19246:
19247:
19248:
19249:
19250: public final EFP tanh () {
19251: return this.tanh (this);
19252: }
19253: public final EFP tanh (EFP x) {
19254: int xf = x.flg;
19255: if (xf << 1 != 0) {
19256: if (xf << 2 < 0) {
19257: this.flg = xf & M;
19258: this.epp = 0;
19259: this.dvl = MSB;
19260: this.cvl = 0L;
19261: } else {
19262: this.flg = xf;
19263: }
19264: return this;
19265: }
19266:
19267:
19268: int xe = x.epp;
19269: if (xe < -2) {
19270: int savedFpsr = epbFpsr;
19271: this.inner ();
19272: if (this == x) {
19273: x = new EFP (x);
19274: }
19275: EFP x2 = new EFP ().isqu (x);
19276: this.imul (TANH_C27, x2)
19277: .iadd (TANH_C25).imul (x2)
19278: .iadd (TANH_C23).imul (x2)
19279: .iadd (TANH_C21).imul (x2)
19280: .iadd (TANH_C19).imul (x2)
19281: .iadd (TANH_C17).imul (x2)
19282: .iadd (TANH_C15).imul (x2)
19283: .iadd (TANH_C13).imul (x2)
19284: .iadd (TANH_C11).imul (x2)
19285: .iadd (TANH_C9).imul (x2)
19286: .iadd (TANH_C7).imul (x2)
19287: .iadd (TANH_C5).imul (x2)
19288: .iadd (TANH_C3).imul (x2)
19289: .iadd (TANH_C1).outer ().mul (x);
19290: return this.originUpperLower (x).correctUnderflow (savedFpsr);
19291: }
19292:
19293: if (false) {
19294: EFP c = new EFP ().inner ().cosh (x);
19295: return this.sinh (x).outer ().div (c);
19296: } else if (6 <= xe) {
19297:
19298:
19299:
19300:
19301:
19302:
19303:
19304:
19305: epbFpsr |= EPB_FPSR_X2;
19306: this.flg = xf & M;
19307: this.epp = 0;
19308: this.dvl = MSB;
19309: this.cvl = 0L;
19310: if (xf < 0) {
19311: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RP) {
19312: this.nextup (epbRoundingPrec);
19313: }
19314: } else {
19315: if (epbRoundingMode == EPB_MODE_RZ || epbRoundingMode == EPB_MODE_RM) {
19316: this.nextdown (epbRoundingPrec);
19317: }
19318: }
19319: return this;
19320: } else {
19321: EFP t = new EFP ().inner ().imul2 (x).exp ();
19322: this.dec (t);
19323: t.inc ();
19324: return this.outer ().div (t);
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: public final EFP tgamma () {
19400: return this.tgamma (this);
19401: }
19402: public final EFP tgamma (EFP x) {
19403: int xf = x.flg;
19404: if (xf << 1 != 0) {
19405: this.flg = (xf == (P | Z) || xf == (P | I) ? P | I :
19406: xf == (M | Z) ? M | I :
19407: N);
19408: return this;
19409: }
19410:
19411: this.inner ();
19412: if (xf < 0) {
19413: EFP t = new EFP ().mul (PI, x).sin ();
19414: this.negdec (x).lgamma ().exp ().mul (t).rcpdiv (PI);
19415: } else {
19416: this.lgamma (x).exp ();
19417: }
19418: return this.outer ().finish ();
19419: }
19420:
19421:
19422:
19423:
19424:
19425:
19426:
19427:
19428:
19429:
19430:
19431:
19432:
19433:
19434:
19435: @Override public String toString () {
19436: int xf = this.flg;
19437: if (xf << 1 != 0) {
19438: return (xf == (P | Z) ? "0" :
19439: xf == (M | Z) ? "-0" :
19440: xf == (P | I) ? "Infinity" :
19441: xf == (M | I) ? "-Infinity" :
19442: xf << 3 < 0 ? "NaN" : "???");
19443: }
19444:
19445: this.inner ();
19446: EFP x = new EFP ().iabs (this);
19447:
19448:
19449: int e = (int) Math.floor ((double) x.epp * 0.30102999566398119521373889472);
19450:
19451:
19452:
19453: if (0 < e) {
19454: x.imul (EFP_TEN_M16QR[e & 15]);
19455: if (16 <= e) {
19456: x.imul (EFP_TEN_M16QR[16 + (e >> 4 & 15)]);
19457: if (256 <= e) {
19458: x.imul (EFP_TEN_M16QR[32 + (e >> 8 & 15)]);
19459: if (4096 <= e) {
19460: x.imul (EFP_TEN_M16QR[48 + (e >> 12)]);
19461: }
19462: }
19463: }
19464: } else if (e < 0) {
19465: x.imul (EFP_TEN_P16QR[-e & 15]);
19466: if (e <= -16) {
19467: x.imul (EFP_TEN_P16QR[16 + (-e >> 4 & 15)]);
19468: if (e <= -256) {
19469: x.imul (EFP_TEN_P16QR[32 + (-e >> 8 & 15)]);
19470: if (e <= -4096) {
19471: x.imul (EFP_TEN_P16QR[48 + (-e >> 12)]);
19472: }
19473: }
19474: }
19475: }
19476: this.outer ();
19477:
19478:
19479:
19480:
19481: int[] w = new int[2 + (EFP_DECIMAL_PREC + 4 & -4)];
19482: {
19483: int t = 31 - x.epp;
19484: long x1 = x.dvl >>> t;
19485: long x2 = x.dvl << -t | x.cvl >>> t;
19486: long x3 = x2 & 0xffffffffL;
19487: x2 >>>= 32;
19488: t = XEiJ.FMT_BCD4[(int) (x1 >>> 32)];
19489: w[0] = t >> 4;
19490: w[1] = t & 15;
19491: for (int i = 2; i < 2 + (EFP_DECIMAL_PREC + 4 & -4); i += 4) {
19492: x3 *= 10000L;
19493: x2 = x2 * 10000L + (x3 >>> 32);
19494: x3 &= 0xffffffffL;
19495: x1 = (x1 & 0xffffffffL) * 10000L + (x2 >>> 32);
19496: x2 &= 0xffffffffL;
19497: t = XEiJ.FMT_BCD4[(int) (x1 >>> 32)];
19498: w[i ] = t >> 12;
19499: w[i + 1] = t >> 8 & 15;
19500: w[i + 2] = t >> 4 & 15;
19501: w[i + 3] = t & 15;
19502: }
19503: }
19504:
19505:
19506: int h = w[0] != 0 ? 0 : w[1] != 0 ? 1 : 2;
19507:
19508: int o = h + EFP_DECIMAL_PREC;
19509: if (5 <= w[o]) {
19510: int i = o;
19511: while (10 <= ++w[--i]) {
19512: w[i] = 0;
19513: }
19514: if (i < h) {
19515: h--;
19516: o--;
19517: }
19518: }
19519:
19520:
19521: e -= h - 1;
19522:
19523:
19524: while (w[o - 1] == 0) {
19525: o--;
19526: }
19527:
19528: StringBuilder sb = new StringBuilder ();
19529:
19530: if (xf < 0) {
19531: sb.append ('-');
19532: }
19533:
19534: if (0 <= e && e < EFP_DECIMAL_PREC) {
19535: do {
19536: sb.append ((char) ('0' + w[h++]));
19537: } while (0 <= --e);
19538: if (h < o) {
19539: sb.append ('.');
19540: do {
19541: sb.append ((char) ('0' + w[h++]));
19542: } while (h < o);
19543: }
19544: } else if (-4 <= e && e < 0) {
19545: sb.append ('0');
19546: sb.append ('.');
19547: while (++e < 0) {
19548: sb.append ('0');
19549: }
19550: do {
19551: sb.append ((char) ('0' + w[h++]));
19552: } while (h < o);
19553: } else {
19554: sb.append ((char) ('0' + w[h++]));
19555: if (h < o) {
19556: sb.append ('.');
19557: do {
19558: sb.append ((char) ('0' + w[h++]));
19559: } while (h < o);
19560: }
19561: sb.append ('e');
19562: if (false) {
19563: sb.append (e);
19564: } else {
19565: if (e < 0) {
19566: sb.append ('-');
19567: e = -e;
19568: } else {
19569: sb.append ('+');
19570: }
19571: e = XEiJ.fmtBcd8 (e);
19572: int t = Integer.numberOfLeadingZeros (e);
19573: if (t <= 27) {
19574: if (t <= 23) {
19575: if (t <= 19) {
19576: if (t <= 15) {
19577: sb.append ((char) ('0' + (e >>> 16 & 15)));
19578: }
19579: sb.append ((char) ('0' + (e >>> 12 & 15)));
19580: }
19581: sb.append ((char) ('0' + (e >>> 8 & 15)));
19582: }
19583: sb.append ((char) ('0' + (e >>> 4 & 15)));
19584: }
19585: sb.append ((char) ('0' + (e & 15)));
19586: }
19587: }
19588: return sb.toString ();
19589: }
19590:
19591:
19592:
19593:
19594:
19595:
19596:
19597:
19598:
19599:
19600:
19601:
19602:
19603:
19604:
19605:
19606:
19607:
19608:
19609:
19610:
19611:
19612:
19613:
19614:
19615:
19616:
19617:
19618:
19619:
19620:
19621:
19622:
19623:
19624:
19625:
19626:
19627:
19628:
19629:
19630:
19631:
19632:
19633:
19634:
19635:
19636:
19637:
19638:
19639:
19640:
19641:
19642:
19643:
19644:
19645:
19646:
19647:
19648: public final EFP trunc () {
19649: return trunc (this);
19650: }
19651: public final EFP trunc (EFP x) {
19652: int xf = x.flg;
19653: if (xf << 1 != 0) {
19654: this.flg = xf;
19655: return this;
19656: }
19657:
19658: int xe = x.epp;
19659: if (xe < 0) {
19660: epbFpsr |= EPB_FPSR_X2;
19661: this.flg = xf | Z;
19662: return this;
19663: }
19664: long xd = x.dvl;
19665: long xc = x.cvl;
19666: if (xe <= 63) {
19667: long m = MSB >> xe;
19668: if ((xd & ~m | xc) != 0L) {
19669: epbFpsr |= EPB_FPSR_X2;
19670: xd &= m;
19671: xc = 0L;
19672: }
19673: } else if (xe <= LEN - 2) {
19674: long m = MSB >> xe;
19675: if ((xc & ~m) != 0L) {
19676: epbFpsr |= EPB_FPSR_X2;
19677: xc &= m;
19678: }
19679: }
19680:
19681: return this.finish (xf, xe, xd, xc, 0L);
19682: }
19683:
19684:
19685:
19686:
19687:
19688:
19689:
19690:
19691:
19692:
19693:
19694:
19695: public final EFP ulp () {
19696: return this.ulp (this);
19697: };
19698: public final EFP ulp (EFP x) {
19699: int xf = x.flg;
19700: if (xf << 1 != 0) {
19701: if (xf << 1 < 0) {
19702: this.flg = P;
19703: this.epp = -32768;
19704: this.dvl = MSB;
19705: this.cvl = 0L;
19706: } else {
19707: this.flg = xf & ~M;
19708: }
19709: return this;
19710: }
19711:
19712: this.flg = P;
19713: this.epp = x.epp - (LEN - 1);
19714: this.dvl = MSB;
19715: this.cvl = 0L;
19716: return this;
19717: };
19718:
19719: }
19720:
19721:
19722:
19723:
19724:
19725:
19726:
19727:
19728:
19729:
19730:
19731:
19732:
19733:
19734:
19735:
19736:
19737:
19738:
19739:
19740:
19741:
19742:
19743:
19744:
19745:
19746:
19747:
19748:
19749:
19750:
19751:
19752:
19753:
19754:
19755:
19756:
19757:
19758:
19759:
19760:
19761:
19762:
19763:
19764:
19765:
19766:
19767:
19768:
19769:
19770:
19771:
19772:
19773:
19774:
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: public static final boolean CIR_DEBUG_TRACE = false;
19808:
19809:
19810:
19811:
19812:
19813:
19814:
19815:
19816:
19817:
19818:
19819:
19820:
19821:
19822:
19823: public int cirResponse;
19824: public int cirFormatWord;
19825: public int cirOperationWord;
19826: public int cirCommand;
19827: public int cirRegisterList;
19828: public int cirOperandAddress;
19829:
19830:
19831: public final int[] cirOperandBuffer = new int[212];
19832: public int cirOperandLength;
19833: public int cirOperandIndex;
19834:
19835:
19836:
19837:
19838:
19839:
19840: public static final int CIR_INPUT_MASK = 16;
19841: public static final int CIR_OUTPUT_MASK = 32;
19842: public static final int CIR_IDLE = 0;
19843: public static final int CIR_PROGRAM_COUNTER = 1;
19844: public static final int CIR_DYNAMIC_K_FACTOR = CIR_INPUT_MASK | 2;
19845: public static final int CIR_DYNAMIC_REGISTER_LIST = CIR_INPUT_MASK | 3;
19846: public static final int CIR_REGISTER_SELECT = 4;
19847: public static final int CIR_SOURCE_OPERAND = CIR_INPUT_MASK | 5;
19848: public static final int CIR_DESTINATION_OPERAND = CIR_OUTPUT_MASK | 6;
19849: public static final int CIR_FSAVE_STATE_FRAME = CIR_OUTPUT_MASK | 7;
19850: public static final int CIR_FRESTORE_STATE_FRAME = CIR_INPUT_MASK | 8;
19851: public static final int CIR_EXCEPTION_PROCESSING = 9;
19852: public static final String[] cirNameOfStage = {
19853: "idle",
19854: "input program counter into the instruction address CIR",
19855: "input dynamic k-factor into the operand CIR",
19856: "input dynamic register list into the operand CIR",
19857: "output register select from the register select CIR",
19858: "input source operand into the operand CIR",
19859: "output destination operand from the operand CIR",
19860: "output FSAVE state frame from the operand CIR",
19861: "input FRESTORE state from into the operand CIR",
19862: "exception processing",
19863: };
19864: public int cirStage;
19865:
19866:
19867:
19868: public final void cirInit () {
19869:
19870: Arrays.fill (cirOperandBuffer, 0);
19871: cirReset ();
19872: }
19873:
19874:
19875:
19876: public final void cirReset () {
19877: cirIdle (0x0802);
19878: }
19879:
19880:
19881:
19882: public final void cirIdle (int response) {
19883: if (CIR_DEBUG_TRACE) {
19884: System.out.printf ("%08x cirIdle(0x%08x)\n", XEiJ.regPC0, response);
19885: }
19886: cirResponse = response;
19887: cirOperationWord = 0;
19888: cirCommand = 0;
19889: cirRegisterList = 0;
19890: cirOperandAddress = 0;
19891: Arrays.fill (cirOperandBuffer, 0);
19892: cirOperandLength = 0;
19893: cirOperandIndex = 0;
19894: cirStage = CIR_IDLE;
19895: }
19896:
19897:
19898:
19899:
19900:
19901:
19902:
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:
19994:
19995:
19996:
19997:
19998:
19999:
20000:
20001:
20002:
20003:
20004:
20005:
20006:
20007:
20008:
20009:
20010:
20011:
20012:
20013:
20014:
20015:
20016:
20017:
20018:
20019:
20020:
20021:
20022:
20023:
20024:
20025:
20026:
20027:
20028:
20029:
20030:
20031:
20032:
20033:
20034:
20035:
20036:
20037:
20038:
20039:
20040:
20041:
20042:
20043:
20044:
20045:
20046:
20047:
20048:
20049:
20050:
20051:
20052:
20053:
20054:
20055:
20056:
20057:
20058:
20059:
20060:
20061:
20062:
20063:
20064:
20065:
20066:
20067:
20068:
20069:
20070:
20071:
20072:
20073:
20074:
20075:
20076:
20077:
20078:
20079:
20080:
20081:
20082:
20083:
20084:
20085:
20086:
20087:
20088:
20089: public void cirException (int response) {
20090: if (CIR_DEBUG_TRACE) {
20091: System.out.printf ("%08x cirException(0x%08x)\n", XEiJ.regPC0, response);
20092: }
20093: cirResponse = response;
20094: cirOperationWord = 0;
20095: cirCommand = 0;
20096: cirRegisterList = 0;
20097: cirOperandAddress = 0;
20098: Arrays.fill (cirOperandBuffer, 0);
20099: cirOperandLength = 0;
20100: cirOperandIndex = 0;
20101: cirStage = CIR_EXCEPTION_PROCESSING;
20102: }
20103:
20104:
20105:
20106: public int cirPeekByteZero (int a) {
20107: return (a & 1) == 0 ? cirPeekWordZero (a) >>> 8 : cirPeekWordZero (a - 1) & 255;
20108: }
20109:
20110:
20111:
20112: public int cirPeekWordZero (int a) {
20113: a &= 0x1e;
20114: int d = 65535;
20115: switch (a) {
20116: case 0x00:
20117: d = (char) cirResponse;
20118: break;
20119:
20120: case 0x04:
20121: if ((cirStage == CIR_EXCEPTION_PROCESSING && cirResponse == 0x1d0d) ||
20122: cirStage == CIR_FSAVE_STATE_FRAME ||
20123: cirStage == CIR_FRESTORE_STATE_FRAME) {
20124: d = 0x0200;
20125:
20126: } else {
20127: if ((cirStage & (CIR_INPUT_MASK | CIR_OUTPUT_MASK)) == 0) {
20128: d = 0x1f38;
20129: } else {
20130: d = 0x1fd4;
20131: }
20132: }
20133: break;
20134: case 0x06:
20135: d = (char) cirFormatWord;
20136: break;
20137: case 0x08:
20138: d = (char) cirOperationWord;
20139: break;
20140:
20141:
20142:
20143:
20144: case 0x10 + 0:
20145:
20146: d = cirPeekLong (a) >>> 16;
20147: break;
20148: case 0x10 + 2:
20149: d = (char) cirPeekLong (a + 2);
20150: break;
20151: case 0x14:
20152: if (cirStage == CIR_REGISTER_SELECT) {
20153:
20154:
20155:
20156:
20157: d = cirRegisterList << 8;
20158: } else {
20159:
20160: }
20161: break;
20162:
20163:
20164:
20165:
20166: case 0x1c + 0:
20167: d = cirPeekLong (a) >>> 16;
20168: break;
20169: case 0x1c + 2:
20170: d = (char) cirPeekLong (a - 2);
20171: break;
20172: }
20173: return d;
20174: }
20175:
20176:
20177:
20178: public int cirPeekLong (int a) {
20179: a &= 0x1e;
20180: int d = -1;
20181: switch (a) {
20182:
20183:
20184:
20185:
20186:
20187:
20188:
20189:
20190:
20191: case 0x10:
20192: if (cirStage == CIR_DESTINATION_OPERAND && cirOperandIndex < cirOperandLength) {
20193: d = cirOperandBuffer[cirOperandIndex];
20194: } else if (cirStage == CIR_FSAVE_STATE_FRAME && cirOperandIndex < cirOperandLength) {
20195: d = cirOperandBuffer[cirOperandLength - cirOperandIndex - 1];
20196: } else {
20197:
20198:
20199: }
20200: break;
20201:
20202:
20203:
20204:
20205: case 0x1c:
20206: d = cirOperandAddress;
20207: break;
20208: }
20209: return d;
20210: }
20211:
20212:
20213:
20214: public int cirReadByteZero (int a) {
20215:
20216: return (a & 1) == 0 ? cirReadWordZero (a) >>> 8 : cirReadWordZero (a - 1) & 255;
20217: }
20218:
20219:
20220:
20221: public int cirReadWordZero (int a) {
20222: a &= 0x1e;
20223: int d = 65535;
20224: switch (a) {
20225: case 0x00:
20226: d = (char) cirResponse;
20227: if (d != cirResponse) {
20228: cirResponse >>>= 16;
20229: if (d == 0x0802) {
20230: cirIdle (0x0802);
20231: }
20232: }
20233: break;
20234:
20235: case 0x04:
20236: if ((cirStage == CIR_EXCEPTION_PROCESSING && cirResponse == 0x1d0d) ||
20237: cirStage == CIR_FSAVE_STATE_FRAME ||
20238: cirStage == CIR_FRESTORE_STATE_FRAME) {
20239: d = 0x0200;
20240: cirException (0x1d0d);
20241: } else {
20242: int i;
20243: if ((cirStage & (CIR_INPUT_MASK | CIR_OUTPUT_MASK)) == 0) {
20244: d = 0x1f38;
20245: i = 0;
20246: } else {
20247: d = 0x1fd4;
20248: i = 3 * 8;
20249: }
20250:
20251: cirOperandBuffer[i++] = epbFpcr;
20252: cirOperandBuffer[i++] = epbFpsr;
20253: cirOperandBuffer[i++] = epbFpiar;
20254: cirOperandBuffer[i++] = epbQuotient;
20255: cirOperandBuffer[i++] = epbRoundingPrec;
20256: cirOperandBuffer[i++] = epbRoundingMode;
20257: cirOperandBuffer[i++] = cirResponse;
20258: cirOperandBuffer[i++] = cirFormatWord;
20259: cirOperandBuffer[i++] = cirOperationWord;
20260: cirOperandBuffer[i++] = cirCommand;
20261: cirOperandBuffer[i++] = cirRegisterList;
20262: cirOperandBuffer[i++] = cirOperandAddress;
20263: cirOperandBuffer[i++] = cirOperandLength;
20264: cirOperandBuffer[i++] = cirOperandIndex;
20265: cirOperandBuffer[i++] = cirStage;
20266: cirFormatWord = d;
20267: cirOperandLength = (d & 255) >>> 2;
20268: cirOperandIndex = 0;
20269: cirStage = CIR_FSAVE_STATE_FRAME;
20270: cirResponse = 0x0900;
20271: }
20272: break;
20273: case 0x06:
20274: d = (char) cirFormatWord;
20275: break;
20276: case 0x08:
20277: d = (char) cirOperationWord;
20278: break;
20279:
20280:
20281:
20282:
20283: case 0x10 + 0:
20284:
20285: d = cirReadLong (a) >>> 16;
20286: break;
20287: case 0x10 + 2:
20288: d = (char) cirReadLong (a + 2);
20289: break;
20290: case 0x14:
20291: if (cirStage == CIR_REGISTER_SELECT) {
20292:
20293:
20294:
20295:
20296: d = cirRegisterList << 8;
20297: cirGen ();
20298: } else {
20299: cirException (0x1d0d);
20300: }
20301: break;
20302:
20303:
20304:
20305:
20306: case 0x1c + 0:
20307: d = cirReadLong (a) >>> 16;
20308: break;
20309: case 0x1c + 2:
20310: d = (char) cirReadLong (a - 2);
20311: break;
20312: }
20313: if (CIR_DEBUG_TRACE) {
20314: System.out.printf ("%08x cirReadWordZero(0x%08x,0x%04x)\n", XEiJ.regPC0, a, d);
20315: }
20316: return d;
20317: }
20318:
20319:
20320:
20321: public int cirReadLong (int a) {
20322: a &= 0x1e;
20323: int d = -1;
20324: switch (a) {
20325:
20326:
20327:
20328:
20329:
20330:
20331:
20332:
20333:
20334: case 0x10:
20335: if (cirStage == CIR_DESTINATION_OPERAND && cirOperandIndex < cirOperandLength) {
20336: d = cirOperandBuffer[cirOperandIndex];
20337: cirOperandIndex++;
20338: if (cirOperandIndex == cirOperandLength) {
20339: cirGen ();
20340: }
20341: } else if (cirStage == CIR_FSAVE_STATE_FRAME && cirOperandIndex < cirOperandLength) {
20342: d = cirOperandBuffer[cirOperandLength - cirOperandIndex - 1];
20343: cirOperandIndex++;
20344: if (cirOperandIndex == cirOperandLength) {
20345: cirIdle (0x0802);
20346: }
20347: } else {
20348:
20349: cirException (0x1d0d);
20350: }
20351: break;
20352:
20353:
20354:
20355:
20356:
20357: case 0x1c:
20358: d = cirOperandAddress;
20359: break;
20360: }
20361: if (CIR_DEBUG_TRACE) {
20362: System.out.printf ("%08x cirReadLong(0x%08x,0x%08x)\n", XEiJ.regPC0, a, d);
20363: }
20364: return d;
20365: }
20366:
20367:
20368:
20369: public void cirWriteByte (int a, int d) {
20370: }
20371:
20372:
20373:
20374: public void cirWriteWord (int a, int d) {
20375: if (CIR_DEBUG_TRACE) {
20376: System.out.printf ("%08x cirWriteWordZero(0x%08x,0x%04x)\n", XEiJ.regPC0, a, d);
20377: }
20378: d &= 65535;
20379: switch (a & 0x1e) {
20380:
20381: case 0x02:
20382:
20383:
20384:
20385: if (cirStage == CIR_EXCEPTION_PROCESSING) {
20386: cirIdle (0x0802);
20387: return;
20388: } else if ((d & 1) != 0) {
20389: cirIdle (0x0802);
20390: return;
20391: }
20392: break;
20393:
20394: case 0x06:
20395: if (d >>> 8 == 0) {
20396: cirFormatWord = d;
20397:
20398: for (int n = 0; n < 8; n++) {
20399: epbFPn[n].setnan ();
20400: }
20401:
20402: epbFpcr = 0;
20403: epbFpsr = 0;
20404: cirIdle (0x0802);
20405: } else if (d == 0x1f38 || d == 0x1fd4) {
20406: cirFormatWord = d;
20407: cirOperandLength = (d & 255) >>> 2;
20408: cirOperandIndex = 0;
20409: cirStage = CIR_FRESTORE_STATE_FRAME;
20410: cirResponse = 0x0900;
20411: } else {
20412: cirFormatWord = 0x0200;
20413: }
20414: return;
20415: case 0x08:
20416:
20417:
20418: cirOperationWord = d;
20419: return;
20420: case 0x0a:
20421: if (cirStage == CIR_IDLE) {
20422: cirCommand = d;
20423: cirGen ();
20424: return;
20425: }
20426: break;
20427: case 0x0c:
20428:
20429: return;
20430: case 0x0e:
20431:
20432: if (cirStage == CIR_IDLE) {
20433: d &= 0x3f;
20434: if ((d & 0x20) != 0 && (epbFpsr & XEiJ.FPU_FPSR_NAN) != 0) {
20435: epbFpsr |= XEiJ.FPU_FPSR_EXC_BSUN;
20436: epbFpsr |= XEiJ.FPU_FPSR_EXC_TO_AEXC[epbFpsr >> 8 & 255];
20437: if ((epbFpcr & XEiJ.FPU_FPCR_BSUN) != 0) {
20438: cirException (0x5c30);
20439: return;
20440: }
20441: }
20442: cirResponse = XEiJ.FPU_CCMAP_882[d << 4 | epbFpsr >> 24 & 15] ? 0x0802_0801 : 0x0802_0800;
20443: return;
20444: }
20445: break;
20446:
20447:
20448: case 0x16:
20449:
20450: return;
20451:
20452:
20453: }
20454: cirException (0x1d0d);
20455: }
20456:
20457:
20458:
20459: public void cirWriteLong (int a, int d) {
20460: if (CIR_DEBUG_TRACE) {
20461: System.out.printf ("%08x cirWriteLongZero(0x%08x,0x%08x)\n", XEiJ.regPC0, a, d);
20462: }
20463: switch (a & 0x1e) {
20464:
20465:
20466:
20467:
20468:
20469:
20470: case 0x0c:
20471:
20472: return;
20473:
20474: case 0x10:
20475: if ((cirStage & CIR_INPUT_MASK) != 0 && cirOperandIndex < cirOperandLength) {
20476: cirOperandBuffer[cirOperandIndex++] = d;
20477: if (cirOperandIndex == cirOperandLength) {
20478: if (cirStage == CIR_DYNAMIC_K_FACTOR ||
20479: cirStage == CIR_DYNAMIC_REGISTER_LIST ||
20480: cirStage == CIR_SOURCE_OPERAND) {
20481: cirGen ();
20482: } else if (cirStage == CIR_FRESTORE_STATE_FRAME) {
20483: int i = cirFormatWord == 0x1f38 ? 0 : 3 * 8;
20484:
20485: epbFpcr = cirOperandBuffer[i++] & EPB_FPCR_ALL;
20486: epbFpsr = cirOperandBuffer[i++] & EPB_FPSR_ALL;
20487: epbFpiar = cirOperandBuffer[i++];
20488: epbQuotient = cirOperandBuffer[i++];
20489: epbRoundingPrec = cirOperandBuffer[i++];
20490: epbRoundingMode = cirOperandBuffer[i++];
20491: cirResponse = cirOperandBuffer[i++];
20492: cirFormatWord = cirOperandBuffer[i++];
20493: cirOperationWord = cirOperandBuffer[i++];
20494: cirCommand = cirOperandBuffer[i++];
20495: cirRegisterList = cirOperandBuffer[i++];
20496: cirOperandAddress = cirOperandBuffer[i++];
20497: cirOperandLength = cirOperandBuffer[i++];
20498: cirOperandIndex = cirOperandBuffer[i++];
20499: cirStage = cirOperandBuffer[i++];
20500: }
20501: }
20502: return;
20503: }
20504: break;
20505:
20506: case 0x16:
20507:
20508: return;
20509: case 0x18:
20510: if (cirStage == CIR_PROGRAM_COUNTER) {
20511:
20512:
20513: epbFpiar = d;
20514: cirGen ();
20515: return;
20516: }
20517: break;
20518: case 0x1c:
20519: cirOperandAddress = d;
20520: break;
20521: }
20522: cirException (0x1d0d);
20523: }
20524:
20525:
20526:
20527:
20528:
20529:
20530: @SuppressWarnings ("fallthrough") public void cirGen () {
20531: if (CIR_DEBUG_TRACE) {
20532: System.out.printf ("%08x cirGen(command=0x%04x,stage=%d(%s))\n", XEiJ.regPC0, cirCommand, cirStage, cirNameOfStage[cirStage & 15]);
20533: }
20534:
20535:
20536:
20537:
20538: int mmm = cirCommand >> 10 & 7;
20539: int nnn = cirCommand >> 7 & 7;
20540: int ccccccc = cirCommand & 0x7f;
20541:
20542:
20543: switch (cirCommand >> 13) {
20544:
20545:
20546: case 0b010:
20547: if (cirStage == CIR_IDLE) {
20548: epbFpsr &= 0x00ff00ff;
20549: epbSetRoundingPrec (epbFpcr >> 6 & 3);
20550: epbSetRoundingMode (epbFpcr >> 4 & 3);
20551: }
20552:
20553: switch (mmm) {
20554:
20555: case 0b000:
20556:
20557:
20558:
20559:
20560:
20561:
20562:
20563:
20564:
20565:
20566: if (cirStage == CIR_IDLE) {
20567: if ((epbFpcr & 0x0000ff00) != 0) {
20568: cirResponse = 0x8900_d504;
20569: cirStage = CIR_PROGRAM_COUNTER;
20570: } else {
20571: cirResponse = 0x8900_9504;
20572: cirOperandLength = 1;
20573: cirOperandIndex = 0;
20574: cirStage = CIR_SOURCE_OPERAND;
20575: }
20576: return;
20577: }
20578: if (cirStage == CIR_PROGRAM_COUNTER) {
20579: cirOperandLength = 1;
20580: cirOperandIndex = 0;
20581: cirStage = CIR_SOURCE_OPERAND;
20582: return;
20583: }
20584: if (cirStage == CIR_SOURCE_OPERAND) {
20585: epbFPn[mmm = EPB_SRC_TMP].seti (cirOperandBuffer[0]);
20586: if (cirPreInstruction ()) {
20587: return;
20588: }
20589: }
20590: break;
20591:
20592: case 0b001:
20593:
20594:
20595:
20596:
20597:
20598:
20599:
20600:
20601:
20602:
20603: if (cirStage == CIR_IDLE) {
20604: if ((epbFpcr & 0x0000ff00) != 0) {
20605: if ((epbMode & EPB_MODE_MC68882) != 0) {
20606: cirResponse = 0x8900_5504;
20607: } else {
20608: cirResponse = 0x8900_d504;
20609: }
20610: cirStage = CIR_PROGRAM_COUNTER;
20611: } else {
20612: if ((epbMode & EPB_MODE_MC68882) != 0) {
20613: cirResponse = 0x8900_1504;
20614: } else {
20615: cirResponse = 0x8900_9504;
20616: }
20617: cirOperandLength = 1;
20618: cirOperandIndex = 0;
20619: cirStage = CIR_SOURCE_OPERAND;
20620: }
20621: return;
20622: }
20623: if (cirStage == CIR_PROGRAM_COUNTER) {
20624: cirOperandLength = 1;
20625: cirOperandIndex = 0;
20626: cirStage = CIR_SOURCE_OPERAND;
20627: return;
20628: }
20629: if (cirStage == CIR_SOURCE_OPERAND) {
20630: epbFPn[mmm = EPB_SRC_TMP].setf0 (cirOperandBuffer[0]);
20631: if (cirPreInstruction ()) {
20632: return;
20633: }
20634: }
20635: break;
20636:
20637: case 0b010:
20638:
20639:
20640:
20641:
20642:
20643:
20644:
20645:
20646:
20647:
20648:
20649:
20650:
20651:
20652:
20653:
20654: if (cirStage == CIR_IDLE) {
20655: if ((epbFpcr & 0x0000ff00) != 0) {
20656: if ((epbMode & EPB_MODE_MC68882) != 0) {
20657: cirResponse = 0x8900_560c;
20658: } else {
20659: cirResponse = 0x8900_d60c;
20660: }
20661: cirStage = CIR_PROGRAM_COUNTER;
20662: } else {
20663: if ((epbMode & EPB_MODE_MC68882) != 0) {
20664: cirResponse = 0x8900_160c;
20665: } else {
20666: cirResponse = 0x8900_960c;
20667: }
20668: cirOperandLength = 3;
20669: cirOperandIndex = 0;
20670: cirStage = CIR_SOURCE_OPERAND;
20671: }
20672: return;
20673: }
20674: if (cirStage == CIR_PROGRAM_COUNTER) {
20675: cirOperandLength = 3;
20676: cirOperandIndex = 0;
20677: cirStage = CIR_SOURCE_OPERAND;
20678: return;
20679: }
20680: if (cirStage == CIR_SOURCE_OPERAND) {
20681: if (epbIsTriple ()) {
20682: epbFPn[mmm = EPB_SRC_TMP].sety012 (cirOperandBuffer[0], (long) cirOperandBuffer[1] << 32 | cirOperandBuffer[2] & 0xffffffffL);
20683: } else {
20684: epbFPn[mmm = EPB_SRC_TMP].setx012 (cirOperandBuffer[0], (long) cirOperandBuffer[1] << 32 | cirOperandBuffer[2] & 0xffffffffL);
20685: }
20686: if (cirPreInstruction ()) {
20687: return;
20688: }
20689: }
20690: break;
20691:
20692: case 0b011:
20693:
20694:
20695:
20696:
20697:
20698:
20699:
20700:
20701:
20702:
20703:
20704:
20705:
20706:
20707:
20708:
20709: if (cirStage == CIR_IDLE) {
20710: if ((epbFpcr & 0x0000ff00) != 0) {
20711: cirResponse = 0x8900_d60c;
20712: cirStage = CIR_PROGRAM_COUNTER;
20713: } else {
20714: cirResponse = 0x8900_960c;
20715: cirOperandLength = 3;
20716: cirOperandIndex = 0;
20717: cirStage = CIR_SOURCE_OPERAND;
20718: }
20719: return;
20720: }
20721: if (cirStage == CIR_PROGRAM_COUNTER) {
20722: cirOperandLength = 3;
20723: cirOperandIndex = 0;
20724: cirStage = CIR_SOURCE_OPERAND;
20725: return;
20726: }
20727: if (cirStage == CIR_SOURCE_OPERAND) {
20728: epbFPn[mmm = EPB_SRC_TMP].setp012 (cirOperandBuffer[0], (long) cirOperandBuffer[1] << 32 | cirOperandBuffer[2] & 0xffffffffL);
20729: if (cirPreInstruction ()) {
20730: return;
20731: }
20732: }
20733: break;
20734:
20735: case 0b100:
20736:
20737:
20738:
20739:
20740:
20741:
20742:
20743:
20744:
20745:
20746:
20747:
20748:
20749:
20750:
20751:
20752:
20753: if (cirStage == CIR_IDLE) {
20754: if ((epbFpcr & 0x0000ff00) != 0) {
20755: cirResponse = 0x8900_d502;
20756: cirStage = CIR_PROGRAM_COUNTER;
20757: } else {
20758: cirResponse = 0x8900_9502;
20759: cirOperandLength = 1;
20760: cirOperandIndex = 0;
20761: cirStage = CIR_SOURCE_OPERAND;
20762: }
20763: return;
20764: }
20765: if (cirStage == CIR_PROGRAM_COUNTER) {
20766: cirOperandLength = 1;
20767: cirOperandIndex = 0;
20768: cirStage = CIR_SOURCE_OPERAND;
20769: return;
20770: }
20771: if (cirStage == CIR_SOURCE_OPERAND) {
20772: epbFPn[mmm = EPB_SRC_TMP].seti (cirOperandBuffer[0] >> 16);
20773: if (cirPreInstruction ()) {
20774: return;
20775: }
20776: }
20777: break;
20778:
20779: case 0b101:
20780:
20781:
20782:
20783:
20784:
20785:
20786:
20787:
20788:
20789:
20790:
20791:
20792:
20793: if (cirStage == CIR_IDLE) {
20794: if ((epbFpcr & 0x0000ff00) != 0) {
20795: if ((epbMode & EPB_MODE_MC68882) != 0) {
20796: cirResponse = 0x8900_5608;
20797: } else {
20798: cirResponse = 0x8900_d608;
20799: }
20800: cirStage = CIR_PROGRAM_COUNTER;
20801: } else {
20802: if ((epbMode & EPB_MODE_MC68882) != 0) {
20803: cirResponse = 0x8900_1608;
20804: } else {
20805: cirResponse = 0x8900_9608;
20806: }
20807: cirOperandLength = 2;
20808: cirOperandIndex = 0;
20809: cirStage = CIR_SOURCE_OPERAND;
20810: }
20811: return;
20812: }
20813: if (cirStage == CIR_PROGRAM_COUNTER) {
20814: cirOperandLength = 2;
20815: cirOperandIndex = 0;
20816: cirStage = CIR_SOURCE_OPERAND;
20817: return;
20818: }
20819: if (cirStage == CIR_SOURCE_OPERAND) {
20820: epbFPn[mmm = EPB_SRC_TMP].setd01 ((long) cirOperandBuffer[0] << 32 | cirOperandBuffer[1] & 0xffffffffL);
20821: if (cirPreInstruction ()) {
20822: return;
20823: }
20824: }
20825: break;
20826:
20827: case 0b110:
20828:
20829:
20830:
20831:
20832:
20833:
20834:
20835:
20836:
20837:
20838:
20839:
20840:
20841:
20842:
20843:
20844:
20845: if (cirStage == CIR_IDLE) {
20846: if ((epbFpcr & 0x0000ff00) != 0) {
20847: cirResponse = 0x8900_d501;
20848: cirStage = CIR_PROGRAM_COUNTER;
20849: } else {
20850: cirResponse = 0x8900_9501;
20851: cirOperandLength = 1;
20852: cirOperandIndex = 0;
20853: cirStage = CIR_SOURCE_OPERAND;
20854: }
20855: return;
20856: }
20857: if (cirStage == CIR_PROGRAM_COUNTER) {
20858: cirOperandLength = 1;
20859: cirOperandIndex = 0;
20860: cirStage = CIR_SOURCE_OPERAND;
20861: return;
20862: }
20863: if (cirStage == CIR_SOURCE_OPERAND) {
20864: epbFPn[mmm = EPB_SRC_TMP].seti (cirOperandBuffer[0] >> 24);
20865: if (cirPreInstruction ()) {
20866: return;
20867: }
20868: }
20869: break;
20870:
20871: case 0b111:
20872:
20873:
20874:
20875:
20876:
20877:
20878:
20879:
20880:
20881:
20882:
20883:
20884:
20885:
20886:
20887:
20888:
20889:
20890:
20891:
20892:
20893:
20894: default:
20895: if (0x40 <= ccccccc) {
20896:
20897:
20898: cirException (0x1c0b);
20899: return;
20900: }
20901: if (false) {
20902: mmm = EPB_CONST_START + ccccccc;
20903: ccccccc = 0;
20904: } else {
20905:
20906: epbFmovecr (epbFPn[nnn], ccccccc);
20907: if (cirMidInstruction ()) {
20908: return;
20909: }
20910:
20911: cirIdle (0x0802);
20912: return;
20913: }
20914:
20915: }
20916:
20917:
20918:
20919:
20920:
20921: case 0b000:
20922: if (cirStage == CIR_IDLE) {
20923: epbFpsr &= 0x00ff00ff;
20924: }
20925:
20926: switch (ccccccc) {
20927:
20928: case 0b000_0000:
20929:
20930:
20931:
20932:
20933:
20934:
20935:
20936:
20937:
20938:
20939:
20940:
20941:
20942:
20943:
20944:
20945:
20946:
20947:
20948:
20949:
20950: epbFPn[nnn].sete (epbFPn[mmm]).finish ();
20951: break;
20952:
20953: case 0b000_0001:
20954:
20955:
20956:
20957:
20958:
20959:
20960:
20961:
20962:
20963:
20964:
20965:
20966:
20967:
20968:
20969:
20970:
20971:
20972:
20973:
20974:
20975:
20976:
20977:
20978: epbSetRoundingPrec (EPB_PREC_EXD);
20979: epbFPn[nnn].round (epbFPn[mmm], epbRoundingMode);
20980: break;
20981:
20982: case 0b000_0010:
20983:
20984:
20985:
20986:
20987:
20988:
20989:
20990:
20991:
20992:
20993:
20994:
20995:
20996:
20997:
20998:
20999:
21000:
21001:
21002:
21003:
21004: epbFPn[nnn].sinh (epbFPn[mmm]);
21005: break;
21006:
21007: case 0b000_0011:
21008:
21009:
21010:
21011:
21012:
21013:
21014:
21015:
21016:
21017:
21018: epbSetRoundingPrec (EPB_PREC_EXD);
21019: epbFPn[nnn].trunc (epbFPn[mmm]);
21020: break;
21021:
21022: case 0b000_0100:
21023: case 0b000_0101:
21024:
21025:
21026:
21027:
21028:
21029:
21030:
21031:
21032:
21033:
21034: epbFPn[nnn].sqrt (epbFPn[mmm]);
21035: break;
21036:
21037: case 0b000_0110:
21038: case 0b000_0111:
21039:
21040:
21041:
21042:
21043:
21044:
21045:
21046:
21047:
21048: epbFPn[nnn].log1p (epbFPn[mmm]);
21049: break;
21050:
21051: case 0b000_1000:
21052:
21053:
21054:
21055:
21056:
21057:
21058:
21059:
21060: epbFPn[nnn].expm1 (epbFPn[mmm]);
21061: break;
21062:
21063: case 0b000_1001:
21064:
21065:
21066:
21067:
21068:
21069:
21070:
21071:
21072: epbFPn[nnn].tanh (epbFPn[mmm]);
21073: break;
21074:
21075: case 0b000_1010:
21076: case 0b000_1011:
21077:
21078:
21079:
21080:
21081:
21082:
21083:
21084:
21085: epbFPn[nnn].atan (epbFPn[mmm]);
21086: break;
21087:
21088: case 0b000_1100:
21089:
21090:
21091:
21092:
21093:
21094:
21095:
21096:
21097: epbFPn[nnn].asin (epbFPn[mmm]);
21098: break;
21099:
21100: case 0b000_1101:
21101:
21102:
21103:
21104:
21105:
21106:
21107:
21108:
21109:
21110: epbFPn[nnn].atanh (epbFPn[mmm]);
21111: break;
21112:
21113: case 0b000_1110:
21114:
21115:
21116:
21117:
21118:
21119:
21120:
21121:
21122: epbFPn[nnn].sin (epbFPn[mmm]);
21123: break;
21124:
21125: case 0b000_1111:
21126:
21127:
21128:
21129:
21130:
21131:
21132:
21133:
21134:
21135: epbFPn[nnn].tan (epbFPn[mmm]);
21136: break;
21137:
21138: case 0b001_0000:
21139:
21140:
21141:
21142:
21143:
21144:
21145:
21146:
21147: epbFPn[nnn].exp (epbFPn[mmm]);
21148: break;
21149:
21150: case 0b001_0001:
21151:
21152:
21153:
21154:
21155:
21156:
21157:
21158:
21159: epbFPn[nnn].exp2 (epbFPn[mmm]);
21160: break;
21161:
21162: case 0b001_0010:
21163: case 0b001_0011:
21164:
21165:
21166:
21167:
21168:
21169:
21170:
21171:
21172: epbFPn[nnn].exp10 (epbFPn[mmm]);
21173: break;
21174:
21175: case 0b001_0100:
21176:
21177:
21178:
21179:
21180:
21181:
21182:
21183:
21184:
21185:
21186: epbFPn[nnn].log (epbFPn[mmm]);
21187: break;
21188:
21189: case 0b001_0101:
21190:
21191:
21192:
21193:
21194:
21195:
21196:
21197:
21198: epbFPn[nnn].log10 (epbFPn[mmm]);
21199: break;
21200:
21201: case 0b001_0110:
21202: case 0b001_0111:
21203:
21204:
21205:
21206:
21207:
21208:
21209:
21210:
21211: epbFPn[nnn].log2 (epbFPn[mmm]);
21212: break;
21213:
21214: case 0b001_1000:
21215:
21216:
21217:
21218:
21219:
21220:
21221:
21222:
21223: epbFPn[nnn].abs (epbFPn[mmm]);
21224: break;
21225:
21226: case 0b001_1001:
21227:
21228:
21229:
21230:
21231:
21232:
21233:
21234:
21235: epbFPn[nnn].cosh (epbFPn[mmm]);
21236: break;
21237:
21238: case 0b001_1010:
21239: case 0b001_1011:
21240:
21241:
21242:
21243:
21244:
21245:
21246:
21247:
21248: epbFPn[nnn].neg (epbFPn[mmm]);
21249: break;
21250:
21251: case 0b001_1100:
21252:
21253:
21254:
21255:
21256:
21257:
21258:
21259:
21260:
21261:
21262: epbFPn[nnn].acos (epbFPn[mmm]);
21263: break;
21264:
21265: case 0b001_1101:
21266:
21267:
21268:
21269:
21270:
21271:
21272:
21273:
21274:
21275: epbFPn[nnn].cos (epbFPn[mmm]);
21276: break;
21277:
21278: case 0b001_1110:
21279:
21280:
21281:
21282:
21283:
21284:
21285:
21286:
21287: epbFPn[nnn].getexp (epbFPn[mmm]);
21288: break;
21289:
21290: case 0b001_1111:
21291:
21292:
21293:
21294:
21295:
21296:
21297:
21298:
21299: epbFPn[nnn].getman (epbFPn[mmm]);
21300: break;
21301:
21302: case 0b010_0000:
21303:
21304:
21305:
21306:
21307:
21308:
21309:
21310:
21311: epbFPn[nnn].div (epbFPn[mmm]);
21312: break;
21313:
21314: case 0b010_0001:
21315:
21316:
21317:
21318:
21319:
21320:
21321:
21322:
21323:
21324:
21325: epbFPn[nnn].rem (epbFPn[mmm]);
21326: break;
21327:
21328: case 0b010_0010:
21329:
21330:
21331:
21332:
21333:
21334:
21335:
21336:
21337: epbFPn[nnn].add (epbFPn[mmm]);
21338: break;
21339:
21340: case 0b010_0011:
21341:
21342:
21343:
21344:
21345:
21346:
21347:
21348:
21349: epbFPn[nnn].mul (epbFPn[mmm]);
21350: break;
21351:
21352: case 0b010_0100:
21353:
21354:
21355:
21356:
21357:
21358:
21359:
21360:
21361: epbSetRoundingPrec (EPB_PREC_XSG);
21362: epbFPn[nnn].div (epbFPn[mmm]);
21363: break;
21364:
21365: case 0b010_0101:
21366:
21367:
21368:
21369:
21370:
21371:
21372:
21373:
21374:
21375:
21376:
21377:
21378: epbFPn[nnn].ieeerem (epbFPn[mmm]);
21379: break;
21380:
21381: case 0b010_0110:
21382:
21383:
21384:
21385:
21386:
21387:
21388:
21389:
21390:
21391: epbFPn[nnn].scale (epbFPn[mmm]);
21392: break;
21393:
21394: case 0b010_0111:
21395:
21396:
21397:
21398:
21399:
21400:
21401:
21402:
21403: {
21404:
21405: int sr = epbFpsr;
21406: epbFPn[EPB_SRC_TMP].roundmanf (epbFPn[mmm], EPB_MODE_RZ);
21407: epbFPn[EPB_DST_TMP].roundmanf (epbFPn[nnn], EPB_MODE_RZ);
21408: epbFpsr = sr;
21409: }
21410: epbSetRoundingPrec (EPB_PREC_XSG);
21411: epbFPn[nnn].mul (epbFPn[EPB_DST_TMP], epbFPn[EPB_SRC_TMP]);
21412: break;
21413:
21414: case 0b010_1000:
21415: case 0b010_1001:
21416: case 0b010_1010:
21417: case 0b010_1011:
21418: case 0b010_1100:
21419: case 0b010_1101:
21420: case 0b010_1110:
21421: case 0b010_1111:
21422:
21423:
21424:
21425:
21426:
21427:
21428:
21429:
21430: epbFPn[nnn].sub (epbFPn[mmm]);
21431: break;
21432:
21433: case 0b011_0000:
21434: case 0b011_0001:
21435: case 0b011_0010:
21436: case 0b011_0011:
21437: case 0b011_0100:
21438: case 0b011_0101:
21439: case 0b011_0110:
21440: case 0b011_0111:
21441:
21442:
21443:
21444:
21445:
21446:
21447:
21448:
21449:
21450: {
21451: int ccc = ccccccc & 7;
21452:
21453: epbFPn[EPB_SRC_TMP].sete (epbFPn[mmm]);
21454: epbFPn[ccc].cos (epbFPn[EPB_SRC_TMP]);
21455: epbFPn[nnn].sin (epbFPn[EPB_SRC_TMP]);
21456: }
21457: break;
21458:
21459: case 0b011_1000:
21460: case 0b011_1001:
21461: case 0b011_1100:
21462: case 0b011_1101:
21463:
21464:
21465:
21466:
21467:
21468:
21469:
21470:
21471:
21472:
21473:
21474:
21475:
21476: {
21477: int xf = epbFPn[nnn].flg;
21478: int yf = epbFPn[mmm].flg;
21479: if ((xf | yf) << 3 < 0) {
21480:
21481: epbFPn[EPB_DST_TMP].flg = N;
21482: } else {
21483: int i = ((xf & yf) << 1 < 0 ? 0 :
21484: epbFPn[nnn].compareTo (epbFPn[mmm]));
21485: if (i == 0) {
21486: if (xf < 0) {
21487:
21488: epbFPn[EPB_DST_TMP].flg = M | Z;
21489: } else {
21490:
21491: epbFPn[EPB_DST_TMP].flg = P | Z;
21492: }
21493: } else if (i < 0) {
21494: epbFPn[EPB_DST_TMP].negset1 ();
21495: } else {
21496: epbFPn[EPB_DST_TMP].set1 ();
21497: }
21498: }
21499: nnn = EPB_DST_TMP;
21500: }
21501: break;
21502:
21503: case 0b011_1010:
21504: case 0b011_1011:
21505: case 0b011_1110:
21506: case 0b011_1111:
21507:
21508:
21509:
21510:
21511:
21512:
21513:
21514:
21515:
21516:
21517:
21518: epbFPn[EPB_DST_TMP].sete (epbFPn[mmm]);
21519: nnn = EPB_DST_TMP;
21520: break;
21521:
21522: case 0b100_0000:
21523:
21524:
21525:
21526:
21527:
21528:
21529:
21530:
21531: epbSetRoundingPrec (EPB_PREC_SGL);
21532: epbFPn[nnn].sete (epbFPn[mmm]).finish ();
21533: break;
21534:
21535: case 0b100_0001:
21536:
21537:
21538:
21539:
21540:
21541:
21542:
21543:
21544: epbSetRoundingPrec (EPB_PREC_SGL);
21545: epbFPn[nnn].sqrt (epbFPn[mmm]);
21546: break;
21547:
21548:
21549:
21550:
21551: case 0b100_0100:
21552:
21553:
21554:
21555:
21556:
21557:
21558:
21559:
21560: epbSetRoundingPrec (EPB_PREC_DBL);
21561: epbFPn[nnn].sete (epbFPn[mmm]).finish ();
21562: break;
21563:
21564: case 0b100_0101:
21565:
21566:
21567:
21568:
21569:
21570:
21571:
21572:
21573: epbSetRoundingPrec (EPB_PREC_DBL);
21574: epbFPn[nnn].sqrt (epbFPn[mmm]);
21575: break;
21576:
21577:
21578:
21579:
21580:
21581:
21582:
21583:
21584:
21585:
21586:
21587:
21588:
21589:
21590:
21591:
21592:
21593:
21594:
21595:
21596: case 0b101_1000:
21597:
21598:
21599:
21600:
21601:
21602:
21603:
21604:
21605: epbSetRoundingPrec (EPB_PREC_SGL);
21606: epbFPn[nnn].abs (epbFPn[mmm]);
21607: break;
21608:
21609:
21610:
21611: case 0b101_1010:
21612:
21613:
21614:
21615:
21616:
21617:
21618:
21619:
21620: epbSetRoundingPrec (EPB_PREC_SGL);
21621: epbFPn[nnn].neg (epbFPn[mmm]);
21622: break;
21623:
21624:
21625:
21626: case 0b101_1100:
21627:
21628:
21629:
21630:
21631:
21632:
21633:
21634:
21635: epbSetRoundingPrec (EPB_PREC_DBL);
21636: epbFPn[nnn].abs (epbFPn[mmm]);
21637: break;
21638:
21639:
21640:
21641: case 0b101_1110:
21642:
21643:
21644:
21645:
21646:
21647:
21648:
21649:
21650: epbSetRoundingPrec (EPB_PREC_DBL);
21651: epbFPn[nnn].neg (epbFPn[mmm]);
21652: break;
21653:
21654:
21655:
21656: case 0b110_0000:
21657:
21658:
21659:
21660:
21661:
21662:
21663:
21664:
21665: epbSetRoundingPrec (EPB_PREC_SGL);
21666: epbFPn[nnn].div (epbFPn[mmm]);
21667: break;
21668:
21669:
21670:
21671: case 0b110_0010:
21672:
21673:
21674:
21675:
21676:
21677:
21678:
21679:
21680: epbSetRoundingPrec (EPB_PREC_SGL);
21681: epbFPn[nnn].add (epbFPn[mmm]);
21682: break;
21683:
21684: case 0b110_0011:
21685:
21686:
21687:
21688:
21689:
21690:
21691:
21692:
21693: epbSetRoundingPrec (EPB_PREC_SGL);
21694: epbFPn[nnn].mul (epbFPn[mmm]);
21695: break;
21696:
21697: case 0b110_0100:
21698:
21699:
21700:
21701:
21702:
21703:
21704:
21705:
21706: epbSetRoundingPrec (EPB_PREC_DBL);
21707: epbFPn[nnn].div (epbFPn[mmm]);
21708: break;
21709:
21710:
21711:
21712: case 0b110_0110:
21713:
21714:
21715:
21716:
21717:
21718:
21719:
21720:
21721: epbSetRoundingPrec (EPB_PREC_DBL);
21722: epbFPn[nnn].add (epbFPn[mmm]);
21723: break;
21724:
21725: case 0b110_0111:
21726:
21727:
21728:
21729:
21730:
21731:
21732:
21733:
21734: epbSetRoundingPrec (EPB_PREC_DBL);
21735: epbFPn[nnn].mul (epbFPn[mmm]);
21736: break;
21737:
21738: case 0b110_1000:
21739:
21740:
21741:
21742:
21743:
21744:
21745:
21746:
21747: epbSetRoundingPrec (EPB_PREC_SGL);
21748: epbFPn[nnn].sub (epbFPn[mmm]);
21749: break;
21750:
21751:
21752:
21753:
21754:
21755: case 0b110_1100:
21756:
21757:
21758:
21759:
21760:
21761:
21762:
21763:
21764:
21765:
21766:
21767:
21768:
21769:
21770:
21771:
21772:
21773:
21774:
21775:
21776:
21777:
21778:
21779:
21780: epbSetRoundingPrec (EPB_PREC_DBL);
21781: epbFPn[nnn].sub (epbFPn[mmm]);
21782: break;
21783:
21784:
21785:
21786:
21787:
21788: case 0b111_0000:
21789: if (EFPBox.EPB_EXTRA_OPERATION) {
21790: epbFPn[nnn].lgamma (epbFPn[mmm]);
21791: } else {
21792: cirException (0x1c0b);
21793: }
21794: break;
21795:
21796: case 0b111_0001:
21797: if (EFPBox.EPB_EXTRA_OPERATION) {
21798: epbFPn[nnn].tgamma (epbFPn[mmm]);
21799: } else {
21800: cirException (0x1c0b);
21801: }
21802: break;
21803:
21804:
21805:
21806:
21807:
21808:
21809:
21810:
21811:
21812:
21813:
21814:
21815:
21816:
21817:
21818:
21819: default:
21820: cirException (0x1c0b);
21821: return;
21822: }
21823:
21824: epbFpsr |= epbFPn[nnn].flg >>> 4;
21825: if (cirMidInstruction ()) {
21826: return;
21827: }
21828:
21829: cirIdle (0x0802);
21830: return;
21831:
21832:
21833: case 0b011:
21834:
21835:
21836:
21837:
21838:
21839:
21840:
21841:
21842: if (cirStage == CIR_IDLE) {
21843: epbFpsr &= 0xffff00ff;
21844: } else if (cirStage == CIR_DESTINATION_OPERAND) {
21845:
21846: cirIdle (0x0802);
21847: return;
21848: }
21849:
21850: switch (mmm) {
21851:
21852: case 0b000:
21853:
21854:
21855:
21856:
21857:
21858:
21859:
21860:
21861:
21862:
21863:
21864:
21865:
21866:
21867:
21868:
21869:
21870: cirOperandBuffer[0] = epbFPn[nnn].geti (epbRoundingMode);
21871: if (cirMidInstruction ()) {
21872: return;
21873: }
21874: cirResponse = 0x8900_b104;
21875: cirOperandLength = 1;
21876: cirOperandIndex = 0;
21877: cirStage = CIR_DESTINATION_OPERAND;
21878: break;
21879:
21880: case 0b001:
21881:
21882:
21883:
21884:
21885:
21886:
21887:
21888:
21889:
21890:
21891:
21892:
21893:
21894:
21895:
21896:
21897:
21898: cirOperandBuffer[0] = epbFPn[nnn].getf0 (epbRoundingMode);
21899: if (cirMidInstruction ()) {
21900: return;
21901: }
21902: if ((epbMode & EPB_MODE_MC68882) != 0) {
21903: cirResponse = 0x8900_3104;
21904: } else {
21905: cirResponse = 0x8900_b104;
21906: }
21907: cirOperandLength = 1;
21908: cirOperandIndex = 0;
21909: cirStage = CIR_DESTINATION_OPERAND;
21910: break;
21911:
21912: case 0b010:
21913:
21914:
21915:
21916:
21917:
21918:
21919:
21920:
21921:
21922:
21923:
21924:
21925:
21926:
21927:
21928:
21929:
21930:
21931:
21932:
21933:
21934:
21935:
21936:
21937:
21938: {
21939: byte[] b = new byte[12];
21940: if (epbIsTriple ()) {
21941: epbFPn[nnn].gety012 (b, 0, epbRoundingMode);
21942: } else {
21943: epbFPn[nnn].getx012 (b, 0, epbRoundingMode);
21944: }
21945: if (cirMidInstruction ()) {
21946: return;
21947: }
21948: cirOperandBuffer[0] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
21949: cirOperandBuffer[1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
21950: cirOperandBuffer[2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
21951: if ((epbMode & EPB_MODE_MC68882) != 0) {
21952: cirResponse = 0x8900_320c;
21953: } else {
21954: cirResponse = 0x8900_320c;
21955: }
21956: cirOperandLength = 3;
21957: cirOperandIndex = 0;
21958: cirStage = CIR_DESTINATION_OPERAND;
21959: break;
21960: }
21961:
21962: case 0b011:
21963:
21964:
21965:
21966:
21967:
21968:
21969:
21970:
21971:
21972:
21973:
21974:
21975:
21976:
21977:
21978:
21979:
21980:
21981:
21982:
21983:
21984:
21985:
21986:
21987:
21988:
21989:
21990:
21991:
21992:
21993:
21994:
21995:
21996:
21997:
21998:
21999:
22000:
22001:
22002:
22003:
22004:
22005:
22006:
22007:
22008:
22009:
22010:
22011:
22012:
22013:
22014:
22015:
22016:
22017:
22018:
22019:
22020:
22021:
22022:
22023:
22024:
22025:
22026:
22027:
22028:
22029:
22030:
22031:
22032:
22033:
22034:
22035:
22036:
22037:
22038:
22039:
22040:
22041:
22042:
22043:
22044:
22045:
22046:
22047:
22048:
22049:
22050:
22051:
22052:
22053:
22054:
22055:
22056:
22057:
22058:
22059:
22060:
22061:
22062:
22063:
22064: {
22065: byte[] b = new byte[12];
22066: epbFPn[nnn].getp012 (b, 0, ccccccc);
22067: if (cirMidInstruction ()) {
22068: return;
22069: }
22070: cirOperandBuffer[0] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
22071: cirOperandBuffer[1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
22072: cirOperandBuffer[2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
22073: cirResponse = 0x8900_b20c;
22074: cirOperandLength = 3;
22075: cirOperandIndex = 0;
22076: cirStage = CIR_DESTINATION_OPERAND;
22077: break;
22078: }
22079:
22080: case 0b100:
22081:
22082:
22083:
22084:
22085:
22086:
22087:
22088:
22089:
22090:
22091:
22092:
22093:
22094:
22095:
22096:
22097:
22098: cirOperandBuffer[0] = epbFPn[nnn].gets (epbRoundingMode) << 16;
22099: if (cirMidInstruction ()) {
22100: return;
22101: }
22102: cirResponse = 0x8900_b102;
22103: cirOperandLength = 1;
22104: cirOperandIndex = 0;
22105: cirStage = CIR_DESTINATION_OPERAND;
22106: break;
22107:
22108: case 0b101:
22109:
22110:
22111:
22112:
22113:
22114:
22115:
22116:
22117:
22118:
22119:
22120:
22121:
22122:
22123:
22124:
22125:
22126:
22127:
22128:
22129:
22130: {
22131: long l = epbFPn[nnn].getd01 (epbRoundingMode);
22132: if (cirMidInstruction ()) {
22133: return;
22134: }
22135: cirOperandBuffer[0] = (int) (l >> 32);
22136: cirOperandBuffer[1] = (int) l;
22137: if ((epbMode & EPB_MODE_MC68882) != 0) {
22138: cirResponse = 0x8900_3208;
22139: } else {
22140: cirResponse = 0x8900_b208;
22141: }
22142: cirOperandLength = 2;
22143: cirOperandIndex = 0;
22144: cirStage = CIR_DESTINATION_OPERAND;
22145: }
22146: break;
22147:
22148: case 0b110:
22149:
22150:
22151:
22152:
22153:
22154:
22155:
22156:
22157:
22158:
22159:
22160:
22161:
22162:
22163:
22164:
22165:
22166: cirOperandBuffer[0] = epbFPn[nnn].getb (epbRoundingMode) << 24;
22167: if (cirMidInstruction ()) {
22168: return;
22169: }
22170: cirResponse = 0x8900_b101;
22171: cirOperandLength = 1;
22172: cirOperandIndex = 0;
22173: cirStage = CIR_DESTINATION_OPERAND;
22174: break;
22175:
22176: case 0b111:
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: default:
22206: if (cirStage == CIR_IDLE) {
22207: cirResponse = 0x8900_8c00 + (cirCommand >> 4 & 7);
22208: cirOperandLength = 1;
22209: cirOperandIndex = 0;
22210: cirStage = CIR_DYNAMIC_K_FACTOR;
22211: return;
22212: } else if (cirStage == CIR_DYNAMIC_K_FACTOR) {
22213: byte[] b = new byte[12];
22214: epbFPn[nnn].getp012 (b, 0, cirOperandBuffer[0]);
22215: if (cirMidInstruction ()) {
22216: return;
22217: }
22218: cirOperandBuffer[0] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
22219: cirOperandBuffer[1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
22220: cirOperandBuffer[2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
22221: cirResponse = 0x8900_b20c;
22222: cirOperandLength = 3;
22223: cirOperandIndex = 0;
22224: cirStage = CIR_DESTINATION_OPERAND;
22225: }
22226: }
22227: return;
22228:
22229:
22230: case 0b100:
22231:
22232:
22233:
22234: switch (mmm) {
22235:
22236: case 0b000:
22237:
22238:
22239:
22240:
22241:
22242:
22243:
22244:
22245:
22246:
22247:
22248:
22249: case 0b001:
22250:
22251:
22252:
22253:
22254:
22255:
22256:
22257:
22258:
22259:
22260: if (cirStage == CIR_IDLE) {
22261: cirResponse = 0x8900_9704;
22262: cirOperandLength = 1;
22263: cirOperandIndex = 0;
22264: cirStage = CIR_SOURCE_OPERAND;
22265: return;
22266: } else {
22267: epbFpiar = cirOperandBuffer[0];
22268: }
22269: break;
22270:
22271: case 0b010:
22272:
22273:
22274:
22275:
22276:
22277:
22278:
22279:
22280:
22281:
22282:
22283:
22284: if (cirStage == CIR_IDLE) {
22285: cirResponse = 0x8900_9504;
22286: cirOperandLength = 1;
22287: cirOperandIndex = 0;
22288: cirStage = CIR_SOURCE_OPERAND;
22289: return;
22290: } else {
22291: epbFpsr = cirOperandBuffer[0] & EPB_FPSR_ALL;
22292: }
22293: break;
22294:
22295: case 0b011:
22296:
22297:
22298:
22299:
22300:
22301:
22302:
22303:
22304:
22305:
22306:
22307:
22308:
22309: if (cirStage == CIR_IDLE) {
22310: cirResponse = 0x8900_9608;
22311: cirOperandLength = 2;
22312: cirOperandIndex = 0;
22313: cirStage = CIR_SOURCE_OPERAND;
22314: return;
22315: } else {
22316: epbFpsr = cirOperandBuffer[0] & EPB_FPSR_ALL;
22317: epbFpiar = cirOperandBuffer[1];
22318: }
22319: break;
22320:
22321: case 0b100:
22322:
22323:
22324:
22325:
22326:
22327:
22328:
22329:
22330:
22331:
22332: if (cirStage == CIR_IDLE) {
22333: cirResponse = 0x8900_9504;
22334: cirOperandLength = 1;
22335: cirOperandIndex = 0;
22336: cirStage = CIR_SOURCE_OPERAND;
22337: return;
22338: } else {
22339: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22340: }
22341: break;
22342:
22343: case 0b101:
22344:
22345:
22346:
22347:
22348:
22349:
22350:
22351:
22352:
22353:
22354:
22355:
22356:
22357: if (cirStage == CIR_IDLE) {
22358: cirResponse = 0x8900_9608;
22359: cirOperandLength = 2;
22360: cirOperandIndex = 0;
22361: cirStage = CIR_SOURCE_OPERAND;
22362: return;
22363: } else {
22364: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22365: epbFpiar = cirOperandBuffer[1];
22366: }
22367: break;
22368:
22369: case 0b110:
22370:
22371:
22372:
22373:
22374:
22375:
22376:
22377:
22378:
22379:
22380:
22381:
22382:
22383: if (cirStage == CIR_IDLE) {
22384: cirResponse = 0x8900_9608;
22385: cirOperandLength = 2;
22386: cirOperandIndex = 0;
22387: cirStage = CIR_SOURCE_OPERAND;
22388: return;
22389: } else {
22390: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22391: epbFpsr = cirOperandBuffer[1] & EPB_FPSR_ALL;
22392: }
22393: break;
22394:
22395: case 0b111:
22396:
22397:
22398:
22399:
22400:
22401:
22402:
22403:
22404:
22405:
22406:
22407:
22408:
22409:
22410:
22411:
22412: default:
22413: if (cirStage == CIR_IDLE) {
22414: cirResponse = 0x8900_960c;
22415: cirOperandLength = 3;
22416: cirOperandIndex = 0;
22417: cirStage = CIR_SOURCE_OPERAND;
22418: return;
22419: } else {
22420: epbFpcr = cirOperandBuffer[0] & EPB_FPCR_ALL;
22421: epbFpsr = cirOperandBuffer[1] & EPB_FPSR_ALL;
22422: epbFpiar = cirOperandBuffer[2];
22423: }
22424: }
22425:
22426: cirIdle (0x0802);
22427: return;
22428:
22429:
22430: case 0b101:
22431:
22432:
22433: if (cirStage == CIR_DESTINATION_OPERAND) {
22434:
22435: cirIdle (0x0802);
22436: return;
22437: }
22438:
22439: switch (mmm) {
22440:
22441: case 0b000:
22442:
22443:
22444:
22445:
22446:
22447:
22448:
22449:
22450:
22451:
22452:
22453:
22454:
22455: case 0b001:
22456:
22457:
22458:
22459:
22460:
22461:
22462:
22463:
22464:
22465:
22466:
22467: cirOperandBuffer[0] = epbFpiar;
22468: cirResponse = 0x8900_b304;
22469: cirOperandLength = 1;
22470: cirOperandIndex = 0;
22471: cirStage = CIR_DESTINATION_OPERAND;
22472: return;
22473:
22474: case 0b010:
22475:
22476:
22477:
22478:
22479:
22480:
22481:
22482:
22483:
22484:
22485:
22486: cirOperandBuffer[0] = epbFpsr;
22487: cirResponse = 0x8900_b104;
22488: cirOperandLength = 1;
22489: cirOperandIndex = 0;
22490: cirStage = CIR_DESTINATION_OPERAND;
22491: return;
22492:
22493: case 0b011:
22494:
22495:
22496:
22497:
22498:
22499:
22500:
22501:
22502:
22503:
22504:
22505:
22506:
22507:
22508:
22509: cirOperandBuffer[0] = epbFpsr;
22510: cirOperandBuffer[1] = epbFpiar;
22511: cirResponse = 0x8900_b208;
22512: cirOperandLength = 2;
22513: cirOperandIndex = 0;
22514: cirStage = CIR_DESTINATION_OPERAND;
22515: return;
22516:
22517: case 0b100:
22518:
22519:
22520:
22521:
22522:
22523:
22524:
22525:
22526:
22527:
22528:
22529: cirOperandBuffer[0] = epbFpcr;
22530: cirResponse = 0x8900_b104;
22531: cirOperandLength = 1;
22532: cirOperandIndex = 0;
22533: cirStage = CIR_DESTINATION_OPERAND;
22534: return;
22535:
22536: case 0b101:
22537:
22538:
22539:
22540:
22541:
22542:
22543:
22544:
22545:
22546:
22547:
22548:
22549:
22550:
22551:
22552: cirOperandBuffer[0] = epbFpcr;
22553: cirOperandBuffer[1] = epbFpiar;
22554: cirResponse = 0x8900_b208;
22555: cirOperandLength = 2;
22556: cirOperandIndex = 0;
22557: cirStage = CIR_DESTINATION_OPERAND;
22558: return;
22559:
22560: case 0b110:
22561:
22562:
22563:
22564:
22565:
22566:
22567:
22568:
22569:
22570:
22571:
22572:
22573:
22574:
22575:
22576: cirOperandBuffer[0] = epbFpcr;
22577: cirOperandBuffer[1] = epbFpsr;
22578: cirResponse = 0x8900_b208;
22579: cirOperandLength = 2;
22580: cirOperandIndex = 0;
22581: cirStage = CIR_DESTINATION_OPERAND;
22582: return;
22583:
22584: case 0b111:
22585:
22586:
22587:
22588:
22589:
22590:
22591:
22592:
22593:
22594:
22595:
22596:
22597:
22598:
22599:
22600:
22601:
22602:
22603:
22604: default:
22605: cirOperandBuffer[0] = epbFpcr;
22606: cirOperandBuffer[1] = epbFpsr;
22607: cirOperandBuffer[2] = epbFpiar;
22608: cirResponse = 0x8900_b20c;
22609: cirOperandLength = 3;
22610: cirOperandIndex = 0;
22611: cirStage = CIR_DESTINATION_OPERAND;
22612: return;
22613: }
22614:
22615:
22616:
22617: case 0b110:
22618:
22619:
22620:
22621:
22622:
22623:
22624:
22625:
22626:
22627:
22628:
22629:
22630:
22631:
22632:
22633:
22634:
22635:
22636:
22637:
22638:
22639:
22640:
22641:
22642:
22643:
22644:
22645:
22646:
22647:
22648:
22649:
22650:
22651:
22652:
22653:
22654:
22655:
22656:
22657:
22658:
22659:
22660:
22661:
22662:
22663:
22664:
22665:
22666:
22667:
22668:
22669:
22670:
22671:
22672:
22673:
22674:
22675:
22676:
22677:
22678:
22679:
22680:
22681:
22682:
22683:
22684:
22685:
22686:
22687:
22688:
22689:
22690:
22691:
22692:
22693:
22694:
22695:
22696:
22697:
22698:
22699:
22700:
22701:
22702:
22703:
22704:
22705:
22706:
22707:
22708:
22709:
22710:
22711:
22712:
22713:
22714:
22715:
22716:
22717:
22718:
22719:
22720:
22721:
22722:
22723:
22724:
22725:
22726:
22727:
22728:
22729:
22730:
22731:
22732:
22733:
22734:
22735:
22736:
22737:
22738:
22739:
22740:
22741:
22742:
22743:
22744:
22745:
22746:
22747:
22748:
22749:
22750:
22751:
22752:
22753:
22754:
22755:
22756:
22757:
22758:
22759:
22760:
22761:
22762:
22763:
22764:
22765:
22766:
22767:
22768:
22769:
22770:
22771:
22772:
22773:
22774:
22775:
22776:
22777:
22778:
22779:
22780:
22781:
22782:
22783:
22784:
22785:
22786:
22787:
22788:
22789:
22790:
22791:
22792:
22793:
22794:
22795:
22796:
22797:
22798:
22799:
22800:
22801:
22802:
22803:
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: if (cirStage == CIR_IDLE) {
22899: if ((cirCommand & 0x0700) != 0) {
22900: cirException (0x1c0b);
22901: return;
22902: }
22903: if ((mmm & 2) == 0) {
22904: cirRegisterList = cirCommand & 255;
22905: cirResponse = 0x8900_810c;
22906: cirStage = CIR_REGISTER_SELECT;
22907: } else {
22908: cirResponse = 0x8900_8c00 + (cirCommand >> 4 & 7);
22909: cirOperandLength = 1;
22910: cirOperandIndex = 0;
22911: cirStage = CIR_DYNAMIC_REGISTER_LIST;
22912: }
22913: return;
22914: }
22915: if (cirStage == CIR_DYNAMIC_REGISTER_LIST) {
22916: cirRegisterList = cirOperandBuffer[0] & 255;
22917: cirResponse = 0x8900_810c;
22918: cirStage = CIR_REGISTER_SELECT;
22919: return;
22920: }
22921: if (cirStage == CIR_REGISTER_SELECT) {
22922: if (cirRegisterList == 0) {
22923:
22924: cirIdle (0x0802);
22925: return;
22926: }
22927: cirOperandLength = 3 * Integer.bitCount (cirRegisterList);
22928: cirOperandIndex = 0;
22929: cirStage = CIR_SOURCE_OPERAND;
22930: return;
22931: }
22932:
22933: {
22934: int n, p;
22935: if ((cirCommand & 0x1000) == 0) {
22936: n = 7;
22937: p = -1;
22938: } else {
22939: n = 0;
22940: p = 1;
22941: }
22942: int i = 0;
22943: for (int list = cirRegisterList << 24; list != 0; n += p, list <<= 1) {
22944: if (list < 0) {
22945: if (epbIsTriple ()) {
22946: epbFPn[n].sety012 (cirOperandBuffer[i], (long) cirOperandBuffer[i + 1] << 32 | cirOperandBuffer[i + 2] & 0xffffffffL);
22947: } else {
22948: epbFPn[n].setx012 (cirOperandBuffer[i], (long) cirOperandBuffer[i + 1] << 32 | cirOperandBuffer[i + 2] & 0xffffffffL);
22949: }
22950: i += 3;
22951: }
22952: }
22953:
22954: cirIdle (0x0802);
22955: return;
22956: }
22957:
22958:
22959:
22960: case 0b111:
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:
23085:
23086:
23087:
23088:
23089:
23090:
23091:
23092:
23093:
23094:
23095:
23096:
23097:
23098:
23099:
23100:
23101:
23102:
23103:
23104:
23105: if (cirStage == CIR_IDLE) {
23106: if ((cirCommand & 0x0700) != 0) {
23107: cirException (0x1c0b);
23108: return;
23109: }
23110: if ((mmm & 2) == 0) {
23111: cirRegisterList = cirCommand & 255;
23112: cirResponse = 0x8900_a10c;
23113: cirStage = CIR_REGISTER_SELECT;
23114: } else {
23115: cirResponse = 0x8900_8c00 + (cirCommand >> 4 & 7);
23116: cirOperandLength = 1;
23117: cirOperandIndex = 0;
23118: cirStage = CIR_DYNAMIC_REGISTER_LIST;
23119: }
23120: return;
23121: }
23122: if (cirStage == CIR_DYNAMIC_REGISTER_LIST) {
23123: cirRegisterList = cirOperandBuffer[0] & 255;
23124: cirResponse = 0x8900_a10c;
23125: cirStage = CIR_REGISTER_SELECT;
23126: return;
23127: }
23128: if (cirStage == CIR_REGISTER_SELECT) {
23129: if (cirRegisterList == 0) {
23130:
23131: cirIdle (0x0802);
23132: return;
23133: }
23134: int n, p;
23135: if ((cirCommand & 0x1000) == 0) {
23136: n = 7;
23137: p = -1;
23138: } else {
23139: n = 0;
23140: p = 1;
23141: }
23142: int i = 0;
23143: byte[] b = new byte[12];
23144: for (int list = cirRegisterList << 24; list != 0; n += p, list <<= 1) {
23145: if (list < 0) {
23146: if (epbIsTriple ()) {
23147: epbFPn[n].gety012 (b, 0, epbRoundingMode);
23148: } else {
23149: epbFPn[n].getx012 (b, 0, epbRoundingMode);
23150: }
23151: cirOperandBuffer[i] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
23152: cirOperandBuffer[i + 1] = b[4] << 24 | (b[5] & 255) << 16 | (char) (b[6] << 8 | b[7] & 255);
23153: cirOperandBuffer[i + 2] = b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255);
23154: i += 3;
23155: }
23156: }
23157: cirOperandLength = i;
23158: cirOperandIndex = 0;
23159: cirStage = CIR_DESTINATION_OPERAND;
23160: return;
23161: }
23162:
23163: {
23164:
23165: cirIdle (0x0802);
23166: return;
23167: }
23168:
23169:
23170:
23171: case 0b001:
23172: default:
23173: cirException (0x1c0b);
23174: return;
23175: }
23176:
23177: }
23178:
23179:
23180:
23181:
23182:
23183:
23184:
23185: public boolean cirPreInstruction () {
23186:
23187: epbFpsr |= XEiJ.FPU_FPSR_EXC_TO_AEXC[epbFpsr >> 8 & 255];
23188:
23189: int mask = epbFpcr & epbFpsr & 0x0000ff00;
23190: if (mask == 0) {
23191: return false;
23192: }
23193: if ((short) mask < 0) {
23194: cirException (0x5c30);
23195: } else if (mask << 17 < 0) {
23196: cirException (0x1c36);
23197: } else if (mask << 18 < 0) {
23198: cirException (0x1c34);
23199: } else if (mask << 19 < 0) {
23200: cirException (0x1c35);
23201: } else if (mask << 20 < 0) {
23202: cirException (0x1c33);
23203: } else if (mask << 21 < 0) {
23204: cirException (0x1c32);
23205: } else {
23206: cirException (0x1c31);
23207: }
23208: return true;
23209: }
23210:
23211:
23212:
23213:
23214:
23215:
23216: public boolean cirMidInstruction () {
23217:
23218: epbFpsr |= XEiJ.FPU_FPSR_EXC_TO_AEXC[epbFpsr >> 8 & 255];
23219:
23220: int mask = epbFpcr & epbFpsr & 0x0000ff00;
23221: if (mask == 0) {
23222: return false;
23223: }
23224: if ((short) mask < 0) {
23225: cirException (0x5d30);
23226: } else if (mask << 17 < 0) {
23227: cirException (0x1d36);
23228: } else if (mask << 18 < 0) {
23229: cirException (0x1d34);
23230: } else if (mask << 19 < 0) {
23231: cirException (0x1d35);
23232: } else if (mask << 20 < 0) {
23233: cirException (0x1d33);
23234: } else if (mask << 21 < 0) {
23235: cirException (0x1d32);
23236: } else {
23237: cirException (0x1d31);
23238: }
23239: return true;
23240: }
23241:
23242:
23243:
23244: }
23245:
23246:
23247: