Add float values to int variables

Greetings everybody,
I saw in the “Delta Time” lesson of the “C++ Fundamentals…” course that, at a certain point, the value from
dT (DeltaTIme, a float variable) is added to an integer variable (velocity).
Does the result get rounded to an int value? How dows it work?
Thank you,
Alex

Hi Alex,

The result won’t get rounded, instead what will happen is that the values to the right of the decimal will get cut off. This is what we’d call a floor operation in math.

For example, where 0.5 would be rounded to 1 we instead would get 0. This would even be true if the value were 0.99999999999999…

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms