Examples of movePointRight()


Examples of com.extentech.toolkit.CompatibleBigDecimal.movePointRight()

        exp = num.substring(i + 1, num.length());
      } else {
        exp = num.substring(i + 2, num.length());
      }
      int expNum = Integer.valueOf(exp).intValue();
      outNumD = new CompatibleBigDecimal(outNumD.movePointRight(expNum));
      // outNumD = outNumD.multiply(new CompatibleBigDecimal(Math.pow(10,
      // expNum)));
      // Logger.logInfo(String.valueOf(outNumD));
      // outNum = Math.r
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

        }
        long n = nanos;
        BigDecimal bd = BigDecimal.valueOf(n);
        bd = bd.movePointLeft(9);
        bd = MathUtils.setScale(bd, targetScale);
        bd = bd.movePointRight(9);
        long n2 = bd.longValue();
        if (n2 == n) {
            return this;
        }
        return fromDateValueAndNanos(dateValue, n2);
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

        }

        value = value.setScale(0, BigDecimal.ROUND_FLOOR);
        value = ((BigDecimal) a).subtract(value);

        return value.movePointRight(scale).longValue();
    }

    public static boolean isInLongLimits(BigDecimal result) {

        if (NumberType.MIN_LONG.compareTo(result) > 0
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

                                                        getErrorString(DatatypeMessageProvider.ScaleExceeded,
                                                                        DatatypeMessageProvider.MSG_NONE,
                                                                        new Object[] { content}));
        }
        if ( isPrecisionDefined == true ) {
            int precision = d.movePointRight(d.scale()).toString().length() -
                            ((d.signum() < 0) ? 1 : 0); // account for minus sign
            if (precision > fPrecision)
                throw new InvalidDatatypeValueException(
                                getErrorString(DatatypeMessageProvider.PrecisionExceeded,
                                 DatatypeMessageProvider.MSG_NONE,
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

                }
                if (x.signum() < 0) {
                    throw new ExpressionException(
                            "Argument to SQRT() function must not be negative");
                }
                BigInteger n = x.movePointRight(mc.getPrecision() << 1)
                        .toBigInteger();

                int bits = (n.bitLength() + 1) >> 1;
                BigInteger ix = n.shiftRight(bits);
                BigInteger ixPrev;
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

        calendar.add(Calendar.SECOND, getSeconds() * signum);

        if (seconds != null) {
            BigDecimal fraction =
                seconds.subtract(seconds.setScale(0, BigDecimal.ROUND_DOWN));
            int millisec = fraction.movePointRight(3).intValue();
            calendar.add(Calendar.MILLISECOND, millisec * signum);
        }
    }
   
    /**
 
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

                 Integer.valueOf(m.group(5)),
                 Integer.valueOf(m.group(6)));
    if (m.group(8) != null && m.group(8).length() > 0) {
      final BigDecimal bd = new BigDecimal("0." + m.group(8));
      // we care only for milliseconds, so movePointRight(3)
      dateTime.set(Calendar.MILLISECOND, bd.movePointRight(3).intValue());
    }

    ret.value = dateTime.getTimeInMillis();
    if (ret.tzShift != null) {
      ret.value -= ret.tzShift.intValue() * 60000;
 
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

    } else { /* Small positive number: 0x16, ~-E, M */
      dst.put(POS_SMALL);
    }

    // normalize abs(val) to determine E
    while (abs.compareTo(EN10) < 0) { abs = abs.movePointRight(8); e += 4; }
    while (abs.compareTo(EN2) < 0) { abs = abs.movePointRight(2); e++; }

    putVaruint64(dst, e, !isNeg); // encode appropriate E value.

    // encode M by peeling off centimal digits, encoding x as 2x+1
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

      dst.put(POS_SMALL);
    }

    // normalize abs(val) to determine E
    while (abs.compareTo(EN10) < 0) { abs = abs.movePointRight(8); e += 4; }
    while (abs.compareTo(EN2) < 0) { abs = abs.movePointRight(2); e++; }

    putVaruint64(dst, e, !isNeg); // encode appropriate E value.

    // encode M by peeling off centimal digits, encoding x as 2x+1
    startM = dst.getPosition();
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

    // encode M by peeling off centimal digits, encoding x as 2x+1
    startM = dst.getPosition();
    // TODO: 18 is an arbitrary encoding limit. Reevaluate once we have a better handling of
    // numeric scale.
    for (int i = 0; i < 18 && abs.compareTo(BigDecimal.ZERO) != 0; i++) {
      abs = abs.movePointRight(2);
      d = abs.intValue();
      dst.put((byte) ((2 * d + 1) & 0xff));
      abs = abs.subtract(BigDecimal.valueOf(d));
    }
    a[offset + dst.getPosition() - 1] &= 0xfe; // terminal digit should be 2x
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.