Operand
Encyclopedia
In mathematics, an operand is the object of a mathematical operation, a quantity on which an operation is performed.
expression shows an example of operators and operands:
In the above example, '+' is the symbol for the operation called addition
.
The operand '3' is one of the inputs (quantities) followed by the addition operator, and the operand '6' is the other input necessary for the operation.
The result of the operation is 9. (The number '9' is also called the sum of the addends, 3 and 6.)
An operand, then, is also referred to as "one of the inputs (quantities) for an operation".
In the above expression '(3 + 5)' is the first operand for the multiplication operator and '2' the second. The operand '(3 + 5)' is an expression in itself, which contains an addition operator, with the operands '3' and '5'.
A more common synonym is a variable.
In the above expression, the multiplication operator has the higher precedence than the addition operator, so the multiplication operator has operands of '5' and '2'. The addition operator has operands of '3' and '5 × 2'.
being used the position of an operator in relation to its operand(s) may vary. In everyday usage infix notation
is the most common, however other notations also exist, such as the prefix and postfix notations. These alternate notations are most common within computer science
.
Below is a comparison of three different notations — all represent an addition of the numbers '1' and '2'
(infix notation)
(prefix notation)
(postfix notation)
Please excuse my dear Aunt Sally.
The first letter (in boldtype) of each word in the above mnemonic stands for the following:
In a mathematical expression, the order of operation is carried out from left to right. Start with the left most value and seek the first operation to be carried out in accordance with the order specified above (i.e., start with parentheses and end with subtraction). For example, in the expression
,
the first operation to be acted upon is any and all expressions found inside a parenthesis. So beginning at the left and moving to the right, find the first (and in this case, the only) parenthesis, that is, (2 + 22). Within the parenthesis itself is found the expression 22. The reader is required to find the value of 22 before going any further. The value of 22 is 4. Having found this value, the remaining expression looks like this:
The next step is to calculate the value of expression inside the parenthesis itself, that is, (2 + 4) = 6. Our expression now looks like this:
Having calculated the parenthetical part of the expression, we start over again beginning with the left most value and move right. The next order of operation (according to the rules) is exponents. Start at the left most value, that is, 4, and scan your eyes to the right and search for the first exponent you come across. The first (and only) expression we come across that is expressed with an exponent is 22. We find the value of 22, which is 4. What we have left is the expression
.
The next order of operation is multiplication. 4 × 4 is 16. Now our expression looks like this:
The next order of operation according to the rules is division. However, there is no division operator sign (÷) in the expression, 16 − 6. So we move on to the next order of operation, i.e., addition. But there is no addition operator sign (+) in the expression 16 − 6. So we move on to the next and final order of operation, which is subtraction.
.
So the correct value for our original expression, 4 × 22 − (2 + 22), is 10.
It is important to carry out the order of operation in accordance with rules set by convention. If the reader evaluates an expression but does not follow the correct order of operation, the reader will come forth with a different value. The different value will be the incorrect value because the order of operation was not followed. The reader will arrive at the correct value for the expression if and only if each operation is carried out in the proper order.
. Based on arity, operators are classified as nullary (no operands), unary
(1 operand), binary
(2 operands), ternary
(3 operands) etc.
s, the definitions of operator
and operand are almost the same as in mathematics.
In computing, an operand is the part of a computer instruction which specifies what data is to be manipulated or operated on, whilst at the same time representing the data itself. A computer instruction describes an operation such as add or multiply X, while the operand (or operands, as there can be more than one) specify on which X to operate as well as the value of X.
Additionally, in assembly language
, an operand is a value (an argument) on which the instruction, named by mnemonic
, operates. The operand may be a processor register
, a memory address
, a literal constant, or a label. A simple example (in the x86 architecture) is
where the value in register operand 'AX' is to be moved into register 'DS'. Depending on the instruction
, there may be zero, one, two, or more operands.
Example
The following arithmeticArithmetic
Arithmetic or arithmetics is the oldest and most elementary branch of mathematics, used by almost everyone, for tasks ranging from simple day-to-day counting to advanced science and business calculations. It involves the study of quantity, especially as the result of combining numbers...
expression shows an example of operators and operands:
In the above example, '+' is the symbol for the operation called addition
Addition
Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign . For example, in the picture on the right, there are 3 + 2 apples—meaning three apples and two other apples—which is the same as five apples....
.
The operand '3' is one of the inputs (quantities) followed by the addition operator, and the operand '6' is the other input necessary for the operation.
The result of the operation is 9. (The number '9' is also called the sum of the addends, 3 and 6.)
An operand, then, is also referred to as "one of the inputs (quantities) for an operation".
Expressions as operands
Operands may be complex, and may consist of expressions also made up of operators with operands.In the above expression '(3 + 5)' is the first operand for the multiplication operator and '2' the second. The operand '(3 + 5)' is an expression in itself, which contains an addition operator, with the operands '3' and '5'.
A more common synonym is a variable.
Order of operations
Rules of precedence affect which values form operands for which operators:In the above expression, the multiplication operator has the higher precedence than the addition operator, so the multiplication operator has operands of '5' and '2'. The addition operator has operands of '3' and '5 × 2'.
Positioning of operands
Depending on the mathematical notationMathematical notation
Mathematical notation is a system of symbolic representations of mathematical objects and ideas. Mathematical notations are used in mathematics, the physical sciences, engineering, and economics...
being used the position of an operator in relation to its operand(s) may vary. In everyday usage infix notation
Infix notation
Infix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on . It is not as simple to parse by computers as prefix notation or postfix notation Infix notation is the common arithmetic and logical formula notation,...
is the most common, however other notations also exist, such as the prefix and postfix notations. These alternate notations are most common within computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...
.
Below is a comparison of three different notations — all represent an addition of the numbers '1' and '2'
(infix notation)
(prefix notation)
(postfix notation)
Infix Notation and the Order of Operation
With infix notation, one easy mnemonic for remembering the order of operation is:Please excuse my dear Aunt Sally.
The first letter (in boldtype) of each word in the above mnemonic stands for the following:
- p = parentheses
- e = exponents
- m = multiplication
- d = division
- a = addition
- s = subtraction
In a mathematical expression, the order of operation is carried out from left to right. Start with the left most value and seek the first operation to be carried out in accordance with the order specified above (i.e., start with parentheses and end with subtraction). For example, in the expression
,
the first operation to be acted upon is any and all expressions found inside a parenthesis. So beginning at the left and moving to the right, find the first (and in this case, the only) parenthesis, that is, (2 + 22). Within the parenthesis itself is found the expression 22. The reader is required to find the value of 22 before going any further. The value of 22 is 4. Having found this value, the remaining expression looks like this:
The next step is to calculate the value of expression inside the parenthesis itself, that is, (2 + 4) = 6. Our expression now looks like this:
Having calculated the parenthetical part of the expression, we start over again beginning with the left most value and move right. The next order of operation (according to the rules) is exponents. Start at the left most value, that is, 4, and scan your eyes to the right and search for the first exponent you come across. The first (and only) expression we come across that is expressed with an exponent is 22. We find the value of 22, which is 4. What we have left is the expression
.
The next order of operation is multiplication. 4 × 4 is 16. Now our expression looks like this:
The next order of operation according to the rules is division. However, there is no division operator sign (÷) in the expression, 16 − 6. So we move on to the next order of operation, i.e., addition. But there is no addition operator sign (+) in the expression 16 − 6. So we move on to the next and final order of operation, which is subtraction.
.
So the correct value for our original expression, 4 × 22 − (2 + 22), is 10.
It is important to carry out the order of operation in accordance with rules set by convention. If the reader evaluates an expression but does not follow the correct order of operation, the reader will come forth with a different value. The different value will be the incorrect value because the order of operation was not followed. The reader will arrive at the correct value for the expression if and only if each operation is carried out in the proper order.
Arity
The number of operands of an operator is called its arityArity
In logic, mathematics, and computer science, the arity of a function or operation is the number of arguments or operands that the function takes. The arity of a relation is the dimension of the domain in the corresponding Cartesian product...
. Based on arity, operators are classified as nullary (no operands), unary
Unary operation
In mathematics, a unary operation is an operation with only one operand, i.e. a single input. Specifically, it is a functionf:\ A\to Awhere A is a set. In this case f is called a unary operation on A....
(1 operand), binary
Binary operation
In mathematics, a binary operation is a calculation involving two operands, in other words, an operation whose arity is two. Examples include the familiar arithmetic operations of addition, subtraction, multiplication and division....
(2 operands), ternary
Ternary operation
In mathematics, a ternary operation is an n-ary operation with n = 3. A ternary operation on a set A takes any given three elements of A and combines them to form a single element of A. An example of a ternary operation is the product in a heap....
(3 operands) etc.
Computer science
In computer programming languageProgramming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
s, the definitions of operator
Operator (programming)
Programming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
and operand are almost the same as in mathematics.
In computing, an operand is the part of a computer instruction which specifies what data is to be manipulated or operated on, whilst at the same time representing the data itself. A computer instruction describes an operation such as add or multiply X, while the operand (or operands, as there can be more than one) specify on which X to operate as well as the value of X.
Additionally, in assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
, an operand is a value (an argument) on which the instruction, named by mnemonic
Mnemonic
A mnemonic , or mnemonic device, is any learning technique that aids memory. To improve long term memory, mnemonic systems are used to make memorization easier. Commonly encountered mnemonics are often verbal, such as a very short poem or a special word used to help a person remember something,...
, operates. The operand may be a processor register
Processor register
In computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...
, a memory address
Memory address
A digital computer's memory, more specifically main memory, consists of many memory locations, each having a memory address, a number, analogous to a street address, at which computer programs store and retrieve, machine code or data. Most application programs do not directly read and write to...
, a literal constant, or a label. A simple example (in the x86 architecture) is
- MOVMOV (x86 instruction)In the x86 assembly language, the MOV instruction is a mnemonic for the copying of data from one location to another. The x86 assembly language has a number of different move instructions...
DS, AX
where the value in register operand 'AX' is to be moved into register 'DS'. Depending on the instruction
Instruction set
An instruction set, or instruction set architecture , is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception handling, and external I/O...
, there may be zero, one, two, or more operands.