A core feature of Visual Studio that allows developers to inspect, analyze, and troubleshoot code during execution.
Hi @McLellan, Steve ,
Thank you for your question.
Your code and calculation are correct. The reason you see 0.0 when stepping over the line is related to how the debugger displays floating-point values.
When 1.0f / 3.0f is calculated, the result may still be held in a processor register and has not yet been written to the variable's memory. At that moment, the debugger can temporarily show 0.0. Once execution moves to the next line, the value is stored correctly and you will see 0.3333333.
This is expected debugger behavior and does not indicate a problem with your code.
You can refer to these following steps:
- Make sure you are running in Debug mode, not Release mode.
- Press F10 once more to move to the next line. The variable value should then update correctly.
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback. Thank you.