Upper limit of bugs in a given program
language-agnostic
Solution
If bug is "a requirement not met by the program", then there is no limit on the number of bugs (per line or otherwise), since there is no limit on the number of requirements.
print "hello world"
Might contain a million bugs. It doesn't create a pink elephant. I leave it to the reader to come up with 999999 other requirements not satisfied by this program.
Problem
Is there an upper limit to the number of bugs contained in a given program? If the number of instructions are known, could one say the program cannot contain more than 'n' bugs? For example, how many bugs could the following function contain? ``` double calcInterest(double amount) { return -O.07 / amount; } ``` A parser would count four terms in the function, and I could count these errors: - wrong number syntax - wrong interest rate (business requirements error) - wrong calculation (should be multiply) - Potential divide by zero Clearly the number of bugs is not infinite given a finite number of instructions. Alternatively, one could say the function accepts 2^64 inputs, and of those, how many produce the correct output. However, is there any way to formally prove an upper limit?