21
0

修复用默认格式导致的浮点数格式化为整数

This commit is contained in:
chen.s.g 2018-05-14 11:52:38 +08:00
parent 1c64c63ab6
commit 299fe38c66

View File

@ -139,6 +139,10 @@ func (f *Format) String(v float64) string {
switch f.vType { switch f.vType {
case TYPE_NUMERIC: case TYPE_NUMERIC:
if 0 == f.bts && nil != f.Raw && "general" == f.Raw[0] {
f.bts = -1
}
ret = strconv.FormatFloat(v, 'f', f.bts, 64) ret = strconv.FormatFloat(v, 'f', f.bts, 64)
case TYPE_CURRENCY: case TYPE_CURRENCY:
ret = strconv.FormatFloat(v, 'f', f.bts, 64) ret = strconv.FormatFloat(v, 'f', f.bts, 64)