[Haskell-cafe] Re: System.CPUTime and picoseconds
ChrisK
haskell at list.mightyreason.com
Sun Jan 11 14:28:01 EST 2009
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.
> That's why I think a Double is a good choice, it adapts to the time
> scale involved.
Let's compute:
> tTooBig :: Double
> tTooBig = 2^53
>
> main = do
> print (tTooBig == 1+ tTooBig)
The above prints True. How long does your computer have to be running before
losing picosecond resolution?
> tHours = tTooBig / (10^12) / 60 / 60
tHours is 2.501999792983609.
My laptop battery lasts longer.
Nanosecond precision is lost after 106 days.
--
Chris
More information about the Haskell-Cafe
mailing list