Hacker News new | ask | show | jobs
by NauticalStu 2318 days ago
This reminds me of my favorite bug at my first programming job.

I worked on a system that processed benefits. We generated a lot of reports, one of which being the overage dependent report, listing all children that were over the age limit for that insurance plan.

We had one case where a newborn was showing up on that report, and for end users, there was no indication why. DOB was 20-something days ago, not 20-something years ago.

Lo and behold, the paperwork was somehow filed before the baby was born, and our date calculation method was returning an unsigned int. So the logic was resulting in an age of -1 (since DOB was prior coverage start date), which wrapped around to 255, which was obviously higher than whatever the max dependent age was.

It was a fun one to debug and explain.

2 comments

> So the logic was resulting in an age of -1 (since DOB was prior coverage start date), which wrapped around to 255

I really look forward to human ages breaking your assumption that they fit in 8 bits.

If the fix was to make it signed, that might not be so far off!
0.001K ought to be enough for anyone.
I spent some time debugging insurance systems, and bugs exactly like that were everywhere. There are lots of date comparisons in those kinds of systems, and the order in which those events happen are almost always described to happen in a certain order, but there's tons of exceptions for every case.