Today I was doing my university programming classes exercises and came up to this weird thing. I would like to know if anyone could explain to me what's going on here.
This is the thing I coded to show it:
program problema;
var
a : real;
b : real;
begin
a := 1 - 0.8 - 0.2;
b := 1 - 0.2 - 0.8;
write(a);
writeln(b);
end.
While I expected it to return 0 in both cases, it actually returns -1.3... on the first one and 0 on the second one. How can that be possible?