Feature/example test (#24)

example docs
This commit is contained in:
jeffery
2023-04-12 15:09:44 +08:00
committed by GitHub
parent ac72afe256
commit e9cc195c39
39 changed files with 662 additions and 28 deletions

View File

@@ -0,0 +1,43 @@
package floatUtil
import "fmt"
func ExampleFloat32ToStr() {
var f float32 = 3.1
res := Float32ToStr(f)
fmt.Println(res)
// Output:
// 3.1
}
func ExampleFloat32ToFloat64() {
var f float32 = 3.1
res := Float32ToFloat64(f)
fmt.Println(res)
// Output:
// 3.1
}
func ExampleFloat64ToStr() {
f := 3.14
res := Float64ToStr(f)
fmt.Println(res)
// Output:
// 3.14
}
func ExampleFloat64ToFloat32() {
f := 3.14
res := Float64ToFloat32(f)
fmt.Println(res)
// Output:
// 3.14
}