Skip to content

Commit 791a901

Browse files
authored
Fix norm of unitful zero vector (#1128)
* Fix norm of unitful zero vector * bump version
1 parent d6e0fde commit 791a901

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
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.14"
3+
version = "1.5.15"
44

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

src/linalg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ end
247247
$(Expr(:meta, :inline))
248248
scale = maxabs_nested(a)
249249

250-
scale==0 && return _init_zero(a)
250+
iszero(scale) && return _init_zero(a)
251251
return @inbounds scale * sqrt($expr)
252252
end
253253
end

test/unitful.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ using Unitful
33
@testset "Unitful" begin
44
# issue #1124
55
@test norm(SVector(1.0*u"m")) == 1.0*u"m"
6+
# issue $1127
7+
@test norm(SVector(0.0, 0.0)*u"nm") == 0.0*u"nm"
68
end

0 commit comments

Comments
 (0)