• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #include <math.h>
7 
8 double
round(double x)9 round (double x)
10 {
11   double res;
12   if (x >= 0.0)
13     {
14       res = ceil (x);
15       if (res - x > 0.5)
16 	res -= 1.0;
17     }
18   else
19     {
20       res = ceil (-x);
21       if (res + x > 0.5)
22 	res -= 1.0;
23       res = -res;
24     }
25   return res;
26 }
27