func (t systemDoubleType) DecodeValue(val string) (interface{}, error) {
	parsedVal, err := strconv.ParseFloat(val, 64)
	if err != nil {
		return nil, err
	}
	if parsedVal >= t.lowerbound && parsedVal <= t.upperbound {
		return parsedVal, nil
	}
	return nil, ErrSystemVariableCodeFail.New(val, t.String())
}
DecodeValue implements SystemVariableType interface.
package sql
import (
	"strconv"
	"github.com/dolthub/vitess/go/sqltypes"
	"github.com/dolthub/vitess/go/vt/proto/query"
)
type systemDoubleType struct {
	varName    string
	lowerbound float64
	upperbound float64
}
var _ SystemVariableType = systemDoubleType{}
func NewSystemDoubleType(varName string, lowerbound, upperbound float64) SystemVariableType {
	return systemDoubleType{varName, lowerbound, upperbound}
}
func (t systemDoubleType) Compare(a interface{}, b interface{}) (int, error) {
	as, err := t.Convert(a)
	if err != nil {
		return 0, err
	}
	bs, err := t.Convert(b)
	if err != nil {
		return 0, err
	}
	ai := as.(float64)
	bi := bs.(float64)
	if ai == bi {
		return 0, nil
	}
	if ai < bi {
		return -1, nil
	}
	return 1, nil
}
func (t systemDoubleType) Convert(v interface{}) (interface{}, error) {
	switch value := v.(type) {
	case int:
		return t.Convert(float64(value))
	case uint:
		return t.Convert(float64(value))
	case int8:
		return t.Convert(float64(value))
	case uint8:
		return t.Convert(float64(value))
	case int16:
		return t.Convert(float64(value))
	case uint16:
		return t.Convert(float64(value))
	case int32:
		return t.Convert(float64(value))
	case uint32:
		return t.Convert(float64(value))
	case int64:
		return t.Convert(float64(value))
	case uint64:
		return t.Convert(float64(value))
	case float32:
		return t.Convert(float64(value))
	case float64:
		if value >= t.lowerbound && value <= t.upperbound {
			return value, nil
		}
	}
	return nil, ErrInvalidSystemVariableValue.New(t.varName, v)
}
func (t systemDoubleType) MustConvert(v interface{}) interface{} {
	value, err := t.Convert(v)
	if err != nil {
		panic(err)
	}
	return value
}
func (t systemDoubleType) Promote() Type {
	return t
}
func (t systemDoubleType) SQL(v interface{}) (sqltypes.Value, error) {
	if v == nil {
		return sqltypes.NULL, nil
	}
	v, err := t.Convert(v)
	if err != nil {
		return sqltypes.Value{}, err
	}
	return sqltypes.MakeTrusted(t.Type(), strconv.AppendFloat(nil, v.(float64), 'f', -1, 64)), nil
}
func (t systemDoubleType) String() string {
	return "SYSTEM_DOUBLE"
}
func (t systemDoubleType) Type() query.Type {
	return sqltypes.Float64
}
func (t systemDoubleType) Zero() interface{} {
	return float64(0)
}
func (t systemDoubleType) EncodeValue(val interface{}) (string, error) {
	expectedVal, ok := val.(float64)
	if !ok {
		return "", ErrSystemVariableCodeFail.New(val, t.String())
	}
	return strconv.FormatFloat(expectedVal, 'f', -1, 64), nil
}