%% machinenumber1 % help for machinenumber1 % copyright 1998, D. Estep % % PURPOSE % % this script computes the machine number using a while loop % % FUNCTION STATEMENT % % machinenumber1 % % REQUIRED VARIABLES % % no input variables % % USAGE % % >>machinenumber1 % Author: Don Estep % Date: 11/24/98 x=2; % this is the increment we add to 1, we start with 2 and % decrease from there. We put a ";" on the statement so % that it would not print when the script is executed while (1 + x > 1) % a while loop: has the form % while expression % commands % end % it repeatedly does the commands inbetween the while and % the end as long as the expression after the while is true x = x/2; % make the increment smaller, end the line with a ";" to % keep it from printing during each loop! % if you don't do something to change the condition after % the while, the loop will run forever! end x %print the value of x x*2 % print 2*x. The machine number is between x and 2x. % the output of this file gives: % >>machinenumber1 % x = % 1.110223024625156e-016 % ans = % 2.220446049250313e-016