Microsoft acknowledges that there is still an average of 5 errors per 1000 lines of code after an Operating System/Application has been released to the market. In Windows 2000 there are 30,000,000 lines of code. Most errors go undetected until a specific combination of factors is encountered. It must have been much worse with Win 95 judging from the number of times it crashed.
Although I don't know about the numbers,it's the same in principle with aviation software; hence the need for extensive testing.