// NewFloats64 creates a new multi-int value
975623
func NewFloats64(into *[]float64, v []float64) *Floats64Value {
	*into = v
	return (*Floats64Value)(into)
}
1076473
func Float64() float64 {
	mu.Lock()
	res := r.Float64()
	mu.Unlock()
	return res
}
790146
func (r *Rational) ToFloat64() float64 {
	return float64(r.num) / float64(r.den)
}
602796
func (z *Big) SetFloat64(x float64) *Big {
	if x == 0 {
		var sign form
		if math.Signbit(x) {
			sign = signbit
		}
		return z.setZero(sign, 0)
	}
	if math.IsNaN(x) {
		var sign form
		if math.Signbit(x) {
			sign = signbit
		}
		return z.setNaN(0, qnan|sign, 0)
	}
	if math.IsInf(x, 0) {
		if math.IsInf(x, 1) {
			z.form = pinf
		} else {
			z.form = ninf
		}
		return z
	}

	// The gist of the following is lifted from math/big/rat.go, but adapted for
	// base-10 decimals.

	const expMask = 1<<11 - 1
	bits := math.Float64bits(x)
	mantissa := bits & (1<<52 - 1)
	exp := int((bits >> 52) & expMask)
	if exp == 0 { // denormal
		exp -= 1022
	} else { // normal
		mantissa |= 1 << 52
		exp -= 1023
	}

	if mantissa == 0 {
		return z.SetUint64(0)
	}

	shift := 52 - exp
	for mantissa&1 == 0 && shift > 0 {
		mantissa >>= 1
		shift--
	}

	z.exp = 0
	z.form = finite | form(bits>>63)

	if shift > 0 {
		z.unscaled.SetUint64(uint64(shift))
		z.unscaled.Exp(c.FiveInt, &z.unscaled, nil)
		arith.Mul(&z.unscaled, &z.unscaled, mantissa)
		z.exp = -shift
	} else {
		// TODO(eric): figure out why this doesn't work for _some_ numbers. See
		// https://github.com/ericlagergren/decimal/issues/89
		//
		// z.compact = mantissa << uint(-shift)
		// z.precision = arith.Length(z.compact)

		z.compact = c.Inflated
		z.unscaled.SetUint64(mantissa)
		z.unscaled.Lsh(&z.unscaled, uint(-shift))
	}
	return z.norm()
}
859550
func (d *MyDecimal) ToFloat64() (float64, error) {
	f, err := strconv.ParseFloat(d.String(), 64)
	if err != nil {
		err = ErrOverflow
	}
	return f, err
}
620531
func Float64s(input []float64) []float64 {
	u := make([]float64, 0, len(input))
	m := make(map[float64]bool)

	for _, val := range input {
		if _, ok := m[val]; !ok {
			m[val] = true
			u = append(u, val)
		}
	}

	return u
}
1373404
func NewFloatEncoder() *FloatEncoder {
	s := FloatEncoder{
		first:   true,
		leading: ^uint64(0),
	}

	s.bw = bitstream.NewWriter(&s.buf)
	s.buf.WriteByte(floatCompressedGorilla << 4)

	return &s
}
743337
func ToFloat64(v interface{}) float64 {
	if str, ok := v.(string); ok {
		return strToFloat64(str)
	}

	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() {
			return 1
		}
		return 0
	default:
		return 0
	}
}
1295207
func GetFloat64(key string, defaultValue float64) float64 {
	result, err := factory.GetValue(key).ToFloat64()
	if err != nil {
		return defaultValue
	}
	return result
}
300462
func (r *Reader) ReadFloat64() float64 {
	tag := r.readByte()
	decoder := float64Decoders[tag]
	if decoder == nil {
		castError(tag, "float64")
	}
	return decoder(r)
}
327827
func (enc *Encoder) SliceFloat64(s []float64) {
	enc.Array(EncodeArrayFunc(func(enc *Encoder) {
		for _, i := range s {
			enc.Float64(i)
		}
	}))
}
1037654
func (p *Partial) Float64() (f float64, err error) {
	err = p.Unmarshal(&f)
	return
}
1019898
func NewFloatResult(val float64, err error) *FloatCmd {
	var cmd FloatCmd
	cmd.val = val
	cmd.setErr(err)
	return &cmd
}
719465
func NewFloatValue(value float64) *Float {
	returnValue := new(Float)
	returnValue.value = value
	return returnValue
}
377321
func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool, error) {
	val, found, err := NestedFieldNoCopy(obj, fields...)
	if !found || err != nil {
		return 0, found, err
	}
	f, ok := val.(float64)
	if !ok {
		return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected float64", jsonPath(fields), val, val)
	}
	return f, true, nil
}
343440
func (c *Chunk) AppendFloat64(colIdx int, f float64) {
	c.columns[colIdx].appendFloat64(f)
}
981706
func ToFloat64(val interface{}) (float64, error) {
	switch v := val.(type) {
	case int:
		return float64(v), nil
	case int8:
		return float64(v), nil
	case int16:
		return float64(v), nil
	case int32:
		return float64(v), nil
	case int64:
		return float64(v), nil
	case float32:
		return float64(v), nil
	case float64:
		return v, nil
	case string:
		return strconv.ParseFloat(v, 64)
	case json.Number:
		return v.Float64()
	default:
		return 0, fmt.Errorf("Unhandled type: %t", v)
	}
}