gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] [PATCH 3/3] Print offset in ntpshmmon instead of referenc


From: Miroslav Lichvar
Subject: Re: [gpsd-dev] [PATCH 3/3] Print offset in ntpshmmon instead of reference time
Date: Wed, 13 May 2015 10:47:55 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, May 07, 2015 at 03:02:03PM -0700, Gary E. Miller wrote:
> My mistake, Python floats are only 52 bits of precision:
> 
> http://stackoverflow.com/questions/8216088/how-to-check-the-size-of-a-float-in-python

That probably prints the number of bits stored in memory, without the
implicit leading bit. It should be the same format as double in C.

> Run this program:
> 
> d = float("1431035819.123456789");
> print("{0:.9f}".format(d))
> 
> 
> And you get:
> 
> 1431035819.123456717
> 
> Not acceptable.

Why not? I'd prefer a solution where no information is lost too, but
in this case I don't think it really matters. When the clock is
synchronized, the offset should be close to zero. When the clock is 45
years off as in your example, I don't really care about nanoseconds,
I'm wondering why is it off by 45 years. :)

Also, pystripchart seems to handle the data internally as floats, so
even if the offset was parsed in a wider format, there would likely be
no difference in the output. The precision would be just lost slightly
later in the processing.

-- 
Miroslav Lichvar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]