Exact arithmetic, MATLAB Programming

Run the MATLAB script
sum = single(0); term = single(1);
n=1;
while sum + term > sum
sum = sum+term;
n=n+1;
term = 1/n;
end
n

Explain what you think it is trying to do. What would this code do in exact arithmetic?Describe why the code produces a nite result and (harder) describe the output. What would happen (don't try it!) if you replaced the fi rst line with sum=0; term=1;?

Posted Date: 3/22/2013 7:03:16 AM | Location : United States







Related Discussions:- Exact arithmetic, Assignment Help, Ask Question on Exact arithmetic, Get Answer, Expert's Help, Exact arithmetic Discussions

Write discussion on Exact arithmetic
Your posts are moderated
Related Questions
Simulation of a transmission system with a 4-fsk modulation scheme; using non-coherent detection method and an awgn channel. System description: 1. Input: A. Random binary


Obtain the input - Algorithms: From where does the input come? The two possible choices would be from an external file on a disk, or from the user, who enters the number by ty


Write a Matlab function that computes y1= tan(x) and y2= sin(x)/cos(x), returns the difference |y1–y2| and prints a message whether the two are equal or not. Test your function for

How to simulate a robot

what are data collect this topic,how i can create algorithm in mat lab what language support easy to this topic

Show the output - algorithms: Where does the output go? The two possibilities are (i) to an external file, or (ii) to a window on the screen. Based on system, one of these wil

can we use regression in bioinformatics toolbox?

http://messenger.providesupport.com/messenger/ae.html?ps_s=U4nFMQo4BP04