Java Float Number Round round(float v)

Here you can find the source of round(float v)

Description

A cheaper version of Math#round that doesn't handle the special cases.

License

Apache License

Declaration

public static int round(float v) 

Method Source Code

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

public class Main {
    /**/* w ww  .  j  ava 2 s .  c  o  m*/
     * A cheaper version of {@link Math#round} that doesn't handle the special cases.
     */
    public static int round(float v) {
        return (v < 0f) ? (int) (v - 0.5f) : (int) (v + 0.5f);
    }
}

Related

  1. round(float input)
  2. round(float number, int fractionalPartSize)
  3. round(float pX)
  4. round(float Rval, int Rpl)
  5. round(float Rval, int Rpl)
  6. round(float val, int places)
  7. round(float value, float epsilon)
  8. round(float value, float snap)
  9. round(float x)