Updated German translation
[dasher.git] / Src / Common / round.c
blobbc73382d3594119741816136831a8f051e98ff33
1 #include <math.h>
3 /* Unlike round() from libmath, this function rounds up to the highest
4 * integral value, so round(-1.5)=-1 rather than -2.
5 * This function tends to be called with positive values, in which case
6 * the behaviour is the same: round(1.5)=2.
7 */
8 double round(double dVal) {
9 double dF = floor(dVal);
10 double dC = ceil(dVal);
12 if(dVal - dF < dC - dVal)
13 return dF;
14 else
15 return dC;