diff --git a/g/util/gconv/gconv.go b/g/util/gconv/gconv.go index f8923b214..1b3f6903d 100644 --- a/g/util/gconv/gconv.go +++ b/g/util/gconv/gconv.go @@ -106,7 +106,7 @@ func String(i interface{}) string { case uint16: return strconv.FormatUint(uint64(value), 10) case uint32: return strconv.FormatUint(uint64(value), 10) case uint64: return strconv.FormatUint(uint64(value), 10) - case float32: return strconv.FormatFloat(float64(value), 'f', -1, 64) + case float32: return strconv.FormatFloat(float64(value), 'f', -1, 32) case float64: return strconv.FormatFloat(value, 'f', -1, 64) case bool: return strconv.FormatBool(value) case string: return value @@ -289,7 +289,7 @@ func Float32 (i interface{}) float32 { if v, ok := i.(float32); ok { return v } - v, _ := strconv.ParseFloat(String(i), 32) + v, _ := strconv.ParseFloat(String(i), 64) return float32(v) } diff --git a/geg/net/ghttp/server/performance/client.go b/geg/net/ghttp/server/performance/client.go index e83c1a63a..4955f222a 100644 --- a/geg/net/ghttp/server/performance/client.go +++ b/geg/net/ghttp/server/performance/client.go @@ -9,7 +9,7 @@ import ( ) func main() { - clientMax := 10 + clientMax := 1000 requestMax := 1000 failureNum := gtype.NewInt64() successNum := gtype.NewInt64() @@ -21,7 +21,7 @@ func main() { go func(clientId int) { url := "http://127.0.0.1:8199/" for i := 0; i < requestMax; i++ { - url = fmt.Sprintf("http://127.0.0.1:8199/%d_%d", clientId, i) + //url = fmt.Sprintf("http://127.0.0.1:8199/%d_%d", clientId, i) if c, e := ghttp.Get(url); e == nil { c.Close() successNum.Add(1) diff --git a/geg/other/test.go b/geg/other/test.go index cd8681879..7b38824b0 100644 --- a/geg/other/test.go +++ b/geg/other/test.go @@ -1,11 +1,12 @@ package main import ( - "time" "fmt" + "gitee.com/johng/gf/g/util/gconv" ) func main() { - t := time.Now().Zone() - fmt.Println(z) + fmt.Println(gconv.Float64(float32(19.66))) + fmt.Println(float64(float32(19.66))) + } \ No newline at end of file