AppendFloat appends a float to the slice as either float64 or float32 when it represents the exact same value
(b []byte, f float64)
| 65 | // AppendFloat appends a float to the slice as either float64 |
| 66 | // or float32 when it represents the exact same value |
| 67 | func AppendFloat(b []byte, f float64) []byte { |
| 68 | f32 := float32(f) |
| 69 | if float64(f32) == f { |
| 70 | return AppendFloat32(b, f32) |
| 71 | } |
| 72 | return AppendFloat64(b, f) |
| 73 | } |
| 74 | |
| 75 | // AppendFloat64 appends a float64 to the slice |
| 76 | func AppendFloat64(b []byte, f float64) []byte { |
searching dependent graphs…