Computing desk | ||
---|---|---|
< May 12 | << Apr | May | Jun >> | May 14 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
In a discussion on the Mathematics desk which archived yesterday @ Dionne Court: said:
Compact arithmetic methods of producing calendars, calculating the days between 2 dates, etc., have been used in digital computers ever since there have been digital computers.
So they know the number of days in each month, but the programmers don't always get it right (hence the "millennium bug" partly caused by some computers not knowing that February 2000 had 29 days, although they knew that (say) February 1900 and February 2100 have only 28). How is the information programmed into computers?
Topical aside (which always generates heated discussion): the day of the week on which the thirteenth of the month most often falls is ... Friday. 89.240.119.222 ( talk) 09:23, 13 May 2022 (UTC)
While doing some computer programming I needed to determine an upper bound for the number of days in a month and I sought amusement in trying to find a one-liner to do the job, using only well-known functions.
First I thought of representing the function d(m) -> {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} as a Fourier series but that turned out to be rather complicated and I eventually realised that I could achieve what I wanted by something like a mean term 30.5 and a single trigonometric function. I took August as the starting point; hence the phase of 7.5. For some reason this turned out better than January, although both are second of consecutive 31-day months. The fine tuning was determined by experiment. Thus 30.5 became 30.9 with a multiplier of 2.9, which is quite near to 11π/12.
The bit in square brackets was a later enhancement to deal with leap years.
In the years leading up to the turn of the century, the public gradually became aware of the "Y2K scare", and individual companies predicted the global damage caused by the bug would require anything between $400 million and $600 billion to rectify. (...) Contrary to public expectations, few major errors actually occurred in 2000.
date site:thedailywtf.com
.)
Tigraan
Click here for my talk page ("private" contact) 09:07, 18 May 2022 (UTC)Computing desk | ||
---|---|---|
< May 12 | << Apr | May | Jun >> | May 14 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
In a discussion on the Mathematics desk which archived yesterday @ Dionne Court: said:
Compact arithmetic methods of producing calendars, calculating the days between 2 dates, etc., have been used in digital computers ever since there have been digital computers.
So they know the number of days in each month, but the programmers don't always get it right (hence the "millennium bug" partly caused by some computers not knowing that February 2000 had 29 days, although they knew that (say) February 1900 and February 2100 have only 28). How is the information programmed into computers?
Topical aside (which always generates heated discussion): the day of the week on which the thirteenth of the month most often falls is ... Friday. 89.240.119.222 ( talk) 09:23, 13 May 2022 (UTC)
While doing some computer programming I needed to determine an upper bound for the number of days in a month and I sought amusement in trying to find a one-liner to do the job, using only well-known functions.
First I thought of representing the function d(m) -> {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} as a Fourier series but that turned out to be rather complicated and I eventually realised that I could achieve what I wanted by something like a mean term 30.5 and a single trigonometric function. I took August as the starting point; hence the phase of 7.5. For some reason this turned out better than January, although both are second of consecutive 31-day months. The fine tuning was determined by experiment. Thus 30.5 became 30.9 with a multiplier of 2.9, which is quite near to 11π/12.
The bit in square brackets was a later enhancement to deal with leap years.
In the years leading up to the turn of the century, the public gradually became aware of the "Y2K scare", and individual companies predicted the global damage caused by the bug would require anything between $400 million and $600 billion to rectify. (...) Contrary to public expectations, few major errors actually occurred in 2000.
date site:thedailywtf.com
.)
Tigraan
Click here for my talk page ("private" contact) 09:07, 18 May 2022 (UTC)