AppendFloat64 encodes and inserts a double precision float value into the dst byte array.
(dst []byte, val float64, unused int)
| 392 | |
| 393 | // AppendFloat64 encodes and inserts a double precision float value into the dst byte array. |
| 394 | func (Encoder) AppendFloat64(dst []byte, val float64, unused int) []byte { |
| 395 | switch { |
| 396 | case math.IsNaN(val): |
| 397 | return append(dst, "\xfb\x7f\xf8\x00\x00\x00\x00\x00\x00"...) |
| 398 | case math.IsInf(val, 1): |
| 399 | return append(dst, "\xfb\x7f\xf0\x00\x00\x00\x00\x00\x00"...) |
| 400 | case math.IsInf(val, -1): |
| 401 | return append(dst, "\xfb\xff\xf0\x00\x00\x00\x00\x00\x00"...) |
| 402 | } |
| 403 | major := majorTypeSimpleAndFloat |
| 404 | subType := additionalTypeFloat64 |
| 405 | n := math.Float64bits(val) |
| 406 | dst = append(dst, major|subType) |
| 407 | for i := uint(1); i <= 8; i++ { |
| 408 | b := byte(n >> ((8 - i) * 8)) |
| 409 | dst = append(dst, b) |
| 410 | } |
| 411 | return dst |
| 412 | } |
| 413 | |
| 414 | // AppendFloats64 encodes and inserts an array of double precision float values into the dst byte array. |
| 415 | func (e Encoder) AppendFloats64(dst []byte, vals []float64, unused int) []byte { |
no outgoing calls
no test coverage detected