Re: Can someone please explain - real numbers



On Tue, 07 Nov 2006 21:10:16 +0000, Paul W <noemail@xxxxxxxxx> wrote:


Can someone please explain in simple terms (!) why:-

var
a:real;

begin
a:=2.21;
if a=2.21 then showmessage('You do not see this');
end;

Why?


Thanks for all the replies.

Clearly I know nothing about how a computer stores "real" numbers.
Even after all this time!

It just amazes me that telling a computer to store a value of 2.21
(effectively 2.210000000 recurring) it decides to store a value like
2.211189899324 (or whatever). I thought the whole point of computers
is they were accurate for this sort of thing.

So I can use extended (is that spot on then?), but then what on earth
is the point of "real" numbers if they're not accurate?

My apologies in advance for my ignorance!
.



Relevant Pages