Re: 8.3 vs HEAD difference in Interval output? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 8.3 vs HEAD difference in Interval output?
Date
Msg-id 4323.1223581367@sss.pgh.pa.us
Whole thread Raw
In response to Re: 8.3 vs HEAD difference in Interval output?  (Kenneth Marshall <ktm@rice.edu>)
Responses Re: 8.3 vs HEAD difference in Interval output?
List pgsql-hackers
Kenneth Marshall <ktm@rice.edu> writes:
> There is a difference between the result 0.6 and 0.60 in rounding.
> The first is accurate +-0.05 and the second is +-0.005. Certainly,
> it does not seem unreasonable that machines can calulate intervals
> to the nearest 100th of a second. What is not clear to me is how the
> decision to stop at the 2nd decimal digit was reached.

Probably by flipping a coin ;-).  You have to remember that all this
behavior was designed around floating-point intervals, so there's
inherent imprecision in there; and the extent depends on the size of
the interval which makes it pretty hard to choose a display precision.

In the integer-timestamp world we know that the number is exact in
microseconds.  We clearly ought to be prepared to display up to six
fractional digits, but suppressing trailing zeroes in that seems
appropriate.

We could try to do the same in the float case, but I'm a bit worried
about finding ourselves showing "1234567.799999" where it should be
"1234567.8".
        regards, tom lane


pgsql-hackers by date:

Previous
From: Kenneth Marshall
Date:
Subject: Re: 8.3 vs HEAD difference in Interval output?
Next
From: "Kevin Grittner"
Date:
Subject: Re: 8.3 vs HEAD difference in Interval output?