浏览代码

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))
+}