// Float32Field adds a single float32 field to the event.
170256
func Float32Field(name string, value float32) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeFloat, outTypeDefault, 0)
		ed.writeUint32(math.Float32bits(value))
	}
}
530008
func (e *Event) Floats32(key string, f []float32) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendFloats32(enc.AppendKey(e.buf, key), f)
	return e
}
716927
func (b *PCMBuffer) AsFloat32Buffer() *Float32Buffer {
	newB := &Float32Buffer{}
	newB.Data = b.AsF32()
	if b.Format != nil {
		newB.Format = &Format{
			NumChannels: b.Format.NumChannels,
			SampleRate:  b.Format.SampleRate,
		}
	}
	return newB
}
153429
func (r *Encoder) EncodeFloat32(f float32) error {
	_, err := r.w.Write([]byte{CHR_FLOAT32})
	if err != nil {
		return err
	}
	return binary.Write(r.w, binary.BigEndian, f)
}
519517
func Float64Field(name string, value float64) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeDouble, outTypeDefault, 0)
		ed.writeUint64(math.Float64bits(value))
	}
}
980282
func WriteFloat32(space []byte, val float32) []byte {
	abs := math.Abs(float64(val))
	fmt := byte('f')
	// Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
	if abs != 0 {
		if float32(abs) < 1e-6 || float32(abs) >= 1e21 {
			fmt = 'e'
		}
	}
	return append(space, strconv.FormatFloat(float64(val), fmt, -1, 32)...)
}
353031
func (v *Value) Float64() (float64, error) {
	n, err := v.Number()

	if err != nil {
		return 0, err
	}

	return n.Float64()
}
399657
func (s *Session) GetFloat32Default(key string, defaultValue float32) float32 {
	if v, err := s.GetFloat32(key); err == nil {
		return v
	}

	return defaultValue
}
983496
func (enc *Encoder) Float32OmitEmpty(v float32) {
	if v == 0 {
		return
	}
	enc.grow(10)
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32)
}
1133161
func (f *Flash) GetFloat32(key string) float32 {
	r, _ := f.Get(key).(float32)
	return r
}
1321066
func ConvertFloat32(str string) (float32, error) {
	f, err := strconv.ParseFloat(str, 32)
	if err != nil {
		return 0, err
	}
	return float32(f), nil
}
1307176
func (ctx *Context) CookieFloat32(key string, defaults ...float32) float32 {
	return ctx.Cookies().MustFloat32(key, defaults...)
}
1009302
func (entry *Entry) FloatField(name string) (value float64, err error) {
	tmp, err := entry.Field(name)
	if err == nil {
		value, err = strconv.ParseFloat(tmp, 64)
	}
	return
}
1337321
func (e Encoder) AppendFloats32(dst []byte, vals []float32) []byte {
	major := majorTypeArray
	l := len(vals)
	if l == 0 {
		return e.AppendArrayEnd(e.AppendArrayStart(dst))
	}
	if l <= additionalMax {
		lb := byte(l)
		dst = append(dst, byte(major|lb))
	} else {
		dst = appendCborTypePrefix(dst, major, uint64(l))
	}
	for _, v := range vals {
		dst = e.AppendFloat32(dst, v)
	}
	return dst
}
570663
func (r *MockResult) Float32(i int) float32 {
	if r.Contains(i) {
		return r.Result[i].(float32)
	} else {
		return 0
	}
}
190457
func finiteFloatToInt(f Float) Int {
	var i big.Int
	if math.MinInt64 <= f && f <= math.MaxInt64 {
		// small values
		i.SetInt64(int64(f))
	} else {
		rat := f.rational()
		if rat == nil {
			panic(f) // non-finite
		}
		i.Div(rat.Num(), rat.Denom())
	}
	return Int{&i}
}
245797
func (enc *Encoder) Float32(v float32) {
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32)
}