Skip to content

Commit

Permalink
toml-test-decoder: always print floats as decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed May 23, 2024
1 parent a645c7b commit 5bcf186
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/tag/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tag
import (
"fmt"
"math"
"strconv"
"time"

"github.com/BurntSushi/toml/internal"
Expand Down Expand Up @@ -68,7 +69,7 @@ func Add(key string, tomlData any) any {
case math.IsInf(orig, -1):
return tag("float", "-inf")
default:
return tag("float", fmt.Sprintf("%v", orig))
return tag("float", strconv.FormatFloat(orig, 'f', -1, 64))
}
}
}
Expand Down

0 comments on commit 5bcf186

Please sign in to comment.