Hello, sorry for strange subject but I am not sure how to say that.
I try to debug some value, but I have strange behaviour which I don’t understand.
When I use std::cout << someValue << std::endl; in some way someValue lost it’s value. Is it normal behaviour? Please find my screen shots:
It‘s very close to 22050 that‘s probably due to the good but limited precision of floating point numbers. Floating points might not be able to represent 22050.0 so the closest possible value was chosen: 22049.999999 which is basically 22050 the step to the next higher value (22050.something) is bigger then the step down to 22049.9999 so the error is smaller with that one
I think that‘s just a peculiarity of your debugger, the value is not really lost, just the display is strange. You will still be able to access it in your code (hopefully ). But maybe someone else has a better explanation for it
I think Xcode sometimes does this if it doesn’t have direct access to the value. This could be because the variable is in a register than a memory address…
If you pause the debugger and type p fff, does it printed the the console? (There’s a good chance this will fail as well if it can’t be shown in the variables list though).