How to `promote_type` of more than 2 values?

For example, I have 4 numbers 1, 2, 3, 4.0, and I want to get their promoted type. What should I do? I currently have two ways of writing

julia> promote_type(map(typeof, promote(1, 2, 3, 4.0))...)
Float64

or

julia> eltype(promote(1, 2, 3, 4.0))
Float64

Isn’t there a built-in way of doing this?

Base.promote_typeof(1, 2.0, 1//2)

1 Like

Thanks. Not sure why this is not exported. I mean, this is quite useful, isn’t it?

Not mainstream enough maybe :man_shrugging: