// clamp rounds and clamps float64 value to fit into uint8.
187712
func clamp(x float64) uint8 {
	v := int64(x + 0.5)
	if v > 255 {
		return 255
	}
	if v > 0 {
		return uint8(v)
	}
	return 0
}
383807
func (c *ConfigFile) Float64(section, key string) (float64, error) {
	value, err := c.GetValue(section, key)
	if err != nil {
		return 0.0, err
	}
	return strconv.ParseFloat(value, 64)
}
226128
func Float64Var(p *float64, name string, value float64, usage string) {
	CommandLine.Var(newFloat64Value(value, p), name, usage)
}
6079
func Float(min, max float64) (float64, error) {
	return min + Rnd.Float64()*(max-min), nil
}
1281092
func Round(f float64, dec int) float64 {
	shift := math.Pow10(dec)
	tmp := f * shift
	if math.IsInf(tmp, 0) {
		return f
	}
	return RoundFloat(tmp) / shift
}
746002
func round(x float64) int64 {
	if _, frac := math.Modf(x); frac >= 0.5 {
		return int64(math.Ceil(x))
	}
	return int64(math.Floor(x))
}
1350671
func round(number float64, precision int) float64 {
	return math.Round(number*10*float64(precision)) / (10.0 * float64(precision))
}
119627
func (u *Ugen) Round(val Input) Input {
	return binOpRound(u.Rate, u, val, u.NumOutputs)
}
355088
func (f *Forms) Float64(key string) (float64, error) {
	return strconv.ParseFloat((*http.Request)(f).FormValue(key), 64)
}
548020
func Round(n float64) uint64 {
	if n < 0 {
		return uint64(math.Ceil(n - 0.5))
	}
	return uint64(math.Floor(n + 0.5))
}
34615
func (g *Graph) Float64(def ...float64) float64 {
	n, ok := _float64f(g.String())
	if !ok {
		if len(def) == 0 {
			return math.NaN()
		}
		return def[0]
	}
	return n
}
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
	}
}
265241
func (fs *FlagSet) Uint64(names []string, value uint64, usage string) *uint64 {
	p := new(uint64)
	fs.Uint64Var(p, names, value, usage)
	return p
}
421116
func Clamp(value, min, max float64) float64 {
	if value > max {
		return max
	}
	if value < min {
		return min
	}
	return value
}
456790
func (r *Reply) Float64() (float64, error) {
	if r.Type == ErrorReply {
		return 0, r.Err
	}
	if r.Type == BulkReply {
		s, err := r.Str()
		if err != nil {
			return 0, err
		}
		f64, err := strconv.ParseFloat(s, 64)
		if err != nil {
			return 0, errors.New("failed to parse float value from string value")
		} else {
			return f64, nil
		}
	}

	return 0, errors.New("float value is not available for this reply type")
}
2334
func (c C) SoftClip() Input {
	if float32(c) < -0.5 {
		return C(-0.5)
	} else if float32(c) > 0.5 {
		return C(0.5)
	}
	return c
}
848294
func (ns *Namespace) Round(x interface{}) (float64, error) {
	xf, err := cast.ToFloat64E(x)
	if err != nil {
		return 0, errors.New("Round operator can't be used with non-float value")
	}

	return _round(xf), nil
}