Skip to content

Commit 376efdb

Browse files
authored
make @SVector and @SMatrix calls default to Float64 to match Base (#1165)
* make `@SVector` and `@SMatrix` calls default to `Float64` to match Base This makes calls to `zeros`, `ones`, `rand`, and friend default to `Float64` similar to Base. This can be a source of type instability when used in the single argument version, and it is not transparent as to why. Making `Float64` the default eliminates this source of error for the user. Closes: #1164 * bump to v1.5.26
1 parent d9d54bd commit 376efdb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "StaticArrays"
22
uuid = "90137ffa-7385-5640-81b9-e52037218182"
3-
version = "1.5.25"
3+
version = "1.5.26"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/SMatrix.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function static_matrix_gen(::Type{SM}, @nospecialize(ex), mod::Module) where {SM
7171
f = ex.args[1]
7272
if f === :zeros || f === :ones || f === :rand || f === :randn || f === :randexp
7373
if length(ex.args) == 3
74-
return :($f($SM{$(escall(ex.args[2:3])...)}))
74+
return :($f($SM{$(escall(ex.args[2:3])...), Float64})) # default to Float64 like Base
7575
elseif length(ex.args) == 4
7676
return :($f($SM{$(escall(ex.args[[3,4,2]])...)}))
7777
else

src/SVector.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function static_vector_gen(::Type{SV}, @nospecialize(ex), mod::Module) where {SV
7676
f = ex.args[1]
7777
if f === :zeros || f === :ones || f === :rand || f === :randn || f === :randexp
7878
if length(ex.args) == 2
79-
return :($f($SV{$(esc(ex.args[2]))}))
79+
return :($f($SV{$(esc(ex.args[2])), Float64})) # default to Float64 like Base
8080
elseif length(ex.args) == 3
8181
return :($f($SV{$(escall(ex.args[3:-1:2])...)}))
8282
else

0 commit comments

Comments
 (0)