Home

singleoperator

Singleoperator is a term occasionally used in technical writing to denote an operator that takes exactly one operand. In most contexts, the more common term is unary operator. The concept of arity distinguishes unary (one input) from binary (two inputs) and higher-arity operators.

In programming languages, unary operators perform simple operations on a single expression. Examples include arithmetic negation

Unary operators often have higher precedence than most binary operators, and when multiple unary operators appear

In mathematics, unary operators are endomaps or functions that take a single input, such as the negation

See also unary operator, operator arity, and function or endomorphism concepts for related material.

(-x),
unary
plus
(+x),
logical
negation
(!x
or
not
x),
and
bitwise
complement
(~x).
Increment
and
decrement
operators
(++,
--)
are
also
treated
as
unary
in
languages
that
define
them
in
this
way.
The
syntax
of
unary
operators
can
be
prefix
(before
the
operand)
or,
in
some
languages,
postfix
(after
the
operand).
Their
exact
behavior
and
allowable
operands
depend
on
the
language
and
its
type
system.
in
sequence,
they
are
typically
applied
from
right
to
left
(for
example,
-
-x
is
parsed
as
-(
-x)).
In
many
languages,
unary
operators
can
be
overloaded
to
work
with
user-defined
types,
giving
them
context-specific
meanings,
such
as
applying
to
numeric,
boolean,
or
pointer
types.
operator
on
real
numbers
or
derivative
operators
on
suitable
function
spaces.
They
can
be
composed
to
form
more
complex
operations
and
are
foundational
in
the
study
of
function
composition
and
operator
theory.