code: func calculateDecimal4RoundAndTruncate(ctx sessionctx.Context, args []Expression, retType types.EvalType) int {
  	if retType == types.ETInt || len(args) <= 1 {
  		return 0
  	}
  	secondConst, secondIsConst := args[1].(*Constant)
  	if !secondIsConst {
  		return args[0].GetType().Decimal
  	}
  	argDec, isNull, err := secondConst.EvalInt(ctx, chunk.Row{})
  	if err != nil || isNull || argDec < 0 {
  		return 0
  	}
  	if argDec > mysql.MaxDecimalScale {
  		return mysql.MaxDecimalScale
  	}
  	return int(argDec)
  }
docs: // calculateDecimal4RoundAndTruncate calculates tp.decimals of round/truncate func.