Examples of remainder()


Examples of com.facebook.presto.jdbc.internal.joda.time.DateTimeField.remainder()

            DateTimeField field = iFieldType.getField(chrono);
            int minDigits = iMinDigits;

            long fraction;
            try {
                fraction = field.remainder(instant);
            } catch (RuntimeException e) {
                if (buf != null) {
                    appendUnknownString(buf, minDigits);
                } else {
                    printUnknownString(out, minDigits);
View Full Code Here

Examples of java.math.BigDecimal.remainder()

        // remainder

      x = new BigDecimal("9.785496E-2");
      y = new BigDecimal("-5.9219189762E-2");
      r = x.remainder(y);
        System.out.println( r.toString() );
      // 0.038635770238

       
      x = new BigDecimal("1.23693014661017964112E-5");
View Full Code Here

Examples of java.math.BigDecimal.remainder()

      // 0.038635770238

       
      x = new BigDecimal("1.23693014661017964112E-5");
      y = new BigDecimal("-6.9318042E-7");
      r = x.remainder(y);
      System.out.println( r.toPlainString() );
      // 0.0000005852343261017964112

       
        // divide
View Full Code Here

Examples of java.math.BigDecimal.remainder()

            trainDesign.setTrainDesignParametrization(trainDesignParametrization);
        }

        private int readDistance(String lineToken) {
            BigDecimal distanceBigDecimal = new BigDecimal(lineToken).multiply(DISTANCE_MULTIPLICAND);
            if (distanceBigDecimal.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) != 0) {
                throw new IllegalArgumentException("The distance (" + lineToken + ") is too detailed.");
            }
            return distanceBigDecimal.intValue();
        }
View Full Code Here

Examples of java.math.BigDecimal.remainder()

     */
    private void normalizeNeuronVector(BigDecimal absMax) {
        for (int i = 0; i < neuronVector.getRowCount(); i++) {
            BigDecimal element = neuronVector.get(0, i);
            if (element.compareTo(BigDecimal.ZERO) >= 0) {
                neuronVector.set(0, i, element.remainder(absMax));
            } else {
                neuronVector.set(0, i, element.negate().remainder(absMax).negate());
            }
           
//            if (element.compareTo(neuronVector.get(0, i)) != 0) {
View Full Code Here

Examples of java.math.BigDecimal.remainder()

    return doubleToTimestamp((double) f);
  }

  public static Timestamp decimalToTimestamp(HiveDecimal d) {
    BigDecimal nanoInstant = d.bigDecimalValue().multiply(BILLION_BIG_DECIMAL);
    int nanos = nanoInstant.remainder(BILLION_BIG_DECIMAL).intValue();
    if (nanos < 0) {
      nanos += 1000000000;
    }
    long seconds =
      nanoInstant.subtract(new BigDecimal(nanos)).divide(BILLION_BIG_DECIMAL).longValue();
View Full Code Here

Examples of java.math.BigDecimal.remainder()

    return doubleToTimestamp((double) f);
  }

  public static Timestamp decimalToTimestamp(HiveDecimal d) {
    BigDecimal nanoInstant = d.bigDecimalValue().multiply(BILLION_BIG_DECIMAL);
    int nanos = nanoInstant.remainder(BILLION_BIG_DECIMAL).intValue();
    if (nanos < 0) {
      nanos += 1000000000;
    }
    long seconds =
      nanoInstant.subtract(new BigDecimal(nanos)).divide(BILLION_BIG_DECIMAL).longValue();
View Full Code Here

Examples of java.math.BigInteger.remainder()

    long timeout;
    int nanos;
    if (nanosecondsObject instanceof BigInteger) {
      final BigInteger nanoseconds = (BigInteger) nanosecondsObject;
      timeout = nanoseconds.divide(ONE_MILLION).longValue();
      nanos = nanoseconds.remainder(ONE_MILLION).intValue();
    } else if (nanosecondsObject instanceof Integer) {
      final int nanoseconds = (Integer) nanosecondsObject;
      timeout = nanoseconds / 1000000;
      nanos = nanoseconds % 1000000;
    } else {
View Full Code Here

Examples of java.math.BigInteger.remainder()

        while (true)
        {
            // Do cheap "pre-test" if applicable
            if (result.bitLength() > 6)
            {
                long r = result.remainder(
                    BigInteger.valueOf(SMALL_PRIME_PRODUCT)).longValue();
                if ((r % 3 == 0) || (r % 5 == 0) || (r % 7 == 0)
                    || (r % 11 == 0) || (r % 13 == 0) || (r % 17 == 0)
                    || (r % 19 == 0) || (r % 23 == 0) || (r % 29 == 0)
                    || (r % 31 == 0) || (r % 37 == 0) || (r % 41 == 0))
View Full Code Here

Examples of java.math.BigInteger.remainder()

        BigInteger r = n.divide(TWO);
        if (n.remainder(TWO).equals(BigInteger.ONE)) {
            out.println(r);
        } else {
            r = r.subtract(BigInteger.ONE);
            if (r.remainder(TWO).equals(BigInteger.ZERO)) {
                r = r.subtract(BigInteger.ONE);
            }
            out.println(r);
        }
        out.flush();
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.