Biostatistics(computer arithmetic)
Biostatistics(computer arithmetic)
: Deepa Anwar
• To execute arithmetic operations there is a separate section
called arithmetic processing unit in central processing unit.
The arithmetic instructions are performed generally on binary
or decimal data. Fixed-point numbers are used to represent
integers or fractions
: Deepa Anwar
Addition and Subtraction :
The algorithms for addition and subtraction are derived from the
table and can be stated as follows (the words parentheses should be
used for the subtraction algorithm)
: Deepa Anwar
Here are some examples of binary addition.
1 1 1 1 1 1 1 1 1 1
1 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1
+ 1 1 1 0 1 + 1 1 0 0 1 + 1 1 1 0 1 0
1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 1 0 0 1 1
: Deepa Anwar
Here are some examples of binary subtraction.
• 1011011 − 10010 = 1001001: • 1010110 − 101010 = 101100: • 1000101 − 101100 = 11001:
0 0 0 1 1
× 1 × 1 × ×
1 0 1 1 0 1 1 1 1 0 × 1
1 0 1 0 1 1 1 0 1
1 0
− 1 0 0 1 0 − 1 0 1 0 1 0 0 0
1 0 0 1 0 0 1 1 0 1 1 0 0 − 1 0 1 1 0 0
1 1 0 0 1
• 100010110 − 1111010 = 10011100: • 101101 − 100111 = 110:
1
0 1 1 1 1
0 0
0
× × ×
× × 1 × × 1
1 1 1 1 1 0 1 0 1
1 1 0 1 1 0
0 0 0
− 1 0 0 1 1 1
− 1 1 1 1 0 1 0
1 1 0
1 0 0 1 1 1 0 0
: Deepa Anwar