Re: rint() replacement - Mailing list pgsql-hackers

From Dann Corbit
Subject Re: rint() replacement
Date
Msg-id D90A5A6C612A39408103E6ECDD77B8294CDC32@voyager.corporate.connx.com
Whole thread Raw
In response to rint() replacement  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: rint() replacement  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
This is the rint() definition:
http://www.gnu.org/manual/glibc-2.2.5/html_node/Rounding-Functions.html

There was a bug in glibc rint, but I think it has been fixed.

Probably, most of the time nearbyint() is what is really wanted instead
of rint().  The rint() function can throw an exception even when it does
what is wanted.

If the current rounding mode is round toward -INF, rint(x) is identical
to floor(x).

If the current rounding mode is round toward +INF, rint(x) is identical
to ceil(x).

If the current rounding mode is round to nearest, rint(x) is identical
to nearest(x).

If the current rounding mode is round toward zero, rint(x) is identical
to trunc(x).

Most of the time, this is what rint() is doing if we are round to
nearest:
return floor(x+0.5);

> -----Original Message-----
> From: Andrew Dunstan [mailto:andrew@dunslane.net]
> Sent: Friday, May 09, 2003 11:54 AM
> To: PostgreSQL-development
> Subject: Re: [HACKERS] rint() replacement
>
>
>
> speaking of rint(), I just got this on Linux on a clean get from CVS:
>
> gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations
> -fpic -I../../../. ./src/interfaces/ecpg/include
> -I../../../../src/include/utils -I../../../../
> src/include   -c -o dt_common.o dt_common.c
> dt_common.c: In function `dt2time':
> dt_common.c:1271: warning: implicit declaration of function `rint'
>
> which I guess is kinda undesirable...
>
> andrew
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>



pgsql-hackers by date:

Previous
From: "Andrew Dunstan"
Date:
Subject: Re: rint() replacement
Next
From: Robert Treat
Date:
Subject: Re: 7.4 features list