From e09d3f87cfd2d920491f8ef6ffbe0708f67620da Mon Sep 17 00:00:00 2001 From: MrParano1d Date: Thu, 21 Dec 2023 10:19:45 +0100 Subject: [PATCH] Issue #468 : change LNumber.String() from fmt.Sprint to strconv.Format(Int/Float) --- value.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/value.go b/value.go index 4156e9d5..590cba9a 100644 --- a/value.go +++ b/value.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "strconv" ) type LValueType int @@ -113,9 +114,9 @@ func (st LString) Format(f fmt.State, c rune) { func (nm LNumber) String() string { if isInteger(nm) { - return fmt.Sprint(int64(nm)) + return strconv.FormatInt(int64(nm), 10) } - return fmt.Sprint(float64(nm)) + return strconv.FormatFloat(float64(nm), 'g', -1, 64) } func (nm LNumber) Type() LValueType { return LTNumber }