Package java.math

Examples of java.math.BigDecimal.floatValue()


        return values.get(index);
      case SUM:
        BigDecimal sum = new BigDecimal(0);
        for (int i = 0; i < values.size(); ++i)
          sum = sum.add(new BigDecimal(values.get(i)));
        return sum.floatValue();
      case MIN:
        BigDecimal minimum = new BigDecimal(values.get(0));
        for (int i = 1; i < values.size(); ++i)
          if (minimum.compareTo(new BigDecimal(values.get(i))) > 0)
            minimum = new BigDecimal(values.get(i));
View Full Code Here


      case MIN:
        BigDecimal minimum = new BigDecimal(values.get(0));
        for (int i = 1; i < values.size(); ++i)
          if (minimum.compareTo(new BigDecimal(values.get(i))) > 0)
            minimum = new BigDecimal(values.get(i));
        return minimum.floatValue();
      case MAX:
        BigDecimal maximum = new BigDecimal(values.get(0));
        for (int i = 1; i < values.size(); ++i)
          if (maximum.compareTo(new BigDecimal(values.get(i))) < 0)
            maximum = new BigDecimal(values.get(i));
View Full Code Here

      case MAX:
        BigDecimal maximum = new BigDecimal(values.get(0));
        for (int i = 1; i < values.size(); ++i)
          if (maximum.compareTo(new BigDecimal(values.get(i))) < 0)
            maximum = new BigDecimal(values.get(i));
        return maximum.floatValue();
      case FIRST:
        return values.get(0);
      case LAST:
        return values.get(values.size() - 1);
      default:
View Full Code Here

                        trial = new BigDecimal(s2);
                    }
                }
            }
        }
        if (trial != null && (precision==1 ? trial.floatValue() == value : trial.doubleValue() == value)) {
            return trial;
        } else {
            return initial;
        }
    }
View Full Code Here

                return progressSoFar_;
            }
            BigDecimal processed = new BigDecimal(bigLastRow.subtract(bigStart_));
            try {
                BigDecimal progress = processed.setScale(3).divide(bigRange_, BigDecimal.ROUND_HALF_DOWN);
                progressSoFar_ = progress.floatValue();
                return progressSoFar_;
            } catch (java.lang.ArithmeticException e) {
                return 0;
            }           
        }
View Full Code Here

        switch (type) {
        case TYPE_DOUBLE:
            resultObj = Double.valueOf(resultValue.doubleValue());
            break;
        case TYPE_FLOAT:
            resultObj = Float.valueOf(resultValue.floatValue());
            break;
        case TYPE_LONG:
            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Long.valueOf(resultValue.longValue());
            break;
View Full Code Here

    if (localValue == null)
      return (float)0;

    // If the BigDecimal is out of range for the float
    // then positive or negative infinity is returned.
    float value = NumberDataType.normalizeREAL(localValue.floatValue());

    return value;
  }

  /**
 
View Full Code Here

    // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------

    // numerics: fractional
    public float getFloatValue()
        { BigDecimal bd = getBigDecimalValue(); return bd == null ? 0.0f : bd.floatValue(); }
    public double getDoubleValue()
        { BigDecimal bd = getBigDecimalValue(); return bd == null ? 0.0 : bd.doubleValue(); }
    public BigDecimal getBigDecimalValue()
        { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
                new Object[] {getPrimitiveTypeName(), "numeric"}); }
View Full Code Here

        }
        try
        {
            CallableStatement cstmt = con.prepareCall("{ call update_real_proc(?,?) }");
            BigDecimal val = new BigDecimal( intValues[0] );
            float x = val.floatValue();
            cstmt.setObject( 1, val, Types.REAL );
            val = new BigDecimal( intValues[1]);
            cstmt.setObject( 2, val, Types.REAL );
            cstmt.executeUpdate();
            cstmt.close();
View Full Code Here

            WatermarkSettings position = new WatermarkSettings();
            if (UtilValidate.isNotEmpty(x) && UtilValidate.isNotEmpty(y)) {
                BigDecimal positionX = new BigDecimal(decimalFormat.format(Float.parseFloat(x)));
                BigDecimal positionY = new BigDecimal(decimalFormat.format(Float.parseFloat(y)));
                position.setX(positionX.floatValue());
                position.setY(positionY.floatValue());
                watermarkerSettings.setWatermarkSettings(position);
            } else {
                String errMsg = "Please select Text Position.";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
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.