Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8283b65

Browse files
committed
Rewrite rint() to enable removal of copyright mention; patch from
Nathan WagnerFunction is simpler too.
1 parentf419a82 commit8283b65

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

‎src/port/rint.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
* rint.c
44
* rint() implementation
55
*
6-
* Copyright (c) 1999, repas AEG Automation GmbH
7-
*
8-
*
96
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/rint.c,v 1.2 2003/11/29 19:52:13 pgsql Exp $
7+
* $PostgreSQL: pgsql/src/port/rint.c,v 1.3 2010/02/05 03:20:56 momjian Exp $
118
*
129
*-------------------------------------------------------------------------
1310
*/
@@ -18,20 +15,5 @@
1815
double
1916
rint(doublex)
2017
{
21-
doublef,
22-
n=0.;
23-
24-
f=modf(x,&n);
25-
26-
if (x>0.)
27-
{
28-
if (f>.5)
29-
n+=1.;
30-
}
31-
elseif (x<0.)
32-
{
33-
if (f<-.5)
34-
n-=1.;
35-
}
36-
returnn;
18+
return (x>0.0) ?floor(x+0.5) :ceil(x-0.5);
3719
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp