In Computer Science, a logic error is a bug in a program that causes unexpected results or operation but not failure. Logic errors are usually the hardest to debug because they do not cause the program to fail completely. With a logic error, the program can be compiled (suppose there are no other errors), executes, but produces the wrong answer. The mistake could be the logical error in statement (for example, wrong or incorrect formula), an error in algorithm or even wrong algorithm selected. One of the ways to solve this kind of errors is to output the program's variables to a file or on the screen in order to define the error's ___location in code. The common example is when you get the incorrect results of mathematical calculation (when checked by other means for example, by calculator).
The example of logic error (Visual Basic). You input:
If Ratio > ThresholdA Then violationCounter = 0 End If
when you really need the "Ratio" to be less than "ThresholdA".
See also