Package java.math

Examples of java.math.BigDecimal.negate()


                final BigDecimal u = BigDecimalMath.sqrt( l.add(re).divide(half,mc), mc );
                final BigDecimal v = BigDecimalMath.sqrt( l.subtract(re).divide(half,mc), mc );
                if ( im.compareTo(BigDecimal.ZERO)>= 0 )
                        return new BigComplex(u,v) ;
                else
                        return new BigComplex(u,v.negate()) ;
        }

        /** The inverse of this.
        * @return 1/this
        */
 
View Full Code Here


            BigDecimal I = addRound(z.im, divideRound(multiplyRound(z.re, z.re), z.im));
            MathContext mc = new MathContext(1 + R.precision());
            R = BigDecimal.ONE.divide(R, mc);
            mc = new MathContext(1 + I.precision());
            I = BigDecimal.ONE.divide(I, mc);
            return new BigComplex(R, I.negate());
        }
    }

    /** Divide and round.
     * @param x The numerator
View Full Code Here

    public Node external_truncate(Node startAt) throws Exception {
        BigDecimal num = number.get();
        boolean negatif = num.signum()==-1;
        BigDecimal n=num.abs();
        BigDecimal n2 = BigDecimalMath.floor(n);
        n = negatif ? n2.negate(): n2;
        return Node.createExternal(new External_Decimal(n,context.get()));
    }

    /**
     * retourne la valeur absolue du Decimal.
View Full Code Here

    } else {
      scale = r.nextInt();
    }
    BigDecimal result = new BigDecimal(
        new BigInteger(sb.toString()), scale);
    return r.nextBoolean() ? result : result.negate();
  }

  public void testSizeLimits() {

  }
View Full Code Here

                XModel paymentLine = Journal.appendNode(model, "tr", Integer.toString(i), "");
                Journal.appendNode(paymentLine, "td", "sku", "");
                Journal.appendNode(paymentLine, "td", "desc", descString);
                Journal.appendNode(paymentLine, "td", "qty", "-");
                Journal.appendNode(paymentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate()));
                Journal.appendNode(paymentLine, "td", "index", Integer.toString(i));
            }
        }
    }
View Full Code Here

          // We ussually get a big deciamal when we have Long.MIN_VALUE constant in the
          // Selector.  Long.MIN_VALUE is too big to store in a Long as a positive so we store it
          // as a Big decimal.  But it gets Negated right away.. to here we try to covert it back
          // to a Long.         
          BigDecimal bd = (BigDecimal)left;
          bd = bd.negate();
         
          if( BD_LONG_MIN_VALUE.compareTo(bd)==) {
            return new Long(Long.MIN_VALUE);
          }
            return bd;
View Full Code Here

        if (len == 0) {
            return null;
        }

        BigDecimal result = ConversionUtil.toBigDecimal(evaluateChild(0, o));
        return result != null ? result.negate() : null;
    }

    @Override
    public void encodeAsString(PrintWriter pw) {
        if ((children != null) && (children.length > 0)) {
View Full Code Here

                XModel paymentLine = Journal.appendNode(model, "tr", Integer.toString(i), "");
                Journal.appendNode(paymentLine, "td", "sku", "");
                Journal.appendNode(paymentLine, "td", "desc", descString);
                Journal.appendNode(paymentLine, "td", "qty", "-");
                Journal.appendNode(paymentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate()));
                Journal.appendNode(paymentLine, "td", "index", Integer.toString(i));
            }
        }
    }
View Full Code Here

        OrderReadHelper orderReadHelper = new OrderReadHelper(orderAdjustments, orderItems);
        BigDecimal grandTotal = orderReadHelper.getOrderGrandTotal();
        if (grandTotal.compareTo(new BigDecimal(0)) != 0) {
            GenericValue adjustment = delegator.makeValue("OrderAdjustment");
            adjustment.set("orderAdjustmentTypeId", "REPLACE_ADJUSTMENT");
            adjustment.set("amount", grandTotal.negate());
            adjustment.set("comments", "ReShip Order for Order #" + originalOrderId);
            adjustment.set("createdDate", UtilDateTime.nowTimestamp());
            adjustment.set("createdByUserLogin", userLogin.getString("userLoginId"));
            cart.addAdjustment(adjustment);
        }
View Full Code Here

                GenericValue inventoryItemToClear = newItem == null ? inventoryItem : newItem;

                inventoryItemToClear.refresh();
                BigDecimal atp = inventoryItemToClear.get("availableToPromiseTotal") == null ? BigDecimal.ZERO : inventoryItemToClear.getBigDecimal("availableToPromiseTotal");
                if (atp.compareTo(BigDecimal.ZERO) != 0) {
                    Map<String, Object> createDetailMap = UtilMisc.toMap("availableToPromiseDiff", atp.negate(),
                            "inventoryItemId", inventoryItemToClear.get("inventoryItemId"), "userLogin", userLogin);
                    try {
                        Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
                        if (ServiceUtil.isError(result)) {
                            return ServiceUtil.returnError("Inventory Item Detail create problem in complete inventory transfer", null, null, result);
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.