Java Code Examples for sun.misc.FDBigInteger#toBigInteger()
The following examples show how to use
sun.misc.FDBigInteger#toBigInteger() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestFDBigInteger.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void testRightInplaceSub(FDBigInteger left, FDBigInteger right, boolean isImmutable) throws Exception { BigInteger biLeft = left.toBigInteger(); BigInteger biRight = right.toBigInteger(); FDBigInteger diff = left.rightInplaceSub(right); if (!isImmutable && diff != right) { throw new Exception("rightInplaceSub of doesn't reuse its argument"); } check(biLeft, left, "leftInplaceSub corrupts its left argument"); if (isImmutable) { check(biRight, right, "leftInplaceSub corrupts its right immutable argument"); } try { check(biLeft.subtract(biRight), diff, "rightInplaceSub returns wrong result"); } catch (Exception e) { System.out.println(biLeft+" - "+biRight+" = "+biLeft.subtract(biRight)); throw e; } }
Example 2
Source File: TestFDBigInteger.java From hottub with GNU General Public License v2.0 | 6 votes |
private static void testRightInplaceSub(FDBigInteger left, FDBigInteger right, boolean isImmutable) throws Exception { BigInteger biLeft = left.toBigInteger(); BigInteger biRight = right.toBigInteger(); FDBigInteger diff = left.rightInplaceSub(right); if (!isImmutable && diff != right) { throw new Exception("rightInplaceSub of doesn't reuse its argument"); } check(biLeft, left, "leftInplaceSub corrupts its left argument"); if (isImmutable) { check(biRight, right, "leftInplaceSub corrupts its right immutable argument"); } try { check(biLeft.subtract(biRight), diff, "rightInplaceSub returns wrong result"); } catch (Exception e) { System.out.println(biLeft+" - "+biRight+" = "+biLeft.subtract(biRight)); throw e; } }
Example 3
Source File: TestFDBigInteger.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void testLeftInplaceSub(FDBigInteger left, FDBigInteger right, boolean isImmutable) throws Exception { BigInteger biLeft = left.toBigInteger(); BigInteger biRight = right.toBigInteger(); FDBigInteger diff = left.leftInplaceSub(right); if (!isImmutable && diff != left) { throw new Exception("leftInplaceSub of doesn't reuse its argument"); } if (isImmutable) { check(biLeft, left, "leftInplaceSub corrupts its left immutable argument"); } check(biRight, right, "leftInplaceSub corrupts its right argument"); check(biLeft.subtract(biRight), diff, "leftInplaceSub returns wrong result"); }
Example 4
Source File: TestFDBigInteger.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void testLeftInplaceSub(FDBigInteger left, FDBigInteger right, boolean isImmutable) throws Exception { BigInteger biLeft = left.toBigInteger(); BigInteger biRight = right.toBigInteger(); FDBigInteger diff = left.leftInplaceSub(right); if (!isImmutable && diff != left) { throw new Exception("leftInplaceSub of doesn't reuse its argument"); } if (isImmutable) { check(biLeft, left, "leftInplaceSub corrupts its left immutable argument"); } check(biRight, right, "leftInplaceSub corrupts its right argument"); check(biLeft.subtract(biRight), diff, "leftInplaceSub returns wrong result"); }
Example 5
Source File: TestFDBigInteger.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void testQuoRemIteration(FDBigInteger t, FDBigInteger s) throws Exception { BigInteger bt = t.toBigInteger(); BigInteger bs = s.toBigInteger(); int q = t.quoRemIteration(s); BigInteger[] qr = bt.divideAndRemainder(bs); if (!BigInteger.valueOf(q).equals(qr[0])) { throw new Exception("quoRemIteration returns incorrect quo"); } check(qr[1].multiply(BigInteger.TEN), t, "quoRemIteration returns incorrect rem"); }
Example 6
Source File: TestFDBigInteger.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void testMultByPow52(FDBigInteger t, int p5, int p2) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.multByPow52(p5, p2); if (bt.signum() == 0 && r != t) { throw new Exception("multByPow52 of doesn't reuse its argument"); } check(bt.multiply(biPow52(p5, p2)), r, "multByPow52 returns wrong result"); }
Example 7
Source File: TestFDBigInteger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void testCmpPow52(FDBigInteger t, int p5, int p2) throws Exception { FDBigInteger o = FDBigInteger.valueOfPow52(p5, p2); BigInteger bt = t.toBigInteger(); BigInteger bo = biPow52(p5, p2); int cmp = t.cmp(o); int bcmp = bt.compareTo(bo); if (bcmp != cmp) { throw new Exception("cmpPow52 returns " + cmp + " expected " + bcmp); } check(bt, t, "cmpPow52 corrupts this"); check(bo, o, "cmpPow5 corrupts other"); }
Example 8
Source File: TestFDBigInteger.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void testMultBy10(FDBigInteger t, boolean isImmutable) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.multBy10(); if ((bt.signum() == 0 || !isImmutable) && r != t) { throw new Exception("multBy10 of doesn't reuse its argument"); } if (isImmutable) { check(bt, t, "multBy10 corrupts its argument"); } check(bt.multiply(BigInteger.TEN), r, "multBy10 returns wrong result"); }
Example 9
Source File: TestFDBigInteger.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void testMultByPow52(FDBigInteger t, int p5, int p2) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.multByPow52(p5, p2); if (bt.signum() == 0 && r != t) { throw new Exception("multByPow52 of doesn't reuse its argument"); } check(bt.multiply(biPow52(p5, p2)), r, "multByPow52 returns wrong result"); }
Example 10
Source File: TestFDBigInteger.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void testQuoRemIteration(FDBigInteger t, FDBigInteger s) throws Exception { BigInteger bt = t.toBigInteger(); BigInteger bs = s.toBigInteger(); int q = t.quoRemIteration(s); BigInteger[] qr = bt.divideAndRemainder(bs); if (!BigInteger.valueOf(q).equals(qr[0])) { throw new Exception("quoRemIteration returns incorrect quo"); } check(qr[1].multiply(BigInteger.TEN), t, "quoRemIteration returns incorrect rem"); }
Example 11
Source File: TestFDBigInteger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void testLeftShift(FDBigInteger t, int shift, boolean isImmutable) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.leftShift(shift); if ((bt.signum() == 0 || shift == 0 || !isImmutable) && r != t) { throw new Exception("leftShift doesn't reuse its argument"); } if (isImmutable) { check(bt, t, "leftShift corrupts its argument"); } check(bt.shiftLeft(shift), r, "leftShift returns wrong result"); }
Example 12
Source File: TestFDBigInteger.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void testLeftShift(FDBigInteger t, int shift, boolean isImmutable) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.leftShift(shift); if ((bt.signum() == 0 || shift == 0 || !isImmutable) && r != t) { throw new Exception("leftShift doesn't reuse its argument"); } if (isImmutable) { check(bt, t, "leftShift corrupts its argument"); } check(bt.shiftLeft(shift), r, "leftShift returns wrong result"); }
Example 13
Source File: TestFDBigInteger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void testAddAndCmp(FDBigInteger t, FDBigInteger x, FDBigInteger y) throws Exception { BigInteger bt = t.toBigInteger(); BigInteger bx = x.toBigInteger(); BigInteger by = y.toBigInteger(); int cmp = t.addAndCmp(x, y); int bcmp = bt.compareTo(bx.add(by)); if (bcmp != cmp) { throw new Exception("addAndCmp returns " + cmp + " expected " + bcmp); } check(bt, t, "addAndCmp corrupts this"); check(bx, x, "addAndCmp corrupts x"); check(by, y, "addAndCmp corrupts y"); }
Example 14
Source File: TestFDBigInteger.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void testLeftShift(FDBigInteger t, int shift, boolean isImmutable) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.leftShift(shift); if ((bt.signum() == 0 || shift == 0 || !isImmutable) && r != t) { throw new Exception("leftShift doesn't reuse its argument"); } if (isImmutable) { check(bt, t, "leftShift corrupts its argument"); } check(bt.shiftLeft(shift), r, "leftShift returns wrong result"); }
Example 15
Source File: TestFDBigInteger.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void testLeftInplaceSub(FDBigInteger left, FDBigInteger right, boolean isImmutable) throws Exception { BigInteger biLeft = left.toBigInteger(); BigInteger biRight = right.toBigInteger(); FDBigInteger diff = left.leftInplaceSub(right); if (!isImmutable && diff != left) { throw new Exception("leftInplaceSub of doesn't reuse its argument"); } if (isImmutable) { check(biLeft, left, "leftInplaceSub corrupts its left immutable argument"); } check(biRight, right, "leftInplaceSub corrupts its right argument"); check(biLeft.subtract(biRight), diff, "leftInplaceSub returns wrong result"); }
Example 16
Source File: TestFDBigInteger.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void testMultByPow52(FDBigInteger t, int p5, int p2) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.multByPow52(p5, p2); if (bt.signum() == 0 && r != t) { throw new Exception("multByPow52 of doesn't reuse its argument"); } check(bt.multiply(biPow52(p5, p2)), r, "multByPow52 returns wrong result"); }
Example 17
Source File: TestFDBigInteger.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void testLeftShift(FDBigInteger t, int shift, boolean isImmutable) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.leftShift(shift); if ((bt.signum() == 0 || shift == 0 || !isImmutable) && r != t) { throw new Exception("leftShift doesn't reuse its argument"); } if (isImmutable) { check(bt, t, "leftShift corrupts its argument"); } check(bt.shiftLeft(shift), r, "leftShift returns wrong result"); }
Example 18
Source File: TestFDBigInteger.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void testAddAndCmp(FDBigInteger t, FDBigInteger x, FDBigInteger y) throws Exception { BigInteger bt = t.toBigInteger(); BigInteger bx = x.toBigInteger(); BigInteger by = y.toBigInteger(); int cmp = t.addAndCmp(x, y); int bcmp = bt.compareTo(bx.add(by)); if (bcmp != cmp) { throw new Exception("addAndCmp returns " + cmp + " expected " + bcmp); } check(bt, t, "addAndCmp corrupts this"); check(bx, x, "addAndCmp corrupts x"); check(by, y, "addAndCmp corrupts y"); }
Example 19
Source File: TestFDBigInteger.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void testLeftShift(FDBigInteger t, int shift, boolean isImmutable) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.leftShift(shift); if ((bt.signum() == 0 || shift == 0 || !isImmutable) && r != t) { throw new Exception("leftShift doesn't reuse its argument"); } if (isImmutable) { check(bt, t, "leftShift corrupts its argument"); } check(bt.shiftLeft(shift), r, "leftShift returns wrong result"); }
Example 20
Source File: TestFDBigInteger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void testMultByPow52(FDBigInteger t, int p5, int p2) throws Exception { BigInteger bt = t.toBigInteger(); FDBigInteger r = t.multByPow52(p5, p2); if (bt.signum() == 0 && r != t) { throw new Exception("multByPow52 of doesn't reuse its argument"); } check(bt.multiply(biPow52(p5, p2)), r, "multByPow52 returns wrong result"); }