Fix float64 truncation error (#293)

Don't truncate float64 representation on marashaling.

Fixes https://github.com/pelletier/go-toml/issues/289
This commit is contained in:
Chris
2019-08-26 22:57:02 -05:00
committed by Thomas Pelletier
parent 781fbae71e
commit 3ded2e09ee
4 changed files with 20 additions and 7 deletions
+4 -2
View File
@@ -135,7 +135,8 @@ type testMapDoc struct {
type testDocBasics struct {
Uint uint `toml:"uint"`
Bool bool `toml:"bool"`
Float float32 `toml:"float"`
Float32 float32 `toml:"float"`
Float64 float64 `toml:"float64"`
Int int `toml:"int"`
String *string `toml:"string"`
Date time.Time `toml:"date"`
@@ -174,7 +175,8 @@ var docData = testDoc{
Basics: testDocBasics{
Bool: true,
Date: time.Date(1979, 5, 27, 7, 32, 0, 0, time.UTC),
Float: 123.4,
Float32: 123.4,
Float64: 123.456782132399,
Int: 5000,
Uint: 5001,
String: &biteMe,