Package java.math

Examples of java.math.BigDecimal.divide()


        count++;
      }
    }
    if (count > 0)
    {
      return total.divide(new BigDecimal(String.valueOf(count)), scale, roundingMode);
    }
    return ZERO;
  }

  /**
 
View Full Code Here


    }

    if (useDifference)
    {
      final BigDecimal delta = dividend.subtract(divisor);
      return delta.divide(divisor, scale, roundingMode);
    }
    else
    {
      return dividend.divide(divisor, scale, roundingMode);
    }
View Full Code Here

      }
    }

    if (onlyValidFields)
    {
      return computedResult.divide(new BigDecimal(count), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
    }

    if (values.length > 0)
    {
      return computedResult.divide(new BigDecimal(values.length), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
View Full Code Here

      return computedResult.divide(new BigDecimal(count), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
    }

    if (values.length > 0)
    {
      return computedResult.divide(new BigDecimal(values.length), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
    }
    else
    {
      return BigDecimal.ZERO;
    }
View Full Code Here

          computedResult = new BigDecimal(n.toString());
        }
        else
        {
          //noinspection ObjectToString
          computedResult = computedResult.divide(new BigDecimal(n.toString()), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP);
        }
      }
    }

    if (computedResult != null)
View Full Code Here

        if (isParseBigDecimal()) {
            BigDecimal bigDecimalResult = digitList.getBigDecimal();

            if (multiplier != 1) {
                try {
                    bigDecimalResult = bigDecimalResult.divide(getBigDecimalMultiplier());
                }
                catch (ArithmeticException e) {  // non-terminating decimal expansion
                    bigDecimalResult = bigDecimalResult.divide(getBigDecimalMultiplier(), roundingMode);
                }
            }
View Full Code Here

            if (multiplier != 1) {
                try {
                    bigDecimalResult = bigDecimalResult.divide(getBigDecimalMultiplier());
                }
                catch (ArithmeticException e) {  // non-terminating decimal expansion
                    bigDecimalResult = bigDecimalResult.divide(getBigDecimalMultiplier(), roundingMode);
                }
            }

            if (!status[STATUS_POSITIVE]) {
                bigDecimalResult = bigDecimalResult.negate();
View Full Code Here

      else {
        CurrencyConvVO convVO = null;
        for(int i=0;i<frame.getCurrConvs().size();i++) {
          convVO = (CurrencyConvVO)frame.getCurrConvs().get(i);
          if (convVO.getCurrencyCode2Reg03REG06().equals(vo.getCurrencyCodeREG03())) {
            vo.setPaymentValueDOC28( res.divide(convVO.getValueREG06(),vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP) );
            break;
          }
        }
      }
    }
View Full Code Here

              pVO.setPaymentValueDOC28( res );
            else {
              for(int i=0;i<currConvs.size();i++) {
                convVO = (CurrencyConvVO)currConvs.get(i);
                if (convVO.getCurrencyCode2Reg03REG06().equals(vo.getCurrencyCodeReg03DOC19())) {
                  pVO.setPaymentValueDOC28( res.divide(convVO.getValueREG06(),vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP) );
                  break;
                }
              }
            }
          }
View Full Code Here

    BigDecimal subtotal = controlSubtotal.getBigDecimal();
    BigDecimal discount = controlDiscount.getBigDecimal();
    if (subtotal!=null && discount!=null) {
// no outboxing  must be used, in order to ensure java 1.4 compatibilty
// moreover, the primitive division is not the best choice (do not ensure correct decimals...)
      controlDiscountPerc.setValue( discount.divide(subtotal,5,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100d)) );
  } else {
      controlDiscountPerc.setValue(null);
    }
  }
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.