"On June 4, 1996, the maiden flight of the European Ariane 5 launcher crashed about 40 seconds after takeoff. Media reports indicated that the amount lost was half a billion dollars -- uninsured."

This was caused by a floating-point error: a conversion from a 64-bit integer to a
16-bit signed integer. If you think the software for this wasn't thoroughly tested, well...

This stuff happens, despite the best intentions of all involved. I assume you test all of the software you write. I'll also bet hard cash you've had (multiple) bugs caught in production. We all have. All it takes is for one of these bugs to cause something unforseen to raise them from "oops, my bad", to the level of losing half a billion dollars, taking production machines down, crashing airplanes or even causing death. You're absolutely right about not being able to sleep at night, though.