Warmup Homework
or
 Know Your Computer


The answers to the questions below will depend on what computer you are using, as well as what  programming language and compiler you use. Modify the syntax to work with whatever programming language you want (not Matlab).

1.   What is the largest number you can add to 1 and have the answer still be 1.?

To answer this question, imagine a loop that looks something like:

   float num = 1.;  
   while (1.0  + num > 1.0) {
         num = num/2;
   }
   print num;

2.   What is the result in your computer of the operation (this includes the possibility that your program crashes before printing):
 numer = 1.;
denom = 0.;
result = numer/denom;
print result;
       

3.   What does your computer do if you compute the square root of -1?

4.    If your program doesn't crash on #3,  what is the result of the logical test

num = sqrt(-1);
if (num == num) then
   print ("did not crash");
else
   print(" no crash and not equal");