master
 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
 8long double
 9roundl (long double x)
10{
11  long double res = 0.0L;
12  if (x >= 0.0L)
13    {
14      res = ceill (x);
15      if (res - x > 0.5L)
16	res -= 1.0L;
17    }
18  else
19    {
20      res = ceill (-x);
21      if (res + x > 0.5L)
22	res -= 1.0L;
23      res = -res;
24    }
25  return res;
26}