Skip to content

Commit e09d3f8

Browse files
committed
Issue yuin#468 : change LNumber.String() from fmt.Sprint to strconv.Format(Int/Float)
1 parent 2348fd0 commit e09d3f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

value.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7+
"strconv"
78
)
89

910
type LValueType int
@@ -113,9 +114,9 @@ func (st LString) Format(f fmt.State, c rune) {
113114

114115
func (nm LNumber) String() string {
115116
if isInteger(nm) {
116-
return fmt.Sprint(int64(nm))
117+
return strconv.FormatInt(int64(nm), 10)
117118
}
118-
return fmt.Sprint(float64(nm))
119+
return strconv.FormatFloat(float64(nm), 'g', -1, 64)
119120
}
120121

121122
func (nm LNumber) Type() LValueType { return LTNumber }

0 commit comments

Comments
 (0)