func (it *FloatDecoder) Error() error {
	return it.err
}
Error returns the current decoding error.
package tsm1
import (
	"bytes"
	"fmt"
	"math"
	"github.com/dgryski/go-bitstream"
	"github.com/influxdata/influxdb/pkg/bits"
)
const floatCompressedGorilla = 1
const uvnan = 0x7FF8000000000001
type FloatEncoder struct {
	val float64
	err error
	leading  uint64
	trailing uint64
	buf bytes.Buffer
	bw  *bitstream.BitWriter
	first    bool
	finished bool
}
func NewFloatEncoder() *FloatEncoder {
	s := FloatEncoder{
		first:   true,
		leading: ^uint64(0),
	}
	s.bw = bitstream.NewWriter(&s.buf)
	s.buf.WriteByte(floatCompressedGorilla << 4)
	return &s
}
func (s *FloatEncoder) Reset() {
	s.val = 0
	s.err = nil
	s.leading = ^uint64(0)
	s.trailing = 0
	s.buf.Reset()
	s.buf.WriteByte(floatCompressedGorilla << 4)
	s.bw.Resume(0x0, 8)
	s.finished = false
	s.first = true
}
func (s *FloatEncoder) Bytes() ([]byte, error) {
	return s.buf.Bytes(), s.err
}
func (s *FloatEncoder) Flush() {
	if !s.finished {
		s.finished = true
		s.Write(math.NaN())
		s.bw.Flush(bitstream.Zero)
	}
}
func (s *FloatEncoder) Write(v float64) {
	if math.IsNaN(v) && !s.finished {
		s.err = fmt.Errorf("unsupported value: NaN")
		return
	}
	if s.first {
		s.val = v
		s.first = false
		s.bw.WriteBits(math.Float64bits(v), 64)
		return
	}
	vDelta := math.Float64bits(v) ^ math.Float64bits(s.val)
	if vDelta == 0 {
		s.bw.WriteBit(bitstream.Zero)
	} else {
		s.bw.WriteBit(bitstream.One)
		leading := uint64(bits.LeadingZeros64(vDelta))
		trailing := uint64(bits.TrailingZeros64(vDelta))
		leading &= 0x1F
		if leading >= 32 {
			leading = 31
		}
		if s.leading != ^uint64(0) && leading >= s.leading && trailing >= s.trailing {
			s.bw.WriteBit(bitstream.Zero)
			s.bw.WriteBits(vDelta>>s.trailing, 64-int(s.leading)-int(s.trailing))
		} else {
			s.leading, s.trailing = leading, trailing
			s.bw.WriteBit(bitstream.One)
			s.bw.WriteBits(leading, 5)
			sigbits := 64 - leading - trailing
			s.bw.WriteBits(sigbits, 6)
			s.bw.WriteBits(vDelta>>trailing, int(sigbits))
		}
	}
	s.val = v
}
type FloatDecoder struct {
	val uint64
	leading  uint64
	trailing uint64
	br BitReader
	b  []byte
	first    bool
	finished bool
	err error
}
func (it *FloatDecoder) SetBytes(b []byte) error {
	var v uint64
	if len(b) == 0 {
		v = uvnan
	} else {
		it.br.Reset(b[1:])
		var err error
		v, err = it.br.ReadBits(64)
		if err != nil {
			return err
		}
	}
	it.val = v
	it.leading = 0
	it.trailing = 0
	it.b = b
	it.first = true
	it.finished = false
	it.err = nil
	return nil
}
func (it *FloatDecoder) Next() bool {
	if it.err != nil || it.finished {
		return false
	}
	if it.first {
		it.first = false
		if it.val == uvnan {  
			it.finished = true
			return false
		}
		return true
	}
	var bit bool
	if it.br.CanReadBitFast() {
		bit = it.br.ReadBitFast()
	} else if v, err := it.br.ReadBit(); err != nil {
		it.err = err
		return false
	} else {
		bit = v
	}
	if !bit {
	} else {
		var bit bool
		if it.br.CanReadBitFast() {
			bit = it.br.ReadBitFast()
		} else if v, err := it.br.ReadBit(); err != nil {
			it.err = err
			return false
		} else {
			bit = v
		}
		if !bit {
		} else {
			bits, err := it.br.ReadBits(5)
			if err != nil {
				it.err = err
				return false
			}
			it.leading = bits
			bits, err = it.br.ReadBits(6)
			if err != nil {
				it.err = err
				return false
			}
			mbits := bits
			if mbits == 0 {
				mbits = 64
			}
			it.trailing = 64 - it.leading - mbits
		}
		mbits := uint(64 - it.leading - it.trailing)
		bits, err := it.br.ReadBits(mbits)
		if err != nil {
			it.err = err
			return false
		}
		vbits := it.val
		vbits ^= (bits << it.trailing)
		if vbits == uvnan {  
			it.finished = true
			return false
		}
		it.val = vbits
	}
	return true
}
func (it *FloatDecoder) Values() float64 {
	return math.Float64frombits(it.val)
}