[Haskell-cafe] Re: System.CPUTime and picoseconds

Lennart Augustsson lennart at augustsson.net
Sun Jan 11 19:00:51 EST 2009

On Sun, Jan 11, 2009 at 8:28 PM, ChrisK <haskell at list.mightyreason.com> wrote:
> An Double or Int64 are both 8 bytes and counts with picoseconds precision
> for 2.5 hours to 106 days.  Going to 12 byte integer lets you count to 3.9
> billion years (signed).  Going to 16 byte integer is over 10^38 years.
> Lennart Augustsson wrote:
>> A double has 53 bits in the mantissa which means that for a running
>> time of about 24 hours you'd still have picoseconds.  I doubt anyone
>> cares about picoseconds when the running time is a day.
> The above is an unfounded claim about the rest of humanity.

It's not really about humanity, but about physics.  The best known
clocks have a long term error of about 1e-14.
If anyone claims to have made a time measurement where the accuracy
exceeds the precision of a double I will just assume that this person
is a liar.

For counting discrete events, like clock cycles, I want something like
Integer or Int64.  For measuring physical quantities, like CPU time,
I'll settle for Double, because we can't measure any better than this
(this can of course become obsolete, but I'll accept that error).

  -- Lennart

More information about the Haskell-Cafe mailing list