<p dir="auto">Current (as of this writing) master:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; sin(1)
0.8414709848078965

julia&gt; sin.([1])
ERROR: InexactError()
 in macro expansion at ./broadcast.jl:97 [inlined]
 in macro expansion at ./simdloop.jl:73 [inlined]
 in macro expansion at ./broadcast.jl:91 [inlined]
 in _broadcast!(::Base.#sin, ::Array{Int64,1}, ::Tuple{Tuple{Bool}}, ::Tuple{Array{Int64,1}}, ::Type{Val{1}}) at ./broadcast.jl:86
 in broadcast! at ./broadcast.jl:139 [inlined]
 in broadcast(::Function, ::Array{Int64,1}) at ./broadcast.jl:143
 in eval(::Module, ::Any) at ./boot.jl:231
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">sin</span>(<span class="pl-c1">1</span>)
<span class="pl-c1">0.8414709848078965</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">sin</span>.([<span class="pl-c1">1</span>])
ERROR<span class="pl-k">:</span> <span class="pl-c1">InexactError</span>()
 <span class="pl-k">in</span> <span class="pl-k">macro</span> expansion at <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">97</span> [inlined]
 <span class="pl-k">in</span> <span class="pl-k">macro</span> expansion at <span class="pl-k">./</span>simdloop<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">73</span> [inlined]
 <span class="pl-k">in</span> <span class="pl-k">macro</span> expansion at <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">91</span> [inlined]
 <span class="pl-k">in</span> <span class="pl-c1">_broadcast!</span>(<span class="pl-k">::</span><span class="pl-c1">Base.</span><span class="pl-c"><span class="pl-c">#</span>sin, ::Array{Int64,1}, ::Tuple{Tuple{Bool}}, ::Tuple{Array{Int64,1}}, ::Type{Val{1}}) at ./broadcast.jl:86</span>
 <span class="pl-k">in</span> broadcast! at <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">139</span> [inlined]
 <span class="pl-k">in</span> <span class="pl-c1">broadcast</span>(<span class="pl-k">::</span><span class="pl-c1">Function</span>, <span class="pl-k">::</span><span class="pl-c1">Array{Int64,1}</span>) at <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">143</span>
 <span class="pl-k">in</span> <span class="pl-c1">eval</span>(<span class="pl-k">::</span><span class="pl-c1">Module</span>, <span class="pl-k">::</span><span class="pl-c1">Any</span>) at <span class="pl-k">./</span>boot<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">231</span>
 <span class="pl-k">in</span> <span class="pl-k">macro</span> expansion at <span class="pl-k">./</span>REPL<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">92</span> [inlined]
 <span class="pl-k">in</span> (<span class="pl-k">::</span><span class="pl-c1">Base.REPL.</span><span class="pl-c"><span class="pl-c">#</span>#1#2{Base.REPL.REPLBackend})() at ./event.jl:46</span></pre></div>
<p dir="auto">I would have expected this to work as <code class="notranslate">map</code> does:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; map(sin, [1])
1-element Array{Float64,1}:
 0.841471"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">map</span>(sin, [<span class="pl-c1">1</span>])
<span class="pl-c1">1</span><span class="pl-k">-</span>element Array{Float64,<span class="pl-c1">1</span>}<span class="pl-k">:</span>
 <span class="pl-c1">0.841471</span></pre></div>
<p dir="auto">Any idea why this is happening?</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>