<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="a = Array(Array{Float64,1},2)
a[1] = [1.;2.;3.]
a[2] = [3.;4.;5.]
broadcast(*,[2.;3.],a)"><pre class="notranslate"><code class="notranslate">a = Array(Array{Float64,1},2)
a[1] = [1.;2.;3.]
a[2] = [3.;4.;5.]
broadcast(*,[2.;3.],a)
</code></pre></div>
<p dir="auto">gives</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2-element Array{Any,1}:
 [2.0,4.0,6.0]
 [9.0,12.0,15.0]"><pre class="notranslate"><code class="notranslate">2-element Array{Any,1}:
 [2.0,4.0,6.0]
 [9.0,12.0,15.0]
</code></pre></div>
<p dir="auto">I would have expected an <code class="notranslate">Array{Array{Float64,1},1}</code>.</p>
<p dir="auto">The following code fails with an <code class="notranslate">InexactError()</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="X = [1,2,3]
Y = [4 5]
broadcast(atan2, X, Y)"><pre class="notranslate"><code class="notranslate">X = [1,2,3]
Y = [4 5]
broadcast(atan2, X, Y)
</code></pre></div>
<p dir="auto">whereas</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[atan2(x,y) for x in X, y in Y ]"><pre class="notranslate"><code class="notranslate">[atan2(x,y) for x in X, y in Y ]
</code></pre></div>
<p dir="auto">(albeit producing an array of type <code class="notranslate">Any</code>), while</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="atan2([1,2,3],[4,5,6])"><pre class="notranslate"><code class="notranslate">atan2([1,2,3],[4,5,6])
</code></pre></div>
<p dir="auto">produces an array of <code class="notranslate">Float64</code>.</p>
<p dir="auto">Can we improve the type inference so that all three cases can generate <code class="notranslate">Float64</code> arrays?  Note that this is needed for <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="20043830" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/4363" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/4363/hovercard" href="https://github.com/JuliaLang/julia/issues/4363">#4363</a> (for <code class="notranslate">@vectorize_2arg</code> to use <code class="notranslate">broadcast</code>).</p>