Settings

Theme

A faster is_leap_year function (full-range, C++)

benjoffe.com

2 points by benjoffe 3 months ago · 2 comments

Reader

benjoffeOP 3 months ago

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".

benjoffeOP 3 months ago

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

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

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection