Improve computations of interval_div to prevent rounding problem on AIX.
This commit is contained in:
parent
3dbbbbf8e9
commit
f76f24dfff
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.144 2005/07/23 14:25:34 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.145 2005/07/23 14:53:21 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2308,9 +2308,9 @@ interval_div(PG_FUNCTION_ARGS)
|
|||||||
result->day = span->day / factor;
|
result->day = span->day / factor;
|
||||||
result->time = span->time / factor;
|
result->time = span->time / factor;
|
||||||
|
|
||||||
/* Computer remainders */
|
/* Compute remainders */
|
||||||
month_remainder = (span->month - result->month * factor) / factor;
|
month_remainder = span->month / factor - result->month;
|
||||||
day_remainder = (span->day - result->day * factor) / factor;
|
day_remainder = span->day / factor - result->day;
|
||||||
|
|
||||||
/* Cascade fractions to lower units */
|
/* Cascade fractions to lower units */
|
||||||
/* fractional months full days into days */
|
/* fractional months full days into days */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user