Le jeudi 7 janvier 2016 16:15:56 UTC+1, Kristoffer Carlsson a écrit :
>
> Not sure why it promotes to Any but anyway, you most likely want to use x 
> = Float64[1.0, 2.0] or another concrete Real type unless you plan to mix 
> the type of the items in the array.
>

> The type Real is an abstract type and anyone is free to define a new type 
> that is a subtype of Real. The compiler can therefore to no assumptions at 
> all about what items will be in the array so if you care about performance 
> you should use a concrete type.
>
 
Yes that was the idea, more precisely the user is likely to give either Int 
or Float64 in this Array. So I guess I need to use only Array{Float64} and 
convert any possible Int given by the user to a Float64.

Reply via email to