Comments (1)
I had some fun with arbitrary-precision calculators trying to figure out precisely where any given Unix block ends. The answers are:
1961-07-31 23:59:59.950000749999988750000168749997468750038
1962-01-01 00:00:00
1963-11-01 00:00:00.09999999870000001689999978030000285609996
1964-01-01 00:00:00
1964-04-01 00:00:00.099999998500000022499999662500005062499924
1964-09-01 00:00:00.099999998500000022499999662500005062499924
1965-01-01 00:00:00.099999998500000022499999662500005062499924
1965-03-01 00:00:00.099999998500000022499999662500005062499924
1965-07-01 00:00:00.099999998500000022499999662500005062499924
1965-09-01 00:00:00.099999998500000022499999662500005062499924
1966-01-01 00:00:00
1968-01-31 23:59:59.90000000299999991000000269999991900000243
1972-01-01 00:00:00.107757996767260096982197090534087283977381
(all UTC). Expressed as Unix millisecond counts, these are:
-265680000049.99999925000001124999983125000253124996
-252460800000
-194659199900.00000129999998310000021969999714390004
-189388800000
-181526399900.00000149999997750000033749999493750008
-168307199900.00000149999997750000033749999493750008
-157766399900.00000149999997750000033749999493750008
-152668799900.00000149999997750000033749999493750008
-142127999900.00000149999997750000033749999493750008
-136771199900.00000149999997750000033749999493750008
-126230400000
-60480000099.99999700000008999999730000008099999757
63072000107.757996767260096982197090534087283977381
The closest float to each of these numbers is:
-265680000050
-252460800000
-194659199900
-189388800000
-181526399900
-168307199900
-157766399900
-152668799900
-142127999900
-136771199900
-126230400000
-60480000100
63072000107.75799560546875
BUT what we actually want is the exact float or the next lowest float, which yields a different answer in several cases:
-265680000049.999969482421875
-252460800000
-194659199900
-189388800000
-181526399900
-168307199900
-157766399900
-152668799900
-142127999900
-136771199900
-126230400000
-60480000099.99999237060546875
63072000107.75800323486328125
We don't need to use all of those decimal places to uniquely identify those floats, so we can stop at:
-265680000049.99997
-252460800000
-194659199900
-189388800000
-181526399900
-168307199900
-157766399900
-152668799900
-142127999900
-136771199900
-126230400000
-60480000099.99999
63072000107.758
from t-a-i.
Related Issues (9)
- Extend back to 1961 HOT 4
- Slightly inaccurate TAI block start times HOT 1
- Unix block start times should always be integer numbers of milliseconds, but aren't
- Improved API for different leap second models HOT 3
- Integration with `Temporal`
- Move to ES modules HOT 3
- Support Meta's 17-hour sinusoidal smear? HOT 3
- High Precision TAI Timestamp HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from t-a-i.