Many arithmetic or logical operators yield a trivial result when applied to identical operands: for instance, x-x is zero if x is a number, and NaN otherwise; x&x is always equal to x. Code like this is often the result of a typo, such as misspelling a variable name.

Carefully inspect the expression to ensure it is not a symptom of a bug.

In the example below, the function avg is intended to compute the average of two numbers x and y. However, the programmer accidentally used x twice, so the function just returns x:

This problem can be fixed by correcting the typo: