Package java.math

Examples of java.math.BigDecimal.divide()


      // a x b
      BigDecimal vectorMultiplication =
          firstVector.getPointX().multiply(secondVector.getPointX())
          .add(firstVector.getPointY().multiply(secondVector.getPointY()));

      double result = Math.acos(vectorMultiplication.divide(scalarMultiplication, DIVISION_PRECISION, ROUNDING_MODE).doubleValue());
     
      if (result == 0) {
        return BigDecimal.valueOf(180);
      }
     
View Full Code Here


                    BigDecimal degrees = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(0, 2)));

                    BigDecimal minutes = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(2, 4)));
                    minutes = minutes.divide(new BigDecimal(60), new MathContext(5));

                    BigDecimal seconds = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(4, 6)));
                    seconds = seconds.divide(new BigDecimal(3600), new MathContext(5));
View Full Code Here

                            temp.toString().substring(2, 4)));
                    minutes = minutes.divide(new BigDecimal(60), new MathContext(5));

                    BigDecimal seconds = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(4, 6)));
                    seconds = seconds.divide(new BigDecimal(3600), new MathContext(5));

                    String direction = temp.toString().substring(6);
                    //Decimal Degrees = Degrees + minutes/60
                    BigDecimal convertedCoordinates = degrees.add(minutes.add(seconds), new MathContext(5));
View Full Code Here

                    BigDecimal degrees = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(0, 3)));
                    //minutes/60
                    BigDecimal minutes = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(3, 5)));
                    minutes = minutes.divide(new BigDecimal(60), new MathContext(5));

                    //direction
                    String direction = temp.toString().substring(5);

                    //Decimal Degrees = Degrees + minutes/60
View Full Code Here

                    BigDecimal degrees = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(0, 3)));
                    //minutes/60
                    BigDecimal minutes = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(3, 5)));
                    minutes = minutes.divide(new BigDecimal(60), new MathContext(5));
                    //seconds/3600
                    BigDecimal seconds = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(4, 7)));
                    seconds = seconds.divide(new BigDecimal(3600), new MathContext(5));
                    //direction
View Full Code Here

                            temp.toString().substring(3, 5)));
                    minutes = minutes.divide(new BigDecimal(60), new MathContext(5));
                    //seconds/3600
                    BigDecimal seconds = new BigDecimal(Double.parseDouble(
                            temp.toString().substring(4, 7)));
                    seconds = seconds.divide(new BigDecimal(3600), new MathContext(5));
                    //direction
                    String direction = temp.toString().substring(7);

                    //Decimal Degrees = Degrees + minutes/60 + seconds/3600
                    BigDecimal convertedCoordinates = degrees.add(minutes.add(seconds), new MathContext(5));
View Full Code Here

                    BigDecimal usageCostAmount = ZERO;
                    if (usageCost != null) {
                        usageCostAmount = usageCost.getBigDecimal("amount").multiply(BigDecimal.valueOf(actualMilliSeconds.doubleValue()));
                    }
                    BigDecimal fixedAssetCost = setupCostAmount.add(usageCostAmount).setScale(decimals, rounding);
                    fixedAssetCost = fixedAssetCost.divide(BigDecimal.valueOf(3600000), decimals, rounding);
                    // store the cost
                    Map<String, Object> inMap = UtilMisc.<String, Object>toMap("userLogin", userLogin,
                            "workEffortId", productionRunTaskId);
                    inMap.put("costComponentTypeId", "ACTUAL_ROUTE_COST");
                    inMap.put("costUomId", currencyUomId);
View Full Code Here

                            GenericValue newAdjustment = GenericValue.create(adjustment);
                            BigDecimal adjAmount = newAdjustment.getBigDecimal("amount");

                            // we use != because adjustments can be +/-
                            if (adjAmount != null && adjAmount.compareTo(BigDecimal.ZERO) != 0)
                                newAdjustment.set("amount", adjAmount.divide(baseQuantity, generalRounding));
                            Debug.logInfo("Cloned adj: " + newAdjustment, module);
                            item.addAdjustment(newAdjustment);
                        } else {
                            Debug.logInfo("Clone Adjustment is null", module);
                        }
View Full Code Here

                        GenericValue newAdjustment = GenericValue.create(adjustment);
                        BigDecimal adjAmount = newAdjustment.getBigDecimal("amount");

                        // we use != becuase adjustments can be +/-
                        if (adjAmount != null && adjAmount.compareTo(BigDecimal.ZERO) != 0)
                            newAdjustment.set("amount", adjAmount.divide(baseQuantity, generalRounding));
                        Debug.logInfo("Updated adj: " + newAdjustment, module);
                        this.addAdjustment(newAdjustment);
                    }
                }
            }
View Full Code Here

                if (codSurchargeApplyToNoPackages) {
                    codSurchargeAmount = "0";
                }
                codSurchargePackageAmount = new BigDecimal(codSurchargeAmount).setScale(decimals, rounding);
                if (codSurchargeSplitBetweenPackages) {
                    codSurchargePackageAmount = codSurchargePackageAmount.divide(new BigDecimal(shipmentPackageRouteSegs.size()), decimals, rounding);
                }

                if (UtilValidate.isEmpty(destTelecomNumber)) {
                    Debug.logInfo("Voice notification service will not be requested for COD shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + " - missing destination phone number", module);
                }
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.