1
0

int.go 436 B

1234567891011121314151617181920212223
  1. package pkg
  2. import (
  3. "math"
  4. "strconv"
  5. )
  6. func IntToString(e int) string {
  7. return strconv.Itoa(e)
  8. }
  9. func UIntToString(e uint) string {
  10. return strconv.Itoa(int(e))
  11. }
  12. func Int64ToString(e int64) string {
  13. return strconv.FormatInt(e, 10)
  14. }
  15. func Round(f float64, n int) float64 {
  16. pow10_n := math.Pow10(n)
  17. return math.Trunc((f+0.5/pow10_n)*pow10_n) / pow10_n // TODO +0.5 是为了四舍五入,如果不希望这样去掉这个
  18. }