Package java.math

Examples of java.math.BigDecimal.floatValue()


        return this;
    }

    public XNumber roundHalfToEven(int precision) {
        final BigDecimal rounded = BigDecimal.valueOf(value).setScale(precision, RoundingMode.HALF_EVEN);
        this.value = rounded.floatValue();
        onUpdate();
        return this;
    }

    @Override
View Full Code Here


        double ang=(double)angle;
        if (ang < 0.0) { ang=maxval+ang; }
        double temp=(ang/maxval)*360.0;
        BigDecimal bd=new BigDecimal(temp);
        BigDecimal result=bd.setScale(2, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }

    /** Convert 4 bytes binary angle to float
     * @param ang   four bytes binary angle
     * @return float value of angle with precision of two decimal in degrees
View Full Code Here

    static float calcAngle(int ang) {
        final double maxval=4294967296.0;
        double temp=(ang/maxval)*360.0;
        BigDecimal bd=new BigDecimal(temp);
        BigDecimal result=bd.setScale(3, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }

    /** Calculate radial elevation of each ray
     * @param angle  two bytes binary angle
     * @return float value of elevation in degrees with precision of two decimal
View Full Code Here

        double ang=(double)angle;
        if (angle < 0) ang=(~angle)+1;
        double temp=(ang/maxval)*360.0;
        BigDecimal bd=new BigDecimal(temp);
        BigDecimal result=bd.setScale(2, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }

    /** Calculate distance between sequential bins in a ray
     * @param range_first  range of first bin in centimeters
     * @param range_last   range of last bin in centimeters
View Full Code Here

     */
    static float calcStep(float range_first, float range_last, short num_bins) {
        float step=(range_last-range_first)/(num_bins-1);
        BigDecimal bd=new BigDecimal(step);
        BigDecimal result=bd.setScale(2, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }

    /** Calculate azimuth of a ray
     * @param az0  azimuth at beginning of ray (binary angle)
     * @param az1  azimuth at end of ray (binary angle)
View Full Code Here

        if ((az0 < 0)&(az1 > 0)) { d=Math.abs(360.0f-azim0)+Math.abs(azim1)}
        double temp=azim0+d*0.5;
        if (temp>360.0) { temp-=360.0; }
        BigDecimal bd=new BigDecimal(temp);
        BigDecimal result=bd.setScale(2, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }

    /** Calculate data values from raw ingest data
     * @param recHdr  java.util.Map object with values for calculation
     * @param dty     type of data ( "Total_Power", "Reflectivity", "Velocity",
View Full Code Here

                temp=((((int)data & 0xFF)-128)/16.0); }
            break;
        }
        BigDecimal bd=new BigDecimal(temp);
        BigDecimal result=bd.setScale(2, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }

    /** Calculate time as hh:mm:ss
     * @param t   number of seconds since midnight for start of sweep
     * @param t0  time in seconds from start of sweep
View Full Code Here

   static float calcNyquist(int prf, int wave) {
        double tmp=(prf*wave*0.01)*0.25;
        tmp=tmp*0.01;                    //Make it m/sec
        BigDecimal bd=new BigDecimal(tmp);
        BigDecimal result=bd.setScale(2, RoundingMode.HALF_DOWN);
        return result.floatValue();
    }


    // dummy implementations of other methods
    public Array readNestedData(Variable v2, List section) throws IOException, InvalidRangeException {
View Full Code Here

   * @return rounded float value
   */
  public static float round(float value, int decimalPlace) {
    BigDecimal bd = new BigDecimal(value);
    bd = bd.setScale(decimalPlace,BigDecimal.ROUND_HALF_UP);
    value = bd.floatValue();
    return value;
  }
 
  /**
   * Format a float as string with given number of figures after
View Full Code Here

            {
                return Short.valueOf(value.shortValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_FLOAT))
            {
                return Float.valueOf(value.floatValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_DOUBLE))
            {
                return Double.valueOf(value.doubleValue());
            }
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.