Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / math / roundl.c
blob9879a82cc2a3ad98f89c263efec3236c5387d1c7
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>
8 long double
9 roundl (long double x)
11 long double res = 0.0L;
12 if (x >= 0.0L)
14 res = ceill (x);
15 if (res - x > 0.5L)
16 res -= 1.0L;
18 else
20 res = ceill (-x);
21 if (res + x > 0.5L)
22 res -= 1.0L;
23 res = -res;
25 return res;