aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/port/qnx4/Makefile11
-rw-r--r--src/backend/port/qnx4/tstrint.c32
-rw-r--r--src/include/c.h6
-rw-r--r--src/interfaces/ecpg/pgtypeslib/Makefile5
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt.h1
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt_common.c102
-rw-r--r--src/port/rint.c (renamed from src/backend/port/qnx4/rint.c)2
7 files changed, 13 insertions, 146 deletions
diff --git a/src/backend/port/qnx4/Makefile b/src/backend/port/qnx4/Makefile
index 7f7b90a7352..911ee0fd6fc 100644
--- a/src/backend/port/qnx4/Makefile
+++ b/src/backend/port/qnx4/Makefile
@@ -4,7 +4,7 @@
# Makefile for port/qnx4
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/Makefile,v 1.4 2003/04/24 17:16:13 momjian Exp $
+# $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/Makefile,v 1.5 2003/05/09 16:26:29 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -12,16 +12,13 @@ subdir = src/backend/port/qnx4
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
-OBJS = isnan.o rint.o sem.o shm.o
+OBJS = isnan.o sem.o shm.o
-all: SUBSYS.o tstrint tstsem tstshm
+all: SUBSYS.o tstsem tstshm
SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
-tstrint: tstrint.o rint.o
- $(CC) -o tstrint rint.o tstrint.o
-
tstsem: tstsem.o sem.o
$(CC) -o tstsem sem.o tstsem.o
@@ -32,7 +29,7 @@ depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f SUBSYS.o $(OBJS) tstrint tstrint.o tstsem tstsem.o tstshm tstshm.o
+ rm -f SUBSYS.o $(OBJS) tstsem tstsem.o tstshm tstshm.o
ifeq (depend,$(wildcard depend))
include depend
diff --git a/src/backend/port/qnx4/tstrint.c b/src/backend/port/qnx4/tstrint.c
deleted file mode 100644
index 895817fb6f3..00000000000
--- a/src/backend/port/qnx4/tstrint.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * tstrint.c
- * rint() test
- *
- * Copyright (c) 1999, repas AEG Automation GmbH
- *
- *
- * IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/tstrint.c,v 1.4 2002/11/08 20:23:56 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-
-#include "c.h"
-
-#include <errno.h>
-
-
-int
-main(int argc, char **argv)
-{
- double x;
-
- if (argc != 2)
- exit(1);
-
- x = strtod(argv[1], NULL);
- printf("rint( %f ) = %f\n", x, rint(x));
-
- return 0;
-}
diff --git a/src/include/c.h b/src/include/c.h
index a580c90ab21..a69bb99c29c 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: c.h,v 1.142 2003/05/09 01:16:29 momjian Exp $
+ * $Id: c.h,v 1.143 2003/05/09 16:26:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -811,6 +811,10 @@ extern int isinf(double x);
extern int gethostname(char *name, int namelen);
#endif
+#ifndef HAVE_RINT
+extern double rint(double x);
+#endif
+
#ifndef HAVE_INET_ATON
# include <netinet/in.h>
# include <arpa/inet.h>
diff --git a/src/interfaces/ecpg/pgtypeslib/Makefile b/src/interfaces/ecpg/pgtypeslib/Makefile
index eee2e13e5dd..86f2fde0ac3 100644
--- a/src/interfaces/ecpg/pgtypeslib/Makefile
+++ b/src/interfaces/ecpg/pgtypeslib/Makefile
@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.5 2003/04/08 17:06:15 tgl Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.6 2003/05/09 16:26:29 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -18,7 +18,8 @@ SO_MINOR_VERSION= 0.0
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
-OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o
+OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
+ $(filter rint.o, $(LIBOBJS))
all: all-lib
diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgtypeslib/dt.h
index 415cff0b20b..2294cb2a8e8 100644
--- a/src/interfaces/ecpg/pgtypeslib/dt.h
+++ b/src/interfaces/ecpg/pgtypeslib/dt.h
@@ -299,7 +299,6 @@ int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, int *, boo
void j2date(int, int *, int *, int *);
void GetCurrentDateTime(struct tm*);
int date2j(int, int, int);
-double rint(double x);
extern char* pgtypes_date_weekdays_short[];
extern char* pgtypes_date_months[];
diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c
index 739ce8b5b12..ff8035e323d 100644
--- a/src/interfaces/ecpg/pgtypeslib/dt_common.c
+++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c
@@ -510,108 +510,6 @@ char* pgtypes_date_weekdays_short[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri",
char* pgtypes_date_months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", NULL};
-#ifndef HAVE_RINT
-
-/* @(#)s_rint.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * rint(x)
- * Return x rounded to integral value according to the prevailing
- * rounding mode.
- * Method:
- * Using floating addition.
- * Exception:
- * Inexact flag raised if x not equal to rint(x).
- */
-
-static const double one = 1.0,
- TWO52[2] = {
- 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
- -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
-};
-
-double
-rint(double x)
-{
- int i0,
- n0,
- j0,
- sx;
- unsigned i,
- i1;
- double w,
- t;
-
- n0 = (*((int *) &one) >> 29) ^ 1;
- i0 = *(n0 + (int *) &x);
- sx = (i0 >> 31) & 1;
- i1 = *(1 - n0 + (int *) &x);
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
- if (j0 < 20)
- {
- if (j0 < 0)
- {
- if (((i0 & 0x7fffffff) | i1) == 0)
- return x;
- i1 |= (i0 & 0x0fffff);
- i0 &= 0xfffe0000;
- i0 |= ((i1 | -i1) >> 12) & 0x80000;
- *(n0 + (int *) &x) = i0;
- w = TWO52[sx] + x;
- t = w - TWO52[sx];
- i0 = *(n0 + (int *) &t);
- *(n0 + (int *) &t) = (i0 & 0x7fffffff) | (sx << 31);
- return t;
- }
- else
- {
- i = (0x000fffff) >> j0;
- if (((i0 & i) | i1) == 0)
- return x; /* x is integral */
- i >>= 1;
- if (((i0 & i) | i1) != 0)
- {
- if (j0 == 19)
- i1 = 0x40000000;
- else
- i0 = (i0 & (~i)) | ((0x20000) >> j0);
- }
- }
- }
- else if (j0 > 51)
- {
- if (j0 == 0x400)
- return x + x; /* inf or NaN */
- else
- return x; /* x is integral */
- }
- else
- {
- i = ((unsigned) (0xffffffff)) >> (j0 - 20);
- if ((i1 & i) == 0)
- return x; /* x is integral */
- i >>= 1;
- if ((i1 & i) != 0)
- i1 = (i1 & (~i)) | ((0x40000000) >> (j0 - 20));
- }
- *(n0 + (int *) &x) = i0;
- *(1 - n0 + (int *) &x) = i1;
- w = TWO52[sx] + x;
- return w - TWO52[sx];
-}
-
-#endif /* !HAVE_RINT */
-
static datetkn *
datebsearch(char *key, datetkn *base, unsigned int nel)
{
diff --git a/src/backend/port/qnx4/rint.c b/src/port/rint.c
index 972c51e74bf..53ed8cbcdf8 100644
--- a/src/backend/port/qnx4/rint.c
+++ b/src/port/rint.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/rint.c,v 1.3 2001/08/24 14:07:49 petere Exp $
+ * $Header: /cvsroot/pgsql/src/port/rint.c,v 1.1 2003/05/09 16:26:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/