Logic error

This is an old revision of this page, as edited by 68.239.227.152 (talk) at 23:58, 4 November 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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