Negation, in computer science, is used to refer to NOT operations, like:
boolean negateFlag(boolean flag)
Obtaining the negative of a value is finding the inverse of said value. From http://en.wikipedia.org/wiki/Inverse_function
In mathematics, an inverse function is a function that undoes another function: If an input x into the function ƒ produces an output y, then putting y into the inverse function g produces the output x, and vice versa. i.e., ƒ(x)=y, and g(y)=x. More directly, g(ƒ(x))=x, meaning g(x) composed with ƒ(x) leaves x unchanged.
A function ƒ that has an inverse is called invertible; the inverse function is then uniquely determined by ƒ and is denoted by ƒ−1 (read f inverse, not to be confused with exponentiation).
As such, a -1 is not necessarily the negation of 1, as it is not a boolean true/false statement. In programming, sometimes integer values are used in lieu of boolean values, but generally they are either part of an evaluation that returns a boolean result, like if(x >= y)
, or, when used to act as a boolean flag, the compiler (generally) only checks if the value is zero (0) for FALSE
and any other value for TRUE