Last active
January 17, 2017 08:04
-
-
Save joowkim/274643c1bbebb5bf73c37bc1510ea84a to your computer and use it in GitHub Desktop.
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 Round(v float64, decimals int) float64 { | |
var pow float64 = 1 | |
for i:=0; i<decimals; i++ { | |
pow *= 10 | |
} | |
return float64(int((v * pow) + 0.5)) / pow | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment