Skip to content

Instantly share code, notes, and snippets.

@me2beats
Created December 30, 2020 00:09
Show Gist options
  • Save me2beats/d0e93d8953623bf7c10894c4522b8586 to your computer and use it in GitHub Desktop.
Save me2beats/d0e93d8953623bf7c10894c4522b8586 to your computer and use it in GitHub Desktop.
gdscript banker's rounding (this is how python does rounding - kinda)
func bankers_round_py(num:float)->float:
var rounded = round(num)
if abs(num-rounded) == 0.5:
rounded = 2.0*round(num/2.0)
return rounded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment