Вы находитесь на странице: 1из 10

Floating Point Arithmetic Operations

x
The scientific notation for floating point is : m × r
The floating point is said to be normalized only if the
most significant digit is non-zero.

0036525 Notanormalizedvalue
.36525×
105 Anormalizedvalue

.00110101 Notanormalizedvalue
.110101 × 2-2 Anormalizedvalue

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


Adding or subtracting two numbers requires first an
alignment of the radix point, since the exponent
must be made equal before the operations with
mantissa.
The alignment is done by shifting one mantissa
while its exponent is adjusted until it is equal to
the other exponent.
Ex 1: .654321 × 10 .654321 × 10
2 Alignment 2
.123456 × 10
-1
+.000123 × 10
2
.654444 × 10
2
Ex 2: .654321 × 10
2
+.432100 × 10
2 Alignment
1.086421 × 10 2 .1086421 × 10 3

An overflow can be corrected easily by shifting the sum once to the


right and incrementing the exponent.
B. Vishnu Vardhan Assist. Professor VITW, Enikepadu
Ex 3: .654321 × 10
2
- .654210 × 10
2 Alignment
.000111 × 10 2 .111 × 10 -1

An underflow can be corrected easily by shifting the sum once to


the left and decrementing the exponent.

Biased Exponent

The bias is the number that is added to each exponent as the floating
number is formed, so that internally all exponent are positive.

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


Register Configuration

Bs B b

E Parallel Adder and


Parallel Adder Complement

As A1 A a

Qs Q q

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


Addition and Subtraction
The alignment of the mantissas must be carried our prior to
their operation. After the mantissas are added or subtracted,
the result may be unnormalized. The normalization
procedure ensures that the results is normalized prior to its
transfer to memory.

Algorithm divided into four components


Step 1: Check for zero’s

Step 2: Align the mantissas

Step 3: Add or subtract the mantissa


Step 4: Normalize the result

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


Step 1: Check for
zero’s
Add or Subtract

0 ≠0 ≠0
BR AC

0
AC ← BR
Add
OP

Sub

AS ← `A s

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


ii) Align Mantissas

A,B ≠ 0

a< a:b
a>
b b
a=b

Shr A Shr B
a←a+1 b←b+1

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


iii) Adding and subtracting the
mantissa

a=b

Sub Add
op

1 1
As Bs As Bs
0 0

EA ← A + B` + 1 EA ← A+B

B. Vishnu Vardhan Assist. Professor VITW, Enikepadu


iv) Normalization the
result: EA ← A+B
EA ← A + B` + 1

=0 0
E E

EA ← A` + 1
As ← As`
= =
1 Shr A1
=0
≠0 A A1 ← E
a←a+1
=0 =
A1 1
AC ←0
Shl A
a←a-1

END
B. Vishnu Vardhan Assist. Professor VITW, Enikepadu
Addition and Subtraction of floating-point number
=0 ≠0 ≠0
BR AC
a< a>
=0 b a :b
b
AC←BR
Shr A a:b Shr B
a ← a+1 a ← a+1
Add
AC

Subtract Add
Sub op
=0
As ← As =1 =0
EA ← A+B`+1 As ‫ סּ‬Bs =1 As ‫ סּ‬Bs

Shr A =0 EA ← A+B
A ← A`+1 E =0
=1 A
As ← A`s
E
≠0 AC ← 0

=0 A1 =1 Shr A
A1←E
Shl A a ← a+1
a ← a-1

End
B. Vishnu Vardhan Assist. Professor VITW, Enikepadu

Вам также может понравиться