Machine epsilon m is a characteristic of the CPU in ones com
Machine epsilon m is a characteristic of the CPU in one’s computer. This machine constant is used extensively when writing computer code to help make one’s algorithms CPU insensitive. Machine epsilon m is the smallest floating point number such that 1 1. + > For any smaller value of , round-off error will return a value of 1 1. + = Machine epsilon is defined by the formula 1 m m b = where b is the base number used by your computer in its construction of a floating-point number (b=2 in computers that run Intel chips), and m is the total number of digits in the mantissa (adjustable and fixed). Note: 1-m is the power of the base b because the first bit in a mantissa is fixed (more on this in task 6). The fixed bit does not appear explicitly in the bit array representing a floating-point number. The following is a convergent series: 2 = 1 (2)!!! ! !!! Write a MatLab script file that reports to the command window the minimum number of terms in this series (including 1) needed to obtain its solution, accurate to within machine precision !. Call this script file a2task3.m
Task 3: Machine Epsilon (10 pts) Machine epsilon EM is a characteristic of the CPU in one\'s computer. This machine constant is used extensively when writing computer code to help make one\'s algorithms CPU insensitive. Machine epsilon Em is the smallest floating point number E such that 1+ E 1. For any smaller value of E, round-off error will return a value of 1+ E-1 Machine epsilon is defined by the formula E bh where b is the base number used by your computer in its construction of a floating-point number (b 2 in computers that run Intel chips), and m is the total number of digits in the mantissa (adjustable and fixed). Note: 1-m is the power of the base b because the first bit in a mantissa is fixed (more on this in task 6). The fixed bit does not appear explicitly in the bit array representing a floating-point number The following is a convergent series (2)n-1 n 1. write a Mat Lab script file that reports to the command window the minimum number of terms in this series (including 1) needed to obtain its solution, accurate to within machine precision Em. Call this script file a2task3.m.Solution
inp1 = input(\'Enter the base for the CPU: \',\'s\');
b = str2double(inp1);
inp2 = input(\'Enter the total number of digits in the mantissa : \',\'s\');
m = str2double(inp2);
res = @(i) 1/2^(i-1);
eps = b^(1-m);
i=1;
t = res(1);
while (2-eps) > t
i = i+1;
t = t + res(i);
end
%disp(eps);
disp(i);
%disp(t);
