repo.or.cz
/
PostgreSQL.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git]
/
src
/
port
/
rint.c
blob
86bfa948906e8127afc5e2a26f605bb777b0505a
1
/*-------------------------------------------------------------------------
2
*
3
* rint.c
4
* rint() implementation
5
*
6
* Copyright (c) 1999, repas AEG Automation GmbH
7
*
8
*
9
* IDENTIFICATION
10
* $PostgreSQL$
11
*
12
*-------------------------------------------------------------------------
13
*/
14
15
#include
"c.h"
16
#include <math.h>
17
18
double
19
rint
(
double
x
)
20
{
21
double
f
,
22
n
=
0
.;
23
24
f
=
modf
(
x
, &
n
);
25
26
if
(
x
>
0
.)
27
{
28
if
(
f
>
.5
)
29
n
+=
1
.;
30
}
31
else if
(
x
<
0
.)
32
{
33
if
(
f
< -
.5
)
34
n
-=
1
.;
35
}
36
return
n
;
37
}