Re: rint() replacement

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rint() replacement
Date: 2003-05-09 18:59:50
Message-ID: D90A5A6C612A39408103E6ECDD77B8294CDC32@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)dunslane(dot)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
>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2003-05-09 19:37:37 Re: 7.4 features list
Previous Message Andrew Dunstan 2003-05-09 18:53:44 Re: rint() replacement