repo.or.cz
/
newlib-cygwin.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git]
/
winsup
/
cygwin
/
math
/
roundl.c
blob
9879a82cc2a3ad98f89c263efec3236c5387d1c7
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
long double
9
roundl
(
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
}