🚸 release: v0.2.1

This commit is contained in:
naiba
2021-01-16 14:11:51 +08:00
parent 303dc73e16
commit d792fc8499
10 changed files with 127 additions and 72 deletions

View File

@@ -42,6 +42,9 @@ func ServeWeb(port uint) {
"ts": func(s string) string {
return strings.TrimSpace(s)
},
"float32f": func(f float32) string {
return fmt.Sprintf("%.2f", f)
},
"divU64": func(a, b uint64) float32 {
if b == 0 {
if a > 0 {
@@ -49,6 +52,10 @@ func ServeWeb(port uint) {
}
return 0
}
if a == 0 {
// 这是从未在线的情况
return 1 / float32(b) * 100
}
return float32(a) / float32(b) * 100
},
"div": func(a, b int) float32 {
@@ -58,6 +65,10 @@ func ServeWeb(port uint) {
}
return 0
}
if a == 0 {
// 这是从未在线的情况
return 1 / float32(b) * 100
}
return float32(a) / float32(b) * 100
},
"addU64": func(a, b uint64) uint64 {