Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

EXERCISE THREE: Addition in Base 2 1 . Write a function z = AddIntegral ( x , y ) which takes as input two vectors

EXERCISE THREE: Addition in Base 2
1. Write a function z = AddIntegral (x,y) which takes as input two vectors x andy representing two positive integers in base 2 and adds them. It returns the sum z, which is also a vector in base 2. Example: For x =[100111] and y =[1111], your function should return z =[110110]
2. Write a function [I F]= AddFractional (x,y) which takes as input two vectors xand y representing two fractional parts in base 2 and adds them. The result might have an integral part I which is not zero. The function therefore returns two vectors: the integral part I of the sum and its fractional part F, both in base 2.
Example: For x =[1111] and y =[111],your function should return: I =1 and F =[1101]
3. Write a function [I F]= AddBinary (Ix, Fx, Iy, Fy) which will operate on twofractional binary numbers x and y whose integral parts are the binary vectors Ix and Iy respectively, and their fractional parts are the binary vectors Fx and Fy respectively. It returns [I F], which are two vectors containing respectively the integral and the fractional part of the sum of x and y.
Example: For Ix =[100111], Iy =[1111], Fx =[1111], and Fy =[111], your function should return: I =[110111] and F =[1101]
4. Write a function [I F E]= main(Fx, Fy), which will operate on two positive numbersx and y in IEEE single precision assuming integral parts equal to 1 and an exponent equal to zero. It takes as input Fx and Fy, which are respectively the fractional parts of x and y, in the IEEE single representation. It returns [I F E], which are 3 vectors containing respectively the integral, the fractional part, and the exponent of the sum of x and y, in a normalized format and rounded to the closest in the IEEE single precision representation. Example: For Fy =[11111111111111111111111] and
Fx =[00000000000000000000001] your function should return: I =
1, F =[10000000000000000000000] and E =1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

What is the education level of your key public?

Answered: 1 week ago

Question

What are the cultural/ethnic/religious traits of your key public?

Answered: 1 week ago