Package java.math

Examples of java.math.BigDecimal.subtract()


        }

        String itemStatus = orderItem.getString("statusId");
        BigDecimal orderQty = orderItem.getBigDecimal("quantity");
        if (orderItem.getBigDecimal("cancelQuantity") != null) {
            orderQty = orderQty.subtract(orderItem.getBigDecimal("cancelQuantity"));
        }

        // get the returnable quantity
        BigDecimal returnableQuantity = BigDecimal.ZERO;
        if (returnable && (itemStatus.equals("ITEM_APPROVED") || itemStatus.equals("ITEM_COMPLETED"))) {
View Full Code Here


            if (results.get("messages") != null) {
                List<String> message = UtilGenerics.checkList(results.get("messages"));
                messages.addAll(message);
            }
            if (results.get("processAmount") != null) {
                totalRemaining = totalRemaining.subtract(((BigDecimal) results.get("processAmount")));
            }
        }

        Debug.logInfo("Finished with auth(s) checking results", module);
View Full Code Here

    public void clearLine(PackingSessionLine line) {
        this.packLines.remove(line);
        BigDecimal packageWeight = this.packageWeights.get(line.packageSeq);
        if (packageWeight != null) {
            packageWeight = packageWeight.subtract(line.weight);
            if (packageWeight.compareTo(BigDecimal.ZERO) < 0) {
                packageWeight = BigDecimal.ZERO;
            }
            this.packageWeights.put(line.packageSeq, packageWeight);
        }
View Full Code Here

     */
    public static BigDecimal availableToCapture(GenericValue billingAccount) throws GenericEntityException {
        BigDecimal netBalance = getBillingAccountNetBalance(billingAccount.getDelegator(), billingAccount.getString("billingAccountId"));
        BigDecimal accountLimit = billingAccount.getBigDecimal("accountLimit");

        return accountLimit.subtract(netBalance).setScale(decimals, rounding);
    }

    public static Map<String, Object> calcBillingAccountBalance(DispatchContext dctx, Map<String, ? extends Object> context) {
        Delegator delegator = dctx.getDelegator();
        String billingAccountId = (String) context.get("billingAccountId");
View Full Code Here

            BigDecimal bd = getFieldAsBigDecimal(FIELDS[i]);
            bd = bd.multiply(factor).add(carry);

            buf[i] = bd.setScale(0, BigDecimal.ROUND_DOWN);

            bd = bd.subtract(buf[i]);
            if (i == 1) {
                if (bd.signum() != 0) {
                    throw new IllegalStateException(); // illegal carry-down
                } else {
                    carry = ZERO;
View Full Code Here

             * Euler-Stieltjes as shown in Dilcher, Aequat Math 48 (1) (1994) 55-85
             */
            MathContext mcloc = new MathContext(2 + mc.getPrecision());
            BigDecimal resul = BigDecimal.ONE;
            resul = resul.add(log(new BigDecimal(2), mcloc));
            resul = resul.subtract(log(new BigDecimal(3), mcloc));

            /* how many terms: zeta-1 falls as 1/2^(2n+1), so the
             * terms drop faster than 1/2^(4n+2). Set 1/2^(4kmax+2) < eps.
             * Leading term zeta(3)/(4^1*3) is 0.017. Leading zeta(3) is 1.2. Log(2) is 0.7
             */
 
View Full Code Here

        BigDecimal resul = asin(xhighpr, mc); // modified by l.bruninx, 2012-03-19
        // double eps = resul.ulp().doubleValue() / 2.;             // removed by l.bruninx, 2012-03-19

        //MathContext mc = new MathContext(err2prec(3.14159, eps)); // removed by l.bruninx, 2012-03-19
        BigDecimal pihalf = pi(mc).divide(TWO, mc); // modified by l.bruninx, 2012-03-19
        return pihalf.subtract(resul, mc);

        /*
         * Orignial section to check absolute error in the result is err(x)/sqrt(1-x^2) to lowest order
         * removed by l.bruninx, 2012-03-19.
         *
 
View Full Code Here

        /* Delegate the actual operation to the BigDecimal class, which may return
         * a negative value of x was negative .
         */
        BigDecimal res = x.remainder(onepi);
        if (res.compareTo(pihalf) > 0)
            res = res.subtract(onepi);
        else if (res.compareTo(pihalf.negate()) < 0)
            res = res.add(onepi);

        /*
         * The actual precision is set by the input value, its absolute value of x.ulp()/2.
View Full Code Here

        /*
         * s'il y a au moins un argument, on considère la forme (- n [args...])...
         */
        BigDecimal r = number.get();
        for (int i = 1; i < asize; )
            r = r.subtract(_getArg_(startAt, i++));
        MathContext mc=context.get();
        return Node.createExternal(new External_Decimal(r.round(mc), mc));
    }

    /**
 
View Full Code Here

        BigDecimal r;
        do {
            old_r = number.get();
            r = old_r;
            for (int i = 0; i < v.length; i++)
                r = r.subtract(v[i]);
        }
        while (!number.compareAndSet(old_r, r));
        return 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.