On Friday, 22 April, 2016 02:24. Stephan Beal <sgbeal at googlemail.com> said:

> On Thu, Apr 21, 2016 at 4:12 PM, jrhgame <jrhgame at 163.com> wrote:

> > SELECT julianday('2016-04-15 12:10:10')  ==>2457494.00706
> > SELECT datetime(2457494.00706)           ==>2016-04-15 12:10:09

> fwiw, i've done lots and lots of testing with round-trip conversions
> between those two formats, and it cannot be done 100% reliably (at least
> on
> consumer-grade hardware). There is always a minority percentage of cases
> which round/truncate one second here or there. It's particularly ugly when
> it happens on a day boundary. You may see that the percentage of
> occurrences is higher on ARM platforms, compared to i64.

Actually on anything that uses IEEE-754 Double Precision floating point, 1 ULP 
for the current date is about 41 microseconds.  So round trips to and from 
julianday are entirely reliable, even on consumer grade hardware.

Around 400 AD 1 ULP was 23 microseconds.  In the year 9000 1 ULP will be about 
92 microseconds.

Seems pretty reliable (and accurate) to me.  It is just hoomanz being imprecise 
that are causing you difficulties (or perhaps premature optimization -- in this 
case rounding) -- it is not the computer systems.

Of course, single precision floating point will be much less accurate.  But who 
uses that for anything?




Reply via email to