Java Number Round roundf(float value)

Here you can find the source of roundf(float value)

Description

roundf

License

Open Source License

Declaration

public static float roundf(float value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static float roundf(float value) {

        float rest = value % 1f;

        if (rest >= 0.5f) {

            value += 1f - rest;//from w ww. java2 s  . c o  m
        } else {

            value -= rest;
        }

        return value;
    }
}

Related

  1. roundedDollarValue(double d)
  2. roundedLog(double value, double exponent)
  3. roundedLog10(int n)
  4. roundedSatisfaction(double value)
  5. rounder(float value, int digits)
  6. roundFileLength(long nbytes)
  7. roundFloat(float value, int afterDecimalPoint)
  8. roundFloatToPlace(float f, int place)
  9. roundFloatToUnitInverse(final float graphValue, final float graphUnit)