other: 删除 net 包中的不合理函数

This commit is contained in:
kercylan98 2023-07-01 16:49:45 +08:00
parent 68cb5f2516
commit f22bf5bc93
1 changed files with 0 additions and 17 deletions

View File

@ -1,17 +0,0 @@
package network
import (
"fmt"
"github.com/kercylan98/minotaur/utils/generic"
"github.com/kercylan98/minotaur/utils/maths"
"strings"
)
// FloatEnlarge 用于将浮点型放大后进行网络传输,返回放大后的值和放大的倍率
// - 存在精度丢失问题如1.13
func FloatEnlarge[F generic.Float](f F) (value int64, multi int64) {
str := fmt.Sprint(f)
multi = maths.PowInt64(10, int64(len(str[strings.Index(str, ".")+1:])))
value = int64(f * F(multi))
return
}