[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] PPS and doubles
From: |
Miroslav Lichvar |
Subject: |
Re: [gpsd-dev] PPS and doubles |
Date: |
Mon, 2 Feb 2015 08:34:33 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Sun, Feb 01, 2015 at 03:01:11PM -0800, Gary E. Miller wrote:
> + delay = (drift.clock.tv_sec + drift.clock.tv_nsec / 1e9) -
> last_fixtime_clock;
> + if (0.0 > delay || 1.0 < delay) {
>
> Delay is 53 bits of precision.
> tv_sec is 32, soon to be 33 bits of precision
> tv_nsec = 20 bits of precision
>
> So (tv_sec + tv_nsec / 1e9) is 63 bits of precision.
> 63 bits of precision does not fit in 53 bits of double!
>
> This is why we do not use doubles in PPS land.
Just curious, what problem exactly did it cause? The delay value is
used only for the (0.0, 1.0) interval check, so I'm not sure how could
switching to integer math change the observed behavior.
--
Miroslav Lichvar