1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Change float8-to-int8 conversion to round to nearest, rather than

truncating to integer.  Remove regress test that checks whether
4567890123456789 can be converted to float without loss; since that's
52 bits, it's on the hairy edge of failing with IEEE float8s, and indeed
rint seems to give platform-dependent results for it.
This commit is contained in:
Tom Lane
2001-01-26 22:50:26 +00:00
parent 5a832218fd
commit b78d1bed07
4 changed files with 11 additions and 32 deletions

View File

@ -87,16 +87,6 @@ SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
| -4567890123456789 | -4.56789012345679e+015
(5 rows)
SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL;
five | q1 | two coercions
------+------------------+------------------
| 123 | 123
| 123 | 123
| 4567890123456789 | 4567890123456789
| 4567890123456789 | 4567890123456789
| 4567890123456789 | 4567890123456789
(5 rows)
SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
five | twice int4
------+------------------

View File

@ -87,16 +87,6 @@ SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
| -4567890123456789 | -4.56789012345679e+15
(5 rows)
SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL;
five | q1 | two coercions
------+------------------+------------------
| 123 | 123
| 123 | 123
| 4567890123456789 | 4567890123456789
| 4567890123456789 | 4567890123456789
| 4567890123456789 | 4567890123456789
(5 rows)
SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
five | twice int4
------+------------------

View File

@ -22,7 +22,6 @@ SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL;
SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL;
SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;