|
@@ -1264,8 +1264,10 @@ func getDecimalLen(str string, isPercent bool) (decimalPlaces int) {
|
|
|
|
|
|
func roundNumber(num string, decimalPlaces int, hasPercent bool) string {
|
|
|
numFloat, _ := strconv.ParseFloat(num, 64)
|
|
|
+ if hasPercent {
|
|
|
+ numFloat = numFloat * 100
|
|
|
+ }
|
|
|
numFloat, _ = decimal.NewFromFloat(numFloat).Round(int32(decimalPlaces)).Float64()
|
|
|
-
|
|
|
numStr := strconv.FormatFloat(numFloat, 'f', decimalPlaces, 64)
|
|
|
if hasPercent {
|
|
|
numStr += "%"
|