// file: fbc_round.C // #include "fbc.h" // important definitions // //----------------------------------------------------------------------------- // function: fbc_round_C // // arguments: // float value: (input) value to be rounded // // returns: // a float value // // rounds using an algorithm that rounds towards the largest // magnitude (negative values are rounded down). //----------------------------------------------------------------------------- float fbc_round_C(float value) { // declare local variables // int i_value; // round depending on sign // if (value > (float)0) {i_value = (int)(value + 0.5);} else {i_value = (int)(value - 0.5);} // exit gracefully // return (float)i_value; }