Package java.math

Examples of java.math.BigDecimal.longValue()


            BigDecimal bigDecimal = new BigDecimal(lpn.toString());
            if (bigDecimal.scale() <= 0) {
                if (bigDecimal.compareTo(new BigDecimal(Integer.MAX_VALUE)) <= 0) {
                    unwrapped = bigDecimal.intValue();
                } else {
                    unwrapped = bigDecimal.longValue();
                }
            } else {
                unwrapped = bigDecimal.doubleValue();
            }
        } else {
View Full Code Here


        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

        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

    for (int i = finalId; i >= 0; i--) {
      if (isOverflow(i, last.get(i), incs[i])) {
        if (i == 0) {
          throw new RangeOverflowException(range, last, incs[i].longValue());
        }
        long rem = incrementAndGetReminder(i, last.get(i), value.longValue());
        incs[i] = new BigDecimal(rem);
        incs[i - 1] = incs[i-1].add(new BigDecimal(1));
        overflowFlag[i] = true;
      } else {
        if (i > 0) {
View Full Code Here

     
      // get text for ip1::total
      BigDecimal total = ip1.getTotal();
      LexEngine le = new LexEnginePL();
     
      long integerPart = total.longValue();
      long digitsPart = total.multiply(new BigDecimal(100d)).remainder(new BigDecimal(100d)).longValue();
     
      invoice.setHrTotalIntegerPart(le.getTextForNumber(integerPart));
      invoice.setHrTotalDigitsPart(le.getTextForNumber(digitsPart));
     
View Full Code Here

     
      // get text for ip1::total
      BigDecimal total = ip1.getTotal();
      LexEngine le = new LexEnginePL();
     
      long integerPart = total.longValue();
      long digitsPart = total.multiply(new BigDecimal(100d)).remainder(new BigDecimal(100d)).longValue();
     
      invoice.setHrTotalIntegerPart(le.getTextForNumber(integerPart));
      invoice.setHrTotalDigitsPart(le.getTextForNumber(digitsPart));
     
View Full Code Here

    result = result.setScale(scale, RoundingMode.HALF_EVEN);
   
    Object returnValue;
   
    if (scale == 0) {
      returnValue = result.longValue();
    } else {
      returnValue = result.doubleValue();
    }
   
    return returnValue;
View Full Code Here

            if (bd.compareTo(MAX_LONG) > 0 || bd.compareTo(MIN_LONG) < 0) {
                throw Error.error(ErrorCode.X_22003);
            }

            return ValuePool.getLong(bd.longValue());
        } else if (a instanceof Double || a instanceof Float) {
            double d = ((Number) a).doubleValue();

            if (session instanceof Session) {
                if (!((Session) session).database.sqlConvertTruncate) {
View Full Code Here

            throw Error.error(ErrorCode.X_22015);
        }

        if (isNumberDiv) {
            if (isYearMonth) {
                return new IntervalMonthData(result.longValue(), this);
            }

            int nanos = (int) NumberType.scaledDecimal(result,
                DTIType.maxFractionPrecision);
View Full Code Here

            }

            int nanos = (int) NumberType.scaledDecimal(result,
                DTIType.maxFractionPrecision);

            return new IntervalSecondData(result.longValue(), nanos, this,
                                          true);
        } else {
            if (isYearMonth) {
                return result.longValue();
            } else {
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.