Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
darkwater
18 days ago
|
parent
|
context
|
favorite
| on:
A leap year check in three instructions
I wondered 3 minutes "this is not right" til I realized that
if ((y % 25) != 0) return true;
was actually checking for different from 0 (which in hindsight makes also sense because the century years by default are not leap unless they divide by 400)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: