Alex Lin 14a75508a3 Cleaning up once include variables and copyright cleanup.
Changed all header file once include variables to follow the same naming
convention and not start with any underscores.  Also deleted old
incorrect copyright notices.  Also removed $Id: tags from all files.

Fixes #14.  Fixes #22.
2015-03-23 16:03:14 -05:00

27 lines
746 B
C

/*
PURPOSE: (Round off a double precision value to the resolution specified.)
REFERENCE: ((None))
ASSUMPTIONS AND LIMITATIONS: ((none))
CLASS: (N/A)
LIBRARY DEPENDENCY: ((roundoff.o))
PROGRAMMERS: (((Robert W. Bailey) (LinCom Corp) (Feb 1991) (v1.0) (Initial Release.)))
*/
#include "../include/trick_math.h"
double roundoff( /* Return: Value after roundoff */
double res, /* In: Resolution for roundoff function */
double val)
{ /* In: Value to be truncated */
double remain;
remain = fmod(val, res);
if ((remain / res) <= 0.5)
return (val - remain);
else
return (val + ((1.0 * res) - remain));
}