Rounding float numbers

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DimitriyPS
:warning: Old Version Published before Godot 3 was released.

I need to get an int by rounding to float.

Wrong: 8.83=8
Correct: 8.83=9

Which method to use?

:bust_in_silhouette: Reply From: fredspipa

Check out round(float).

int(round(8.83))

gives you the integer 9.

Edit: someone pointed out to me that round() returns a float that happens to have no decimal numbers. Updated code snippet.