1 Star 1 Fork 0

vincent/gcutil

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
enhanceMathUtils.go 676 Bytes
Copy Edit Raw Blame History
vincent authored 2021-12-20 15:29 . feat():同步更新 1220
//math 的增强功能
package mathUtil
//int 类型取绝对值
func Abs(x int) int {
if x < 0 {
return -x
}
return x
}
//int 类型取绝对值
func AbsInt16(x int16) int16 {
if x < 0 {
return -x
}
return x
}
// 判断当前数字是否在范围中,前包后不包
// eg between(1,1,3) true
// eg between(3,1,3) false
func Between(x int, start int, end int) bool {
if x >= start && x < end {
return true
}
return false
}
// 判断当前数字是否在范围中,前包后不包
// eg between(1,1,3) true
// eg between(3,1,3) false
func BetweenInt16(x int16, start int16, end int16) bool {
if x >= start && x < end {
return true
}
return false
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/vincent78/gcutil.git
git@gitee.com:vincent78/gcutil.git
vincent78
gcutil
gcutil
v1.0.1

Search