The correct way to do this is to define a quadyear=365*4+1, and then just use mods & divides (quadyear -> year-within-quad -> day) with no loop, right?
so 1900 wasn't a leap year 2000 was one 2100 won't be.
Although in most places I saw the code just ignored it as something that's valid between 1901-2099 is considered good enough in most places.
Edit: sorry shouldn't post this early in the morning, its 400 not 1000