Package java.math

Examples of java.math.BigDecimal.doubleValue()


                    locale = Locale.getDefault();
                }
                try {
                    Double parsedRetVal = (Double) ObjectType.simpleTypeConvert(retVal, "Double", null, locale, false);
                    String template = UtilProperties.getPropertyValue("arithmetic", "accounting-number.format", "#,##0.00;(#,##0.00)");
                    retVal = UtilFormatOut.formatDecimalNumber(parsedRetVal.doubleValue(), template, locale);
                } catch (GeneralException e) {
                    String errMsg = "Error formatting number [" + retVal + "]: " + e.toString();
                    Debug.logError(e, errMsg, module);
                    throw new IllegalArgumentException(errMsg);
                }
View Full Code Here


      // now put the mantissa and exponent together
      exp = Integer.valueOf(estr).intValue();
      val = new BigDecimal(str.substring(0, epos)).movePointRight(exp);

      return val.doubleValue();
  }
  default:
      throw new OtpErlangDecodeException(
        "Wrong tag encountered, expected "
          + OtpExternal.newFloatTag + ", got " + tag);
View Full Code Here

      // now put the mantissa and exponent together
      exp = Integer.valueOf(estr).intValue();
      val = new BigDecimal(str.substring(0, epos)).movePointRight(exp);

      return val.doubleValue();
    }
    default:
      throw new IOException("Wrong tag encountered, expected "
          + EExternal.newFloatTag + ", got " + tag);
    }
View Full Code Here

    Object returnValue;
   
    if (scale == 0) {
      returnValue = result.longValue();
    } else {
      returnValue = result.doubleValue();
    }
   
    return returnValue;
  }
 
View Full Code Here

        if (a instanceof java.lang.Double) {
            return ((Double) a).doubleValue();
        } 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) {
View Full Code Here

        // scale of 0.  Well this blows up BigDecimal if the number is, say, 4.22.
        // It appears the workaround is to call the deprecated method with a scale of
        // -1 which forces the return of the BD without setting the scale.
        BigDecimal bd = set.getBigDecimal(col, -1);

        obj = (bd == null) ? Py.None : Py.newFloat(bd.doubleValue());
        break;

      case Types.OTHER :

        // it seems pg doesn't like to handle OTHER types as anything but strings
View Full Code Here

            BigDecimal bigSeconds = new BigDecimal(this.durationInNanos).divide(new BigDecimal(1000000000));
            // Calculate the minutes, and round to lose the seconds
            int minutes = bigSeconds.intValue() / 60;
            // Remove the minutes from the seconds, to just have the remainder of seconds
            double dMinutes = minutes;
            double seconds = bigSeconds.doubleValue() - dMinutes * 60;
            // Now compute the number of full hours, and change 'minutes' to hold the remainding minutes
            int hours = minutes / 60;
            minutes = minutes - (hours * 60);
            this.components = new Components(hours, minutes, seconds);
        }
View Full Code Here

                amount = null;
            }
        }

        // check for required amount
        if ((ProductWorker.isAmountRequired(delegator, productId)) && (amount == null || amount.doubleValue() == 0.0)) {
            request.setAttribute("product_id", productId);
            request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource_error,"cart.addToCart.enterAmountBeforeAddingToCart",locale));
            return "product";
        }
View Full Code Here

        //Determine where to send the browser
        if (controlDirective.equals(ERROR)) {
            return "error";
        } else {
            totalQuantity = (BigDecimal)result.get("totalQuantity");
            Map messageMap = UtilMisc.toMap("totalQuantity", UtilFormatOut.formatQuantity(totalQuantity.doubleValue()) );

            request.setAttribute("_EVENT_MESSAGE_",
                                  UtilProperties.getMessage(resource_error, "cart.add_category_defaults",
                                          messageMap, locale ));
View Full Code Here

        */

        Object resultObj = null;
        switch (type) {
        case TYPE_DOUBLE:
            resultObj = Double.valueOf(resultValue.doubleValue());
            break;
        case TYPE_FLOAT:
            resultObj = Float.valueOf(resultValue.floatValue());
            break;
        case TYPE_LONG:
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.