Here you can find the source of roundf(float value)
public static float roundf(float value)
//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; } }