MCPcopy
hub / github.com/tinylib/msgp / AppendFloat

Function AppendFloat

msgp/write_bytes.go:67–73  ·  view source on GitHub ↗

AppendFloat appends a float to the slice as either float64 or float32 when it represents the exact same value

(b []byte, f float64)

Source from the content-addressed store, hash-verified

65// AppendFloat appends a float to the slice as either float64
66// or float32 when it represents the exact same value
67func 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
76func AppendFloat64(b []byte, f float64) []byte {

Callers 6

MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
AppendJSONNumberFunction · 0.85
TestAppendFloatFunction · 0.85
BenchmarkAppendFloatFunction · 0.85

Calls 2

AppendFloat32Function · 0.85
AppendFloat64Function · 0.85

Tested by 3

TestAppendFloatFunction · 0.68
BenchmarkAppendFloatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…