Created
December 30, 2020 00:09
-
-
Save me2beats/d0e93d8953623bf7c10894c4522b8586 to your computer and use it in GitHub Desktop.
gdscript banker's rounding (this is how python does rounding - kinda)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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