21
0

修复四舍五入问题

This commit is contained in:
chen.s.g 2018-04-18 23:33:50 +08:00
parent 574bf55ec4
commit 1c64c63ab6

View File

@ -139,17 +139,9 @@ func (f *Format) String(v float64) string {
switch f.vType { switch f.vType {
case TYPE_NUMERIC: case TYPE_NUMERIC:
if 0 == f.bts {
ret = strconv.FormatInt(int64(v), 10)
} else {
ret = strconv.FormatFloat(v, 'f', f.bts, 64) ret = strconv.FormatFloat(v, 'f', f.bts, 64)
}
case TYPE_CURRENCY: case TYPE_CURRENCY:
if 0 == f.bts {
ret = strconv.FormatInt(int64(v), 10)
} else {
ret = strconv.FormatFloat(v, 'f', f.bts, 64) ret = strconv.FormatFloat(v, 'f', f.bts, 64)
}
case TYPE_PERCENTAGE: case TYPE_PERCENTAGE:
if 0 == f.bts { if 0 == f.bts {
ret = strconv.FormatInt(int64(v)*100, 10) + "%" ret = strconv.FormatInt(int64(v)*100, 10) + "%"