// SetFloat will set the value for name as a float64
16211
func (section *Section) SetFloat(name string, value float64) {
	current, err := section.Get(name)

	// Exists just update the value/type
	if err == nil {
		current.UpdateValue(value)
	} else {
		section.values[name] = NewFloat(value)
	}
}
420349
func (context *BaseContext) GetFloat(
	key string, defaultValue ...float64) float64 {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(float64); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return 0
}
859791
func (ia *Floats64Value) Set(s string) error {
	i, err := strconv.ParseFloat(s, 64)
	if err != nil {
		return err
	}
	*ia = append(*ia, i)
	return nil
}
323761
func asFloat(param string) (float64, error) {
	i, err := strconv.ParseFloat(param, 64)
	if err != nil {
		return 0.0, ErrBadParameter
	}
	return i, nil
}
1232271
func (f *FlagSet) Float64(name string, value float64, usage string) *float64 {
	p := new(float64)
	f.Float64Var(p, name, value, usage)
	return p
}
790146
func (r *Rational) ToFloat64() float64 {
	return float64(r.num) / float64(r.den)
}
556561
func ToFloat(value interface{}) float64 {
	if result := ToString(value); result == "" {
		return 0
	} else if i, err := strconv.ParseFloat(result, 64); err == nil {
		return i
	} else {
		panic("failed to parse float: " + result)
	}
}
1173657
func (s *Session) GetFloat(key string, def float64) float64 {
	v, ok := s.Values[key]
	if !ok {
		return def
	}

	return v.(float64)
}
1213513
func (s *SampledHTTPRequest) SetWeight(v int64) *SampledHTTPRequest {
	s.Weight = &v
	return s
}
464198
func (ctx *context) PostValueFloat64Default(name string, def float64) float64 {
	if v, err := ctx.PostValueFloat64(name); err == nil {
		return v
	}

	return def
}
1008489
func (cmd *CLI) DefineFloat64FlagVar(p *float64, name string, value float64, usage string) {
	cmd.DefineFlag(values.NewFloat64(value, p), name, usage)
}
890230
func NewFloat64Flag(fl cli.Float64Flag) *Float64Flag {
	return &Float64Flag{Float64Flag: fl, set: nil}
}
143211
func (v Value) Float64() (float64, error) {
	f, err := strconv.ParseFloat(v.String(), 64)
	if err != nil {
		return 0.0, v.invalidTypeError(err, "float64")
	}
	return f, nil
}
1144672
func (fs *FlagSet) Float64(names []string, value float64, usage string) *float64 {
	p := new(float64)
	fs.Float64Var(p, names, value, usage)
	return p
}
849055
func Float(v float64) *float64 {
	ptr := new(float64)
	*ptr = v
	return ptr
}
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
	}
}
127892
func encodeFloat(buf *bytes.Buffer, name string, val Float) error {
	// type
	if err := buf.WriteByte(_FLOATING_POINT); err != nil {
		return err
	}

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	u := math.Float64bits(float64(val))
	b := make([]byte, 8)
	b[7] = byte(u >> 56)
	b[6] = byte(u >> 48)
	b[5] = byte(u >> 40)
	b[4] = byte(u >> 32)
	b[3] = byte(u >> 24)
	b[2] = byte(u >> 16)
	b[1] = byte(u >> 8)
	b[0] = byte(u)
	if _, err := buf.Write(b); err != nil {
		return err
	}

	return nil
}