优化代码/删除不需要的代码

This commit is contained in:
刘祥超
2022-10-14 10:03:29 +08:00
parent 5d4da6cccb
commit b0b6b5984f
42 changed files with 554 additions and 1256 deletions

View File

@@ -4,6 +4,7 @@ package numberutils_test
import (
"github.com/TeaOSLab/EdgeAPI/internal/utils/numberutils"
"math"
"testing"
)
@@ -18,3 +19,16 @@ func TestMin(t *testing.T) {
t.Log(numberutils.Min[int32](1, 2, 3))
t.Log(numberutils.Min[float32](1.2, 2.3, 3.4))
}
func TestMaxFloat32(t *testing.T) {
t.Logf("%f", math.MaxFloat32/(1<<100))
}
func TestFloorFloat32(t *testing.T) {
t.Logf("%f", numberutils.FloorFloat32(123.456, -1))
t.Logf("%f", numberutils.FloorFloat32(123.456, 0))
t.Logf("%f, %f", numberutils.FloorFloat32(123.456, 1), 123.456*10)
t.Logf("%f, %f", numberutils.FloorFloat32(123.456, 2), 123.456*10*10)
t.Logf("%f, %f", numberutils.FloorFloat32(123.456, 3), 123.456*10*10*10)
t.Logf("%f, %f", numberutils.FloorFloat32(123.456, 4), 123.456*10*10*10*10)
}