Package java.math

Examples of java.math.BigInteger.subtract()


            // mQ = ((input mod q) ^ dQ)) mod q
            mQ = (input.remainder(q)).modPow(dQ, q);

            // h = qInv * (mP - mQ) mod p
            h = mP.subtract(mQ);
            h = h.multiply(qInv);
            h = h.mod(p);               // mod (in Java) returns the positive residual

            // m = h * q + mQ
            m = h.multiply(q);
View Full Code Here


        }

        Tensor toTensor() {
            BigInteger exponent = this.exponent;
            if (minExponent != null && minExponent.value != null) {
                exponent = exponent.subtract(minExponent.value);
                if (diffSigns && minExponent.value.testBit(0))
                    return Tensors.negate(Tensors.pow(tensor, new Complex(exponent)));
            }
            return Tensors.pow(tensor, new Complex(exponent));
        }
View Full Code Here

            fieldUndefined[MONTH] = true;
        }

        BigInteger dMonths = sanitize(duration.getField(DatatypeConstants.MONTHS), signum);
        BigInteger temp = BigInteger.valueOf((long) startMonth).add(dMonths);
        setMonth(temp.subtract(BigInteger.ONE).mod(TWELVE).intValue() + 1);
        BigInteger carry =
                new BigDecimal(temp.subtract(BigInteger.ONE)).divide(new BigDecimal(TWELVE), BigDecimal.ROUND_FLOOR).toBigInteger();

        /* Years (may be modified additionally below)
            *  E[year] := S[year] + D[year] + carry
View Full Code Here

        }

        Tensor toTensor() {
            BigInteger exponent = this.exponent;
            if (minExponent != null && minExponent.value != null) {
                exponent = exponent.subtract(minExponent.value);
                if (diffSigns && minExponent.value.testBit(0))
                    return Tensors.negate(Tensors.pow(tensor, new Complex(exponent)));
            }
            return Tensors.pow(tensor, new Complex(exponent));
        }
View Full Code Here

      return new TimingImpl( histogram.lastKey(), TimeUnit.NANOSECONDS );
    }
    BigInteger centileCount = centile.divide( _100, mc ).multiply( new BigDecimal( getCount() ) ).setScale( 0, RoundingMode.HALF_UP ).
            toBigIntegerExact();
    for ( Map.Entry<BigDecimal, BigInteger> histogramBucket : histogram.entrySet() ) {
      centileCount = centileCount.subtract( histogramBucket.getValue() );
      if ( centileCount.compareTo( BigInteger.ZERO ) <= 0 ) {
        return new TimingImpl( histogramBucket.getKey(), TimeUnit.NANOSECONDS );
      }
    }
    throw new IllegalStateException( "Could not find centile!" );
View Full Code Here

            fieldUndefined[MONTH] = true;
        }

        BigInteger dMonths = sanitize(duration.getField(DatatypeConstants.MONTHS), signum);
        BigInteger temp = BigInteger.valueOf((long) startMonth).add(dMonths);
        setMonth(temp.subtract(BigInteger.ONE).mod(TWELVE).intValue() + 1);
        BigInteger carry =
            new BigDecimal(temp.subtract(BigInteger.ONE)).divide(new BigDecimal(TWELVE), BigDecimal.ROUND_FLOOR).toBigInteger();

        /* Years (may be modified additionally below)
         *  E[year] := S[year] + D[year] + carry
View Full Code Here

            byte [] prependHeader = {1, 0};
            BigInteger bigLastRow = new BigInteger(Bytes.add(prependHeader, lastPadded));
            if (bigLastRow.compareTo(bigEnd_) > 0) {
                return progressSoFar_;
            }
            BigDecimal processed = new BigDecimal(bigLastRow.subtract(bigStart_));
            try {
                BigDecimal progress = processed.setScale(3).divide(bigRange_, BigDecimal.ROUND_HALF_DOWN);
                progressSoFar_ = progress.floatValue();
                return progressSoFar_;
            } catch (java.lang.ArithmeticException e) {
View Full Code Here

        fieldUndefined[MONTH] = true;
    }
   
    BigInteger dMonths = sanitize(duration.getField(DatatypeConstants.MONTHS), signum);
    BigInteger temp = BigInteger.valueOf((long) startMonth).add(dMonths);
    setMonth(temp.subtract(BigInteger.ONE).mod(TWELVE).intValue() + 1);
    BigInteger carry =
      new BigDecimal(temp.subtract(BigInteger.ONE)).divide(new BigDecimal(TWELVE), BigDecimal.ROUND_FLOOR).toBigInteger();

     /* Years (may be modified additionally below)
      *  E[year] := S[year] + D[year] + carry
View Full Code Here

        JDBC.assertSingleValueResultSet(st.executeQuery(sql),
                y.add(i).toString());

        sql = "select y - " + i + " from " + tableName;
        JDBC.assertSingleValueResultSet(st.executeQuery(sql),
                y.subtract(i).toString());

        sql = "select " + i + " - y from " + tableName;
        JDBC.assertSingleValueResultSet(st.executeQuery(sql),
                i.subtract(y).toString());
View Full Code Here

    @Test
    public void testMinValueBoundry()
    {
        BigInteger min = new BigInteger( Integer.toString( Integer.MIN_VALUE ) );
        assertTrue( checker.isValidSyntax( min.toString() ) );
        min = min.subtract( BigInteger.ONE );
        assertFalse( checker.isValidSyntax( min.toString() ) );
        min = min.subtract( BigInteger.ONE );
        assertFalse( checker.isValidSyntax( min.toString() ) );
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.