# Name 2 8 marks total consider the matlab function

• Test Prep
• 9
• 100% (5) 5 out of 5 people found this document helpful

This preview shows page 3 - 6 out of 9 pages.

Name:2.(8 marks total)Consider theMatlabfunction contained in the filefunc1.m.function [z,zx,zy] = func1(x,y)% [z,zx,zy] = func1(x,y)zx=0; zy=0;if y > 1z=x-y; zx=1; zy=2;if x-y < 2z=x+2*y; zx=2;endelsez=2*x-y; zx=3;end(a) What values ofZ,Zx, andZyare returned by the following function invocation?
(b) What values ofZ,Zx, andZyare returned by the following function invocation?
Name:3.(4 marks total)Convert the following numbers to decimal (i.e., base 10) numbers.Write your answers to at least three digits using the round-to-nearest rule.Use normalised scientific notation with the leading nonzero digit to the right of thedecimal point, i.e., in the form (0.d1d2. . . dt)10×10ewhereeis a suitable exponent,the precisiont= 6, andd16= 0 is the leading nonzero digit.(a) (101)2(b) (20.2)34.(2 marks total)Consider a binary floating-point number system characterised by precisiont= 3 and exponents betweenemin=-8 andemax= 7.(a) What is the smallest normalised positive machine number (in binary form)?(b) What is the largest normalised positive machine number (in binary form)?
Name:5.(1 mark)Is the following statement always true (T) or at least sometimes false (F)? Con-
• • • 