Package java.math

Examples of java.math.BigDecimal.floatValue()


     */
    public void testFloatValuePlusZero() {
        String a = "123809648392384754573567356745735.63567890295784902768787678287E-400";
        BigDecimal aNumber = new BigDecimal(a);
        int zero = 0;
        float result = aNumber.floatValue();
        assertTrue("incorrect value", Float.floatToIntBits(result) == zero);
    }

    /**
     * Integer value of a negative BigDecimal
View Full Code Here


        BeanWrapper bean = new BeanWrapperImpl(target);

        if (propertyValue instanceof Float) {
            bigDecimal = new BigDecimal(propertyValue.toString());
            bigDecimal = getScaledValue(bigDecimal);
            bean.setPropertyValue(getPropertyName(), bigDecimal.floatValue());
        }
        else if (propertyValue instanceof Double) {
            bigDecimal = new BigDecimal(propertyValue.toString());
            bigDecimal = getScaledValue(bigDecimal);
            bean.setPropertyValue(getPropertyName(), bigDecimal.doubleValue());
View Full Code Here

      throw ex;
    }
    try {
      CallableStatement cstmt = con.prepareCall("{ call update_real_proc(?,?) }");
      BigDecimal val = new BigDecimal(intValues[0]);
      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

            } else if (Long.class.equals(type) || long.class.equals(type)) {
                return type.cast(convertedValue.longValue());
            } else if (Double.class.equals(type) || double.class.equals(type)) {
                return type.cast(convertedValue.doubleValue());
            } else if (Float.class.equals(type) || float.class.equals(type)) {
                return type.cast(convertedValue.floatValue());
            } else if (BigInteger.class.equals(type)) {
                return type.cast(convertedValue.toBigInteger());
            } else if (BigDecimal.class.equals(type)) {
                return type.cast(convertedValue);
            } else if (Short.class.equals(type) || short.class.equals(type)) {
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 floatValue()
        { BigDecimal bd = bigDecimalValue(); return bd == null ? 0.0f : bd.floatValue(); }
    public double doubleValue()
        { BigDecimal bd = bigDecimalValue(); return bd == null ? 0.0 : bd.doubleValue(); }
    public BigDecimal bigDecimalValue()
        { throw new XmlValueOutOfRangeException(); }
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

  }

  public static float round(float d, int decimalPlace) {
    BigDecimal bd = new BigDecimal(Float.toString(d));
    bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
    return bd.floatValue();
  }

  public void downDamage() {
    if (damage > 1) {
      damage--;
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

                break;
            case NUMERIC_DOUBLE :
                dcv.setNumericValue( value == null ? null : value.doubleValue() );
                break;
            case NUMERIC_FLOAT :
                dcv.setNumericValue( value == null ? null : value.floatValue() );
                break;
            case NUMERIC_INTEGER :
                dcv.setNumericValue( value == null ? null : value.intValue() );
                break;
            case NUMERIC_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.