// ReadFloat reads a float value. Returns a decoded value and an error if it occurs.
327520
func (bd *BinaryDecoder) ReadFloat() (float32, error) {
	var float float32
	if err := checkEOF(bd.buf, bd.pos, 4); err != nil {
		return float, err
	}
	bits := binary.LittleEndian.Uint32(bd.buf[bd.pos : bd.pos+4])
	float = math.Float32frombits(bits)
	bd.pos += 4
	return float, nil
}
455814
func (c Config) GetFloat(key string) (float64, error) {
	var (
		fout float64
		val  interface{}
		ok   bool
	)

	if val, ok = c[key]; !ok {
		return fout, ErrConfigNotFound
	}

	if fout, ok = val.(float64); !ok {
		return fout, ErrNotAFloat
	}

	return fout, nil
}
323761
func asFloat(param string) (float64, error) {
	i, err := strconv.ParseFloat(param, 64)
	if err != nil {
		return 0.0, ErrBadParameter
	}
	return i, nil
}
1208111
func (i Int) Float() Float {
	// TODO(adonovan): opt: handle common values without allocation.
	f, _ := new(big.Float).SetInt(i.bigint).Float64()
	return Float(f)
}
8603
func (m Metadata) GetFloat(key string) (*float64, error) {
	val, ok := m[key]
	if !ok {
		return nil, ErrMetadataNonexistantKey
	}
	if val.Type != MetadataValueTypeFloat {
		return nil, ErrMetadataUnexpectedValueType
	}
	out, _ := val.Value.(float64)
	return &out, nil
}
572252
func toFloat64(v reflect.Value) float64 {
	f, _ := tryToFloat64(v)
	return f
}
441843
func ConvertToFloat64(v interface{}) (float64, error) {
	switch i := v.(type) {
	case float64:
		return float64(i), nil
	case float32:
		return float64(i), nil
	case int64:
		return float64(i), nil
	case int32:
		return float64(i), nil
	case int16:
		return float64(i), nil
	case int8:
		return float64(i), nil
	case uint64:
		return float64(i), nil
	case uint32:
		return float64(i), nil
	case uint16:
		return float64(i), nil
	case uint8:
		return float64(i), nil
	case int:
		return float64(i), nil
	case uint:
		return float64(i), nil
	case string:
		f, err := strconv.ParseFloat(i, 64)
		if err != nil {
			return math.NaN(), err
		}
		return f, err
	default:
		return math.NaN(), fmt.Errorf("Cannot convert %s to float64", i)
	}
}
522559
func toFloat64(v interface{}) float64 {
	if str, ok := v.(string); ok {
		iv, err := strconv.ParseFloat(str, 64)
		if err != nil {
			return 0
		}
		return iv
	}

	val := reflect.Indirect(reflect.ValueOf(v))
	switch val.Kind() {
	case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
		return float64(val.Int())
	case reflect.Uint8, reflect.Uint16, reflect.Uint32:
		return float64(val.Uint())
	case reflect.Uint, reflect.Uint64:
		return float64(val.Uint())
	case reflect.Float32, reflect.Float64:
		return val.Float()
	case reflect.Bool:
		if val.Bool() == true {
			return 1
		}
		return 0
	default:
		return 0
	}
}
1226797
func (t *TSMReader) ReadFloatBlockAt(entry *IndexEntry, vals *[]FloatValue) ([]FloatValue, error) {
	t.mu.RLock()
	v, err := t.accessor.readFloatBlock(entry, vals)
	t.mu.RUnlock()
	return v, err
}
972405
func ToFloat(v interface{}) float64 {
	switch n := v.(type) {
	case int:
		return float64(n)
	case int8:
		return float64(n)
	case int16:
		return float64(n)
	case int32:
		return float64(n)
	case int64:
		return float64(n)
	case uint:
		return float64(n)
	case uint8:
		return float64(n)
	case uint16:
		return float64(n)
	case uint32:
		return float64(n)
	case uint64:
		return float64(n)
	case float32:
		return float64(n)
	case float64:
		return n
	default:
		return math.NaN()
	}
}
170226
func (dec *Decoder) DecodeFloat64(v *float64) error {
	if dec.isPooled == 1 {
		panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder"))
	}
	return dec.decodeFloat64(v)
}
599300
func NewFloat(value string) (DataType, error) {
	returnValue := new(Float)
	v, err := strconv.ParseFloat(value, 64)
	returnValue.value = v
	return returnValue, err
}
522513
func MustFloat(input interface{}) float64 {
	output, err := Float(input)
	if err != nil {
		panic(err)
	}
	return output
}
1120486
func decodeFloat(rd *bufio.Reader) (string, Float, error) {
	// name
	name, err := readCstring(rd)
	if err != nil {
		return "", Float(0), err
	}

	// value
	b := make([]byte, 8)
	_, err = io.ReadFull(rd, b)
	if err != nil {
		return "", Float(0), err
	}
	var u uint64
	u += uint64(b[7]) << 56
	u += uint64(b[6]) << 48
	u += uint64(b[5]) << 40
	u += uint64(b[4]) << 32
	u += uint64(b[3]) << 24
	u += uint64(b[2]) << 16
	u += uint64(b[1]) << 8
	u += uint64(b[0])
	return name, Float(math.Float64frombits(u)), nil
}
360232
func (ec *Envcfg) GetFloat(key string, bitSize int) float64 {
	f, _ := strconv.ParseFloat(ec.GetKey(key), bitSize)
	return f
}
22765
func (v *Value) Float() float64 {
	switch v.getResolvedValue().Kind() {
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return float64(v.getResolvedValue().Int())
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		return float64(v.getResolvedValue().Uint())
	case reflect.Float32, reflect.Float64:
		return v.getResolvedValue().Float()
	case reflect.String:
		// Try to convert from string to float64 (base 10)
		f, err := strconv.ParseFloat(v.getResolvedValue().String(), 64)
		if err != nil {
			return 0.0
		}
		return f
	default:
		logf("Value.Float() not available for type: %s\n", v.getResolvedValue().Kind().String())
		return 0.0
	}
}
158376
func (t *TSMReader) ReadFloatArrayBlockAt(entry *IndexEntry, vals *tsdb.FloatArray) error {
	t.mu.RLock()
	err := t.accessor.readFloatArrayBlock(entry, vals)
	t.mu.RUnlock()
	return err
}