Aims:
Calculate the value of 0.3 minus 0.2 minus 0.1. What is the result?
Use the comparison operator (==) to compare the result to 0. Note
that you need to put brackets around the whole expression. Does
the comparison give true
(1) or false
(0).
Write a comparison that checks if the result is reasonably close to zero (the difference should be smaller than one millionth).
"\\Clear";
Your code starts after this line
0.3-0.2-0.1;
(0.3-0.2-0.1==0);
(abs((0.3-0.2-0.1)-0)<0.000001);
> -2.7756E-17 > 0 > 1
Your code ends before this line
The code below is for automatically checking the result. Please ignore it!
res = split(getInfo("log"));
if (res.length<3) {
showMessage("Your result is wrong! Please check your macro and try again!");
return;
}
if (res[0]<0 && !res[1] && res[2])
showMessage("That's right. Great, you did it!");
else
showMessage("Your result is wrong! Please check your macro and try again!");