Examples of mod()


Examples of java.math.BigInteger.mod()

        BigInteger upv = BigInteger.valueOf(fraction.numerator)
            .multiply(BigInteger.valueOf(denominator/d1));
        BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);
        // but d2 doesn't need extra precision because
        // d2 = gcd(t,d1) = gcd(t mod d1, d1)
        int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();
        int d2 = (tmodd1==0)?d1:greatestCommonDivisor(tmodd1, d1);

        // result is (t/d2) / (u'/d1)(v'/d2)
        BigInteger w = t.divide(BigInteger.valueOf(d2));
        if (w.bitLength() > 31) {
View Full Code Here

Examples of java.math.BigInteger.mod()

        BigInteger upv = BigInteger.valueOf(fraction.numerator)
            .multiply(BigInteger.valueOf(denominator/d1));
        BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);
        // but d2 doesn't need extra precision because
        // d2 = gcd(t,d1) = gcd(t mod d1, d1)
        int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();
        int d2 = (tmodd1==0)?d1:greatestCommonDivisor(tmodd1, d1);

        // result is (t/d2) / (u'/d1)(v'/d2)
        BigInteger w = t.divide(BigInteger.valueOf(d2));
        if (w.bitLength() > 31) {
View Full Code Here

Examples of java.math.BigInteger.mod()

        final BigInteger upv = BigInteger.valueOf(fraction.numerator)
            .multiply(BigInteger.valueOf(denominator/d1));
        final BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);
        // but d2 doesn't need extra precision because
        // d2 = gcd(t,d1) = gcd(t mod d1, d1)
        final int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();
        final int d2 = tmodd1==0?d1:greatestCommonDivisor(tmodd1, d1);

        // result is (t/d2) / (u'/d1)(v'/d2)
        final BigInteger w = t.divide(BigInteger.valueOf(d2));
        if (w.bitLength() > 31) {
View Full Code Here

Examples of java.math.BigInteger.mod()

     */
    long temp = rand.getHigh8();
    if (temp < 0) {
      // use biginteger to avoid the negative sign problem
      BigInteger bigTemp = makeBigInteger(temp);
      recBuf[0] = (byte) (' ' + (bigTemp.mod(NINETY_FIVE).longValue()));
      temp = bigTemp.divide(NINETY_FIVE).longValue();
    } else {
      recBuf[0] = (byte) (' ' + (temp % 95));
      temp /= 95;     
    }
View Full Code Here

Examples of java.math.BigInteger.mod()

      temp /= 95;     
    }
    temp = rand.getLow8();
    if (temp < 0) {
      BigInteger bigTemp = makeBigInteger(temp);
      recBuf[8] = (byte) (' ' + (bigTemp.mod(NINETY_FIVE).longValue()));
      temp = bigTemp.divide(NINETY_FIVE).longValue();     
    } else {
      recBuf[8] = (byte) (' ' + (temp % 95));
      temp /= 95;
    }
View Full Code Here

Examples of java.math.BigInteger.mod()

        BigInteger upv = BigInteger.valueOf(fraction.numerator)
            .multiply(BigInteger.valueOf(denominator/d1));
        BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);
        // but d2 doesn't need extra precision because
        // d2 = gcd(t,d1) = gcd(t mod d1, d1)
        int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();
        int d2 = (tmodd1==0)?d1:greatestCommonDivisor(tmodd1, d1);

        // result is (t/d2) / (u'/d1)(v'/d2)
        BigInteger w = t.divide(BigInteger.valueOf(d2));
        if (w.bitLength() > 31) {
View Full Code Here

Examples of java.math.BigInteger.mod()

        BigInteger upv = BigInteger.valueOf(fraction.numerator)
        .multiply(BigInteger.valueOf(denominator/d1));
        BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);
        // but d2 doesn't need extra precision because
        // d2 = gcd(t,d1) = gcd(t mod d1, d1)
        int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();
        int d2 = (tmodd1==0)?d1:MathUtils.gcd(tmodd1, d1);

        // result is (t/d2) / (u'/d1)(v'/d2)
        BigInteger w = t.divide(BigInteger.valueOf(d2));
        if (w.bitLength() > 31) {
View Full Code Here

Examples of java.math.BigInteger.mod()

            ((hasDay() == hasMonth() && hasDay() == hasYear())));

        if (!needNormalize && getFraction() != null && getFraction().scale() > 0)
        {
            BigInteger bi = getFraction().unscaledValue();
            needNormalize = (bi.mod(GDateBuilder.TEN).signum() == 0);
        }

        if (!needNormalize)
            _canonicalString = toString();
        else
View Full Code Here

Examples of lipstone.joshua.parser.types.BigDec.mod()

    if (value.length() != 1 || value.getCarType() != ConsType.NUMBER)
      throw new UndefinedResultException("The " + operation + " operation takes one decimal number for its arguments.", this);
    BigDec inp = (BigDec) value.getCar();
   
    //Special points (e.g. angles at which sin, cos, etc. have exact answers
    if (operation.equals("cos") && ((parser.getAngleType().equals("Degrees") && inp.mod(new BigDec(180.0)).eq(new BigDec(90.0)))
        || (parser.getAngleType().equals("Radians") && inp.mod(new BigDec(Math.PI)).eq(new BigDec(Math.PI / 2))) || (parser.getAngleType().equals("Grads") && inp.mod(new BigDec(200.0)).eq(new BigDec(100.0))))) {
      return new ConsCell(BigDec.ZERO, ConsType.NUMBER);
    }
    if ((operation.equals("sin") || operation.equals("tan")) && ((parser.getAngleType().equals("Degrees") && inp.mod(new BigDec(180.0)).eq(new BigDec(0.0)))
        || (parser.getAngleType().equals("Radians") && inp.mod(new BigDec(Math.PI)).eq(BigDec.ZERO)) || (parser.getAngleType().equals("Grads") && inp.mod(new BigDec(200.0)).eq(BigDec.ZERO)))) {
View Full Code Here

Examples of net.fortytwo.ripple.model.NumericValue.mod()

        a = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();

        // Note: mod by zero simply does not yield a result.
        if (!b.isZero()) {
            result = a.mod(b);

            solutions.put(
                    stack.push(result));
        }
    }
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.