WriteFloat writes a float to the writer as either float64 or float32 when it represents the exact same value
(f float64)
| 353 | // WriteFloat writes a float to the writer as either float64 |
| 354 | // or float32 when it represents the exact same value |
| 355 | func (mw *Writer) WriteFloat(f float64) error { |
| 356 | f32 := float32(f) |
| 357 | if float64(f32) == f { |
| 358 | return mw.prefix32(mfloat32, math.Float32bits(f32)) |
| 359 | } |
| 360 | return mw.prefix64(mfloat64, math.Float64bits(f)) |
| 361 | } |
| 362 | |
| 363 | // WriteFloat64 writes a float64 to the writer |
| 364 | func (mw *Writer) WriteFloat64(f float64) error { |