Java Float Number Round round(float value, float snap)

Here you can find the source of round(float value, float snap)

Description

round

License

Apache License

Declaration

public static float round(float value, float snap) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static float round(float value, float snap) {
        if (snap == 0.0f)
            return value;
        return ((int) (value / snap)) * snap;
    }//from w w  w  . j  a v a 2  s  .  co m
}

Related

  1. round(float Rval, int Rpl)
  2. round(float Rval, int Rpl)
  3. round(float v)
  4. round(float val, int places)
  5. round(float value, float epsilon)
  6. round(float x)
  7. round(float x, float y)
  8. roundTo(float num, int dp)