Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f76f24d

Browse files
committed
Improve computations of interval_div to prevent rounding problem on AIX.
1 parent 3dbbbbf commit f76f24d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/utils/adt/timestamp.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.144 2005/07/23 14:25:34 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.145 2005/07/23 14:53:21 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2308,9 +2308,9 @@ interval_div(PG_FUNCTION_ARGS)
23082308
result->day = span->day / factor;
23092309
result->time = span->time / factor;
23102310

2311-
/* Computer remainders */
2312-
month_remainder = (span->month - result->month * factor) / factor;
2313-
day_remainder = (span->day - result->day * factor) / factor;
2311+
/* Compute remainders */
2312+
month_remainder = span->month / factor - result->month;
2313+
day_remainder = span->day / factor - result->day;
23142314

23152315
/* Cascade fractions to lower units */
23162316
/* fractional months full days into days */

0 commit comments

Comments
 (0)