aboutsummaryrefslogtreecommitdiff
path: root/src/port/rint.c
blob: 0e32dd92720eccc05989d53d3bc6254a9727b686 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*-------------------------------------------------------------------------
 *
 * rint.c
 *	  rint() implementation
 *
 * IDENTIFICATION
 *	  $PostgreSQL: pgsql/src/port/rint.c,v 1.4 2010/02/06 05:42:49 tgl Exp $
 *
 *-------------------------------------------------------------------------
 */
#include "c.h"

#include <math.h>

double
rint(double x)
{
	return (x >= 0.0) ? floor(x + 0.5) : ceil(x - 0.5);
}