// file: round.C // #include "./process_data.h" // important definitions // //----------------------------------------------------------------------------- // function: 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 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; }