I have a really odd issue happening with variables. I'm 100% sure that is something lacking in my knowledge and not some sort of bug, but I simply cannot figure this out.
I apologize in advance for not providing a simple code example, but the problem I'm describing happens within a fairly large program and is not something I have a simple short example of, although I will try to reproduce it later in some short form.
Near the start of my program I DIM a few variables. This includes these:
DIM Resolution as Single
DIM Shared LowerValue as Single
I ask the user for a value via an input statement and this gets assigned to to "Resolution". Assume the number input is "32".
I then run this line:
LowerValue = Resolution
If I place a test line after the above statement to print the value of "LowerValue" I see that it is indeed "32".
Now, note that NOWHERE else in the program do I ever change the value of "LowerValue". However, if I inspect the value of "LowerValue" later in my code by simply printing the value, it for some reason has changed value to "16". It's possible that it may change to other things, but in my test run where I input an initial value of 32, it gets changed to 32.
Again, nowhere after the initial assignment is this value ever changed!
After hours, on a hunch, I simply changed my DIM statement to this:
DIM Shared LowerValue as Double
Note that I simply changed the "Single" to "Double".
Problem solved. But why?
I know that without some specific sample code it may be very difficult to provide a root cause, but are there any guesses as to what on earth could account for such odd behavior?