MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / EncodeFloat32

Method EncodeFloat32

encode_number.go:145–152  ·  view source on GitHub ↗
(n float32)

Source from the content-addressed store, hash-verified

143}
144
145func (e *Encoder) EncodeFloat32(n float32) error {
146 if e.flags&useCompactFloatsFlag != 0 {
147 if float32(int64(n)) == n {
148 return e.EncodeInt(int64(n))
149 }
150 }
151 return e.write4(msgpcode.Float, math.Float32bits(n))
152}
153
154func (e *Encoder) EncodeFloat64(n float64) error {
155 if e.flags&useCompactFloatsFlag != 0 {

Callers 2

EncodeMethod · 0.95
encodeFloat32ValueFunction · 0.80

Calls 2

EncodeIntMethod · 0.95
write4Method · 0.95

Tested by

no test coverage detected