code: func StrToFloat(sc *stmtctx.StatementContext, str string) (float64, error) {
  	str = strings.TrimSpace(str)
  	validStr, err := getValidFloatPrefix(sc, str)
  	f, err1 := strconv.ParseFloat(validStr, 64)
  	if err1 != nil {
  		if err2, ok := err1.(*strconv.NumError); ok {
  			// value will truncate to MAX/MIN if out of range.
  			if err2.Err == strconv.ErrRange {
  				err1 = sc.HandleTruncate(ErrTruncatedWrongVal.GenWithStackByArgs("DOUBLE", str))
  				if math.IsInf(f, 1) {
  					f = math.MaxFloat64
  				} else if math.IsInf(f, -1) {
  					f = -math.MaxFloat64
  				}
  			}
  		}
  		return f, errors.Trace(err1)
  	}
  	return f, errors.Trace(err)
  }
docs: // StrToFloat converts a string to a float64 at the best-effort.