Browse Source

添加Round方法

pull/2/head
zhangxin 4 years ago
parent
commit
f81b89070e
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      utils/utils.go

+ 7
- 0
utils/utils.go View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/lianggx6/goutf16"
"io"
"math"
"math/rand"
"net/http"
"os"
@ -386,4 +387,10 @@ func FileExist(file string) bool {
}
return true
}
func Round(num float64) int {
num += 0.5
num = math.Floor(num)
return int(num)
}

Loading…
Cancel
Save