Move average function from EnumX to MathX