02-24-2023 01:02 PM
Needing a new car battery, I was trying to see if Google knows how many years is a 84 month warranty (Yes, I can do it in my head of course!).
Apparently, google gives almost the correct answer, but the result is about 5 minute off. 😄
Bonus question: What possible numerical representation do they use to be off this way?
02-24-2023 02:48 PM
Google's just accounting for leap years 🙃
02-24-2023 02:56 PM - edited 02-24-2023 02:56 PM
@Jacobson-ni wrote:
Google's just accounting for leap years 🙃
That was actually my first thought, but 5 minutes over 7 years is much, much less than a day. 😄
(... maybe its an intentional trap to see if somebody steals their code, similar to the use of trap streets on maps.)
02-27-2023 03:14 AM - edited 02-27-2023 03:22 AM
Leap year is every 4 years, but every 100 years that is skipped, and every 1000 years the skip is skipped 😄
So the the question would be: Do they use the Sidereal, tropical, and anomalistic year?
And there are even some more ...
https://en.wikipedia.org/wiki/Year#Astronomical_years
02-27-2023 03:29 AM
IIRC, there can be 59 to 62 seconds in a minute, although 62 is rare.
This is probably just rounding, although a sgl, dbl (nor ext, sigh) get us this rounding error.
I have run into these kind of problems. I developed an integer math library at some point, to support math on integer fractions. Pretty straight forward, but it does solve problems in a few (very specific) situations.
02-27-2023 11:25 AM
Well, I understand the potential issue with the division, but the second problem is just a multiplication, they even give the formula (multiply the value by 12).
7 x 12 is NOT 83.9999, even in SGL or U8.
I don't think leap seconds/years matter because it does not add up.
Once we go to fractional years in units of months, there is entire new can of worms, because each month has a different number of days.
02-27-2023 11:30 AM - edited 02-27-2023 12:22 PM
Curiously, of we ask in a slightly different way, we get yet another result.
Apparently, a year has now approximately 12.008 months. (Maybe we should tell Gregory!)
Now. I wonder if they already made some changes based on me clicking on the feedback button 😄 .
Actually, it depends if we pick "year" or "calendar year" as unit. Now I need to look up the definitions.... 😮
(This seems about right when considering leap years, but it is an approximation. For example there could be 1 or two leap years in that interval, depending on the start)