Hacker News new | ask | show | jobs
A faster is_leap_year function (full-range, C++) (benjoffe.com)
2 points by benjoffe 189 days ago
2 comments

In this article I present a new faster full-range function to calculate whether a year is a leap year. This type of calculation is a fundamental date library utility, it is used all over the place: validating and parsing dates, determining the Nth last weekday of a month, handling month overflow/underflow when adjusting the day, etc.

The article outlines the technique, shows related developments before and after its creation, and includes an interactive, human-verifiable "proof".

Correct URL: https://www.benjoffe.com/fast-leap-year

(The link in the submission is incorrect; apologies for the confusion.)