Skip to content

Instantly share code, notes, and snippets.

@yukirin
Last active February 6, 2016 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukirin/9a81bf567eda4c5bd159 to your computer and use it in GitHub Desktop.
Save yukirin/9a81bf567eda4c5bd159 to your computer and use it in GitHub Desktop.
Goであると思ってたけど、なかった関数、定数 round
import "math"
func round(f float64, place int) float64 {
shift := math.Pow10(place)
return math.Floor(f*shift+.5) / shift
}
func round1(f float64) float64 {
return math.Floor(f + .5)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment