Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default Double variable value in excel

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Lookup/Double Lookup Ryan[_2_] Excel Worksheet Functions 8 May 14th 07 09:44 PM
double axis, double problem (i hope only to me) kitcho Charts and Charting in Excel 1 December 30th 06 12:52 AM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
How to (re)set a range.value to pass -0- to a "double" variable Dennis Excel Discussion (Misc queries) 2 April 15th 05 11:13 AM


All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"