MCPcopy
hub / github.com/uber-go/zap / appendFloat

Method appendFloat

zapcore/json_encoder.go:471–483  ·  view source on GitHub ↗
(val float64, bitSize int)

Source from the content-addressed store, hash-verified

469}
470
471func (enc *jsonEncoder) appendFloat(val float64, bitSize int) {
472 enc.addElementSeparator()
473 switch {
474 case math.IsNaN(val):
475 enc.buf.AppendString(`"NaN"`)
476 case math.IsInf(val, 1):
477 enc.buf.AppendString(`"+Inf"`)
478 case math.IsInf(val, -1):
479 enc.buf.AppendString(`"-Inf"`)
480 default:
481 enc.buf.AppendFloat(val, bitSize)
482 }
483}
484
485// safeAddString JSON-escapes a string and appends it to the internal buffer.
486// Unlike the standard library's encoder, it doesn't attempt to protect the

Callers 2

AppendFloat64Method · 0.95
AppendFloat32Method · 0.95

Calls 3

addElementSeparatorMethod · 0.95
AppendFloatMethod · 0.80
AppendStringMethod · 0.65

Tested by

no test coverage detected