code: func TruncateFloat(f float64, flen int, decimal int) (float64, error) {
  	if math.IsNaN(f) {
  		// nan returns 0
  		return 0, ErrOverflow.GenWithStackByArgs("DOUBLE", "")
  	}
  
  	maxF := GetMaxFloat(flen, decimal)
  
  	if !math.IsInf(f, 0) {
  		f = Round(f, decimal)
  	}
  
  	var err error
  	if f > maxF {
  		f = maxF
  		err = ErrOverflow.GenWithStackByArgs("DOUBLE", "")
  	} else if f < -maxF {
  		f = -maxF
  		err = ErrOverflow.GenWithStackByArgs("DOUBLE", "")
  	}
  
  	return f, errors.Trace(err)
  }
docs: // TruncateFloat tries to truncate f.
  // If the result exceeds the max/min float that flen/decimal allowed, returns the max/min float allowed.