// MustWriteFloat32 panics if WriteFloat32 fails
557929
func (w *ByteWriter) MustWriteFloat32(val float32, offset int) int {
	return w.MustWriteVal(val, offset)
}
253949
func (rwops *RWops) WriteBE32(value uint32) uint {
	if rwops == nil {
		return 0
	}
	return uint(C.SDL_WriteBE32(rwops.cptr(), C.Uint32(value)))
}
79097
func writeFloat(w enhancedWriter, f float64) (int, error) {
	switch {
	case f == 1:
		return 1, w.WriteByte('1')
	case f == 0:
		return 1, w.WriteByte('0')
	case f == -1:
		return w.WriteString("-1")
	case math.IsNaN(f):
		return w.WriteString("NaN")
	case math.IsInf(f, +1):
		return w.WriteString("+Inf")
	case math.IsInf(f, -1):
		return w.WriteString("-Inf")
	default:
		bp := numBufPool.Get().(*[]byte)
		*bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
		written, err := w.Write(*bp)
		numBufPool.Put(bp)
		return written, err
	}
}
572252
func toFloat64(v reflect.Value) float64 {
	f, _ := tryToFloat64(v)
	return f
}
1071787
func (tl *TestLauncher) WriteOrFail(tb testing.TB, to *platform.OnboardingResults, data string) {
	tb.Helper()
	resp, err := nethttp.DefaultClient.Do(tl.NewHTTPRequestOrFail(tb, "POST", fmt.Sprintf("/api/v2/write?org=%s&bucket=%s", to.Org.ID, to.Bucket.ID), to.Auth.Token, data))
	if err != nil {
		tb.Fatal(err)
	}

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		tb.Fatal(err)
	}

	if err := resp.Body.Close(); err != nil {
		tb.Fatal(err)
	}

	if resp.StatusCode != nethttp.StatusNoContent {
		tb.Fatalf("unexpected status code: %d, body: %s, headers: %v", resp.StatusCode, body, resp.Header)
	}
}
1096598
func (c *cookies) MustFloat64(key string, defaults ...float64) float64 {
	ck, err := c.req.Cookie(key)
	if err != nil {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return 0
	}
	v, err := strconv.ParseFloat(ck.Value, 32)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return v
}
923548
func (c *Chunk) AppendFloat32(colIdx int, f float32) {
	c.columns[colIdx].appendFloat32(f)
}
1056529
func (stream *Stream) WriteFloat64Lossy(val float64) {
	if val < 0 {
		stream.writeByte('-')
		val = -val
	}
	if val > 0x4ffffff {
		stream.WriteFloat64(val)
		return
	}
	precision := 6
	exp := uint64(1000000) // 6
	lval := uint64(val*float64(exp) + 0.5)
	stream.WriteUint64(lval / exp)
	fval := lval % exp
	if fval == 0 {
		return
	}
	stream.writeByte('.')
	for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
		stream.writeByte('0')
	}
	stream.WriteUint64(fval)
	for stream.buf[len(stream.buf)-1] == '0' {
		stream.buf = stream.buf[:len(stream.buf)-1]
	}
}
86016
func (w *ByteWriter) MustWriteUint32(val uint32, offset int) int {
	return w.MustWriteVal(val, offset)
}
1268122
func WriteFloat64Lossy(space []byte, val float64) []byte {
	if val < 0 {
		space = append(space, '-')
		val = -val
	}
	if val > 0x4ffffff {
		return WriteFloat64(space, val)
	}
	precision := 6
	exp := uint64(1000000) // 6
	lval := uint64(val*float64(exp) + 0.5)
	space = WriteUint64(space, lval / exp)
	fval := lval % exp
	if fval == 0 {
		return space
	}
	space = append(space, '.')
	for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
		space = append(space, '0')
	}
	space = WriteUint64(space, fval)
	for space[len(space)-1] == '0' {
		space = space[:len(space) - 1]
	}
	return space
}
1005842
func (Encoder) AppendFloat32(dst []byte, val float32) []byte {
	return appendFloat(dst, float64(val), 32)
}
200706
func (w *Writer) WriteInt32(sample int32) error {
	err := binary.Write(w.sampleBuf, binary.LittleEndian, sample)
	if err != nil {
		return err
	}

	w.bytesWritten += 4

	return err
}
1019255
func WriteFloat32Lossy(space []byte, val float32) []byte {
	if val < 0 {
		space = append(space, '-')
		val = -val
	}
	if val > 0x4ffffff {
		return WriteFloat32(space, val)
	}
	precision := 6
	exp := uint64(1000000) // 6
	lval := uint64(float64(val)*float64(exp) + 0.5)
	space = WriteUint64(space, lval / exp)
	fval := lval % exp
	if fval == 0 {
		return space
	}
	space = append(space, '.')
	for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
		space = append(space, '0')
	}
	space = WriteUint64(space, fval)
	for space[len(space)-1] == '0' {
		space = space[:len(space) - 1]
	}
	return space
}
34646
func (f *Forms) MustFloat64(key string, defaults ...float64) float64 {
	v, err := strconv.ParseFloat((*http.Request)(f).FormValue(key), 64)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return v
}
1286940
func (p *Params) MustFloat32(key string, defaults ...float32) float32 {
	r, err := strconv.ParseFloat(p.Get(key), 32)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return float32(r)
}
879939
func (w *ByteWriter) WriteFloat32(val float32, offset int) (int, error) {
	return w.WriteVal(val, offset)
}
511138
func (enc *Encoder) WriteFloat32(n float32) error {
	bits := math.Float32bits(n)
	enc.err = enc.buf.WriteByte(byte(bits >> 24))
	if enc.err == nil {
		enc.err = enc.buf.WriteByte(byte(bits >> 16))
		if enc.err == nil {
			enc.err = enc.buf.WriteByte(byte(bits >> 8))
			if enc.err == nil {
				enc.err = enc.buf.WriteByte(byte(bits))
			}
		}
	}
	return enc.err
}