PF-Operators 5
PF-Operators 5
FUNDAMENTALS
Dr. Sheikh Faisal Rashid
[email protected],uet.edu.pk
Department of Computer Science and
Engineering UET Lahore
ARITHMETIC
OPERATORS
• Define binary arithmetic operators
• Addition, subtraction, multiplication and division
• Integer division
• Remainder/modulus operator
• Upcasting integers to floating-point
• Order of operations
• Upcasting and order of operations
• Unary arithmetic operators
• Negation and “+”
Arithmetic operations
• Most engineering computations involve simulations of the
real world, requiring the application of mathematics and
modelling
• The A380 double-decker jumbo jet was simulated entirely in
software prior to being built for the first time…
• Processors and circuits are simulated using mathematical models
Arithmetic operations
• A binary arithmetic operator takes two numerical
operands and returns the result of the operation
• The operands may be integers or floating-point
• We are restricted to the non-alphanumeric characters on the
keyboard
• The available binary arithmetic operators are
Operation Operator Integer Floating-
s point
Addition + 3 + 5 3.2 + 7.3
Subtraction – 7 - 6 9.5 - 4.1
Multiplication × 8*9 1.5*2.7
Division ÷ 1/2 4.5/9.6
Note: For clarity, it is usual to place spaces around + and -
but no spaces around * or /
Arithmetic operations
• Juxtaposition is never acceptable to represent multiplication
175 6 534 3
13 35
13 13 15 5
Integer remainder
• To find the remainder of a division, use the modulus
operator
• Also called the remainder operator