0% found this document useful (0 votes)
18 views10 pages

Arithmetic Operations

The document discusses different types of arithmetic operations and how they can impact precision including logical shifts, arithmetic shifts, cancellation of significant digits, loss of trailing digits, overflow, and underflow. Logical shifts move bits within a number without regard to sign while arithmetic shifts preserve the sign bit. Cancellation of significant digits and loss of trailing digits can occur during subtraction and rounding operations respectively. Overflow happens when a result exceeds the data type capacity while underflow occurs when a result is too small to be represented.

Uploaded by

Sudipto Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views10 pages

Arithmetic Operations

The document discusses different types of arithmetic operations and how they can impact precision including logical shifts, arithmetic shifts, cancellation of significant digits, loss of trailing digits, overflow, and underflow. Logical shifts move bits within a number without regard to sign while arithmetic shifts preserve the sign bit. Cancellation of significant digits and loss of trailing digits can occur during subtraction and rounding operations respectively. Overflow happens when a result exceeds the data type capacity while underflow occurs when a result is too small to be represented.

Uploaded by

Sudipto Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Arithmetic Operations & their Precision

Presented By
Md. Ashiqur Rahman
Assistant Professor
Department of CSE,BUBT
Logical Shift
A logical shift is a bitwise operation that shifts the bits of a binary number to the left or
right.

 Logical shifts are used for moving bits within a binary number without regard for the
number's sign or value

 In a left logical shift, bits are moved to the left, filling the vacant bits with zeros. In a right
logical shift, bits are moved to the right, and the leftmost bits are filled with zeros.

Presented by: Md. Ashiqur Rahman


Logical Shift (Contd.)
Example:
Let's perform a left logical shift on the binary number 11011010

If we shift it left by 2 positions, we get 01101000

Presented by: Md. Ashiqur Rahman


Arithmetic Shift
An arithmetic shift is a bitwise operation that shifts the bits of a binary number to the left
or right while preserving the sign bit.

 Arithmetic shifts are used in signed number representation to maintain the number's sign
during shifting.

 In a right arithmetic shift, the leftmost bit (the sign bit) is duplicated to fill the vacant bits,
preserving the sign of the number.

Presented by: Md. Ashiqur Rahman


Arithmetic Shift (Contd.)
Using an arithmetic shift on the binary number 11011010

If we perform a right arithmetic shift by 1 position, we get 11101101

Presented by: Md. Ashiqur Rahman


Cancellation of Significant Digits
Cancellation of significant digits occurs when two nearly equal numbers are subtracted,
leading to a loss of precision in the result.

 It's a common source of error in numerical computations, and precautions are taken to
minimize it.

 Example: Subtracting 5.99999999 from 6.0 results in 0.00000001, where most of the
significant digits have canceled each other out.

Presented by: Md. Ashiqur Rahman


Loss of Trailing Digit
Loss of trailing digit happens when a number is rounded or truncated, causing the least
significant digit(s) to be dropped.

It's a common operation in numerical approximations and rounding to make numbers more
manageable.

Example: Rounding 3.789 to two decimal places results in 3.79, where the trailing digit (9) is
lost.

Presented by: Md. Ashiqur Rahman


Overflow
Overflow occurs when the result of an arithmetic operation exceeds the representational
capacity of the data type used.

• It's a critical error condition in computer systems and must be handled to avoid incorrect
results.

Example: In a 8-bit signed integer, adding 127 and 2 will result in overflow because the
result (129) cannot be represented in 8 bits.

Presented by: Md. Ashiqur Rahman


Underflow
Underflow occurs when a result is too small (close to zero) to be accurately represented by
the data type used.

 It can lead to a loss of precision or the result being rounded to zero.

 Example: In a floating-point system, dividing a very small number like 0.000000001 by a


very large number like 1000000000 can result in underflow because the result is too close
to zero to be accurately represented.

Presented by: Md. Ashiqur Rahman

You might also like