Package java.math

Examples of java.math.BigDecimal.signum()


                        try {
                            billingAccountBalance = getBillingAccountBalance(thisBillingAccountId, dctx);
                        } catch (GenericEntityException e) {
                            return ServiceUtil.returnError(e.getMessage());
                        }
                        if (billingAccountBalance.signum() == -1) {
                            billingAccountId = thisBillingAccountId;
                        }
                    }
                }
View Full Code Here


        final Number number1 = typeRegistry.convertToNumber(type1, value1);
        final Number number2 = typeRegistry.convertToNumber(type2, value2);
        final BigDecimal bd1 = NumberUtil.getAsBigDecimal(number1);
        final BigDecimal bd2 = NumberUtil.getAsBigDecimal(number2);

        if (bd1.signum() != bd2.signum())
        {
          if (bd1.signum() < 0)
          {
            return DefaultComparator.LESS;
          }
View Full Code Here

    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
   
    final BigDecimal divisor = NumberUtil.getAsBigDecimal(number2);
    if(divisor.signum() == 0)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARITHMETIC_VALUE);
    }

    final BigDecimal divide = new BigDecimal(divided.divide(divisor, 0, BigDecimal.ROUND_FLOOR).toString());
View Full Code Here

      {
        final Number number1 = typeRegistry.convertToNumber(type1, value1);
        final Number number2 = typeRegistry.convertToNumber(type2, value2);
        final BigDecimal bd1 = NumberUtil.getAsBigDecimal(number1);
        final BigDecimal bd2 = NumberUtil.getAsBigDecimal(number2);
        if (bd1.signum() != bd2.signum())
        {
          return false;
        }

        return bd1.compareTo(bd2) == 0;
View Full Code Here

        ValueDecimal dec = (ValueDecimal) v;
        if (dec.value.signum() == 0) {
            throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());
        }
        BigDecimal bd = value.divide(dec.value, value.scale() + DIVIDE_SCALE_ADD, BigDecimal.ROUND_HALF_DOWN);
        if (bd.signum() == 0) {
            bd = BigDecimal.ZERO;
        } else if (bd.scale() > 0) {
            if (!bd.unscaledValue().testBit(0)) {
                String s = bd.toString();
                int i = s.length() - 1;
View Full Code Here

        ValueDecimal dec = (ValueDecimal) v;
        if (dec.value.signum() == 0) {
            throw JdbcException.get(SQLErrorCode.DIVISION_BY_ZERO_1, getSQL());
        }
        BigDecimal bd = value.divide(dec.value, value.scale() + DIVIDE_SCALE_ADD, BigDecimal.ROUND_HALF_DOWN);
        if (bd.signum() == 0) {
            bd = BigDecimal.ZERO;
        } else if (bd.scale() > 0) {
            if (!bd.unscaledValue().testBit(0)) {
                String s = bd.toString();
                int i = s.length() - 1;
View Full Code Here

            // Determine the difference between existing and new tax adjustment totals, if any
            BigDecimal orderTaxDifference = totalNewOrderTax.subtract(totalExistingOrderTax).setScale(taxDecimals, taxRounding);

            // If the total has changed, create an OrderAdjustment to reflect the fact
            if (orderTaxDifference.signum() != 0) {
                Map<String, Object> createOrderAdjContext = new HashMap<String, Object>();
                createOrderAdjContext.put("orderAdjustmentTypeId", "SALES_TAX");
                createOrderAdjContext.put("orderId", orderId);
                createOrderAdjContext.put("orderItemSeqId", "_NA_");
                createOrderAdjContext.put("shipGroupSeqId", "_NA_");
View Full Code Here

        } else if (a instanceof BigDecimal) {
            BigDecimal bd = (BigDecimal) a;

            value = bd.doubleValue();

            int        signum = bd.signum();
            BigDecimal bdd    = new BigDecimal(value + signum);

            if (bdd.compareTo(bd) != signum) {
                throw Error.error(ErrorCode.X_22003);
            }
View Full Code Here

                        p -= s;
                        s = 0;
                    }

                    return (precision - scale >= p - s) ? 0
                                                        : dec.signum();
                }
                default :
                    return 0;
            }
View Full Code Here

                }

                BigDecimal abd = (BigDecimal) a;
                BigDecimal bbd = (BigDecimal) b;

                if (bbd.signum() == 0) {
                    throw Error.error(ErrorCode.X_22012);
                }

                BigDecimal bd = abd.divide(bbd, scale, BigDecimal.ROUND_DOWN);
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.