1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Add rint() to /port, remove from qnx/.

This commit is contained in:
Bruce Momjian
2003-05-09 16:26:29 +00:00
parent 995773be1c
commit 0afe5417d7
9 changed files with 19 additions and 149 deletions

37
src/port/rint.c Normal file
View File

@ -0,0 +1,37 @@
/*-------------------------------------------------------------------------
*
* rint.c
* rint() implementation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/port/rint.c,v 1.1 2003/05/09 16:26:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "c.h"
#include <math.h>
double
rint(double x)
{
double f,
n = 0.;
f = modf(x, &n);
if (x > 0.)
{
if (f > .5)
n += 1.;
}
else if (x < 0.)
{
if (f < -.5)
n -= 1.;
}
return n;
}