View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph[_2_] David Biddulph[_2_] is offline
external usenet poster
 
Posts: 8,651
Default Double variable value in excel

See your later question.
--
David Biddulph

"Jeff" wrote in message
...
Hi,

I had a question about how the double variable is used in excel.

When I program in C++ and I assign x = 2; where x is a double the actual
value is
1.999999999 or 2.000000011 but in excel it is exactly the number you
assign
it.

I only ask because I was copying code from excel to C++ and part of the
code
involved the expression

if (x = 3) then ...

But in C++ you could not use it because x was not always exactly equal to
3
and I ended up using "if (x2.99 and x<3.001)"

WHy is there a difference?

Thanks