소스 검색

feat:float取整

wangshan 3 년 전
부모
커밋
de521c9b01
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      common/common.go

+ 10 - 0
common/common.go

@@ -700,3 +700,13 @@ func StructToMapMore(obj interface{}) map[string]interface{} {
 	_ = json.Unmarshal(j, &m)
 	return m
 }
+
+// 向上取整
+func MathCeil(x float64) int {
+	return int(math.Ceil(x + 0/5))
+}
+
+// 向下取整
+func MathFloor(x float64) int {
+	return int(math.Floor(x + 0/5))
+}