diff options
Diffstat (limited to 'src/backend/port/qnx/rint.c')
-rw-r--r-- | src/backend/port/qnx/rint.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/backend/port/qnx/rint.c b/src/backend/port/qnx/rint.c new file mode 100644 index 00000000000..8d717425b2e --- /dev/null +++ b/src/backend/port/qnx/rint.c @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * rint.c + * rint() implementation + * + * Copyright (c) 1999, repas AEG Automation GmbH + * + * + * IDENTIFICATION + * $Header: /cvsroot/pgsql/src/backend/port/qnx/Attic/rint.c,v 1.1 1999/12/16 01:25:06 momjian Exp $ + * + *------------------------------------------------------------------------- + */ + +#include <math.h> +#include "os.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; +} |