(val float64, bitSize int)
| 469 | } |
| 470 | |
| 471 | func (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 |
no test coverage detected