[julia-users] Re: InexactError for Arrays

2015-12-03 Thread Stephan Buchert
Thanks, yes, but I had expected that in the second command it would give me an Int64 Array, similar as in the 1st command I get automatically an Int64 scalar. But to be fair, like this it is already much better than Matlab: >> int32(5370)*8640 ans = 2147483647 >> [int32(5370)]*8640

[julia-users] Re: InexactError for Arrays

2015-12-03 Thread Stephan Buchert
julia> Int32[5730]*Int32(86400) 1-element Array{Int32,1}: 495072000 should certainly give the in memory smaller Int32 Array (and InexactError if applicable). But an Int32 Array times an Int64 scalar could well give automatically an Int64 array, I think. Then julia> Int32[5730]*1 and similar

Re: [julia-users] Re: InexactError for Arrays

2015-12-03 Thread Mauro
> Thanks, yes, but I had expected that in the second command it would give me > an Int64 Array, This would mean that multiplying a Int32 array by a Int64 would double its size and be considerably slower. If the array is large, then that could be problematic. > similar as in the 1st command I get

Re: [julia-users] Re: InexactError for Arrays

2015-12-03 Thread Milan Bouchet-Valat
Le jeudi 03 décembre 2015 à 06:36 -0800, Stephan Buchert a écrit : > julia> Int32[5730]*Int32(86400) > 1-element Array{Int32,1}: > 495072000 > > should certainly give the in memory smaller Int32 Array (and > InexactError if applicable). But an Int32 Array times an Int64 scalar > could well give a

Re: [julia-users] Re: InexactError for Arrays

2015-12-03 Thread Stephan Buchert
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 de

Re: [julia-users] Re: InexactError for Arrays

2015-12-03 Thread Stefan Karpinski
I think we should move to having scalar+scalar, scalar+array and array+array promotions behave the same. We started out having scalar*scalar operations promote quite liberally. For example, Int8+Int8 promoted to Int rather than giving an Int8 result even though both arguments are of that type, base

Re: [julia-users] Re: InexactError for Arrays

2015-12-03 Thread Stefan Karpinski
Issue opened: https://github.com/JuliaLang/julia/issues/14252. On Thu, Dec 3, 2015 at 11:53 AM, Stefan Karpinski wrote: > I think we should move to having scalar+scalar, scalar+array and > array+array promotions behave the same. We started out having scalar*scalar > operations promote quite libe