To be fair, Matlab has a whole lot of other “surprises” to make up for this. Arguments to copy what Matlab does do not always achieve the desired effect on this forum, but YMMV.
FWIW, I find the whole “surprise” line of reasoning specious: people have heterogeneous expectations, and someone is always going to be surprised about something. This is not a solid basis for API design.
I would argue for consistency instead. In Julia,
Base, the standard libraries, and most packages rarely convert
Float64 to just to avoid overflow, leaving this choice to the user instead.
The basic problem here is calling
mean on integers, which is a very peculiar use case when you think about it. If you are working with eg measurement data that has large values, they are very rarely integers in practice.