Examples of movePointRight()


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));
      abs = abs.subtract(BigDecimal.valueOf(d));
    }

View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

                                                       getErrorString(DatatypeMessageProvider.FRACTION_EXCEEDED,
                                                                      DatatypeMessageProvider.MSG_NONE,
                                                                      new Object[] { content}));
        }
        if ( (fFacetsDefined & DatatypeValidator.FACET_TOTALDIGITS)!=0 ) {
            int totalDigits = d.movePointRight(d.scale()).toString().length() -
                              ((d.signum() < 0) ? 1 : 0); // account for minus sign
            if ( totalDigits > fTotalDigits )
                throw new InvalidDatatypeValueException(
                                                       getErrorString(DatatypeMessageProvider.TOTALDIGITS_EXCEEDED,
                                                                      DatatypeMessageProvider.MSG_NONE,
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

        }
        long n = nanos;
        BigDecimal bd = BigDecimal.valueOf(n);
        bd = bd.movePointLeft(9);
        bd = ValueDecimal.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()

        }
        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()

        final int ipSize = (ipDigits << 2) + DECIMAL_BINARY_SIZE[ipDigitsX];
        int offset = DECIMAL_BINARY_SIZE[ipDigitsX];
        BigDecimal ip = offset > 0 ? BigDecimal.valueOf(CodecUtils.toInt(value, 0, offset)) : BigDecimal.ZERO;
        for(; offset < ipSize; offset += 4) {
          final int i = CodecUtils.toInt(value, offset, 4);
          ip = ip.movePointRight(DIGITS_PER_4BYTES).add(BigDecimal.valueOf(i));
        }

        //
        int shift = 0;
        BigDecimal fp = BigDecimal.ZERO;
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) {

       return NumberType.MIN_LONG.compareTo(result) <= 0
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

                                                                      DatatypeMessageProvider.MSG_NONE,
                                                                      new Object[] { "'" + content + "'" + " with fractionDigits = '"+ d.scale() +"'"
                                                                          , "'" + fFractionDigits + "'"}));
        }
        if ( (fFacetsDefined & DatatypeValidator.FACET_TOTALDIGITS)!=0 ) {
            int totalDigits = d.movePointRight(d.scale()).toString().length() -
                              ((d.signum() < 0) ? 1 : 0); // account for minus sign
            if ( totalDigits > fTotalDigits )
                throw new InvalidDatatypeValueException(
                                                       getErrorString(DatatypeMessageProvider.TOTALDIGITS_EXCEEDED,
                                                                      DatatypeMessageProvider.MSG_NONE,
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

        Integer.valueOf(m.group(5)).intValue(),
        Integer.valueOf(m.group(6)).intValue());
    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.msSinceEpoch = dateTime.getTimeInMillis();
    if (ret.timezoneShift != null) {
      ret.msSinceEpoch -= ret.timezoneShift.intValue() * TIMEZONE_EQUALIZER;
 
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
       
        oStream.write_string(nestedMember1Value);
        oStream.write_boolean(nestedMember2Value.booleanValue());
        oStream.write_fixed(fixedValue.movePointRight(2));
        oStream.write_long(enumIndex);
        oStream.write_float(floatValue.floatValue());
       
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
View Full Code Here

Examples of java.math.BigDecimal.movePointRight()

                    }
                    formatToken.setPrecision(precision);
                }

            } else {
                l = b.movePointRight(4).longValue();
                b.movePointLeft(4);
                if (d >= Math.pow(10, -4) && d < 1) {
                    requireScientificRepresentation = false;
                    precision += 4 - String.valueOf(l).length();
                    l = b.movePointRight(precision + 1).longValue();
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.