Yes, certainly one can argue here back and forth:

julia> Int32[5730]*86400e3
1-element Array{Float64,1}:
 4.95072e11

julia> Int32[5730]*86400f3
1-element Array{Float32,1}:
 4.95072e11

i.e. promotion also here the same as for scalar*scalar. My data are from 
hardware sensors or counters, which deliver 8, 16 or 32 bit, memory 
consumption in the computer is normally not an issue. 

What's wrong with these solutions? 
> julia> Array{Int64}(Int32[5730]) 
> 1-element Array{Int64,1}: 
>  5730 
>
> julia> convert(Array{Int64}, Int32[5730]) 
> 1-element Array{Int64,1}: 
>  5730 
>
> julia> map(Int64, Int32[5730]) 
> 1-element Array{Int64,1}: 
>  5730


Good comprehensive set of solutions, thanks. Still, 

julia> Int32[5730]*1

would be shorter and nevertheless easily readable, according to my taste.

Regards,
Stephan

Reply via email to