Sign in Join
Wiki copytemporary

Not

Deutsch · English · Français · Suomi · Русский

The unary operator not negates a Boolean value. FPC also knows the bitwise not when supplied with an ordinal type.

not is a reserved word.

Boolean operation

The operator not represents the logical negation $\neg A$. In electrical engineering one might write $-A$ or $\overline{A}$ instead, however the unary minus sign has a different meaning in programming.

A not A
false true
true false

not has the highest precedence among logical operators.

Bitwise operation

The bitwise not flips every bit in an ordinal type.

not 1100'1010
―――――――――――――
    0011'0101

It effectively calculates the one’s complement. On virtually all platforms it is implemented by the not instruction. On NAND-gate-based architectures the not instruction can be calculated by the expression $A ⌅ A$.

Note, that only not %0 will definitely result in a value interpretable as true. However, not every other not x will result in a value interpretable as false, since only 0 is considered as false and every other value as true. For example, boolean(not %1) will evaluate as true, but only boolean(not high(nativeUInt)) will evaluate to false.


From the Free Pascal wiki, page "Not", as it stood on 2020-10-16 after a change by Rfc1394, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.