mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Add rint() to /port, remove from qnx/.
This commit is contained in:
@@ -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
|
||||
|
@@ -1,37 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* rint.c
|
||||
* rint() implementation
|
||||
*
|
||||
* Copyright (c) 1999, repas AEG Automation GmbH
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/rint.c,v 1.3 2001/08/24 14:07:49 petere 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;
|
||||
}
|
@@ -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;
|
||||
}
|
Reference in New Issue
Block a user