Old trick still around

Seen in Reddit’s silly software department. It’s nice that programmers are still using 99999.99 as a debug marker or unattainable max. The trick dates back to decimal registers and COBOL in the 1950s.

The unattainable max was used like this:

Set Price = 99999.99 at the start.

Sum up items sold, calculate discounts and taxes, put the result in Price.

If Price is still 99999.99, something went wrong in the figuring, so just indicate error.

Otherwise, charge buyer for Price.

The trick fails in the rare case when the real Price comes to $99999.99 after all the figuring. Modern computer languages have a NULL value that avoids the rare exception. When you start with NULL and still have NULL after all the figuring, you know for sure the figuring got screwed up. Maybe the clerk didn’t enter anything, maybe the terminal disconnected, maybe the program got derailed.