Skip to content

Commit 90d8447

Browse files
Avoid divide the first element for type check in normalize
1 parent 57ac0eb commit 90d8447

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/generic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ NaN
21092109
function normalize(a::AbstractArray, p::Real = 2)
21102110
nrm = norm(a, p)
21112111
if !isempty(a)
2112-
aa = copymutable_oftype(a, typeof(first(a)/nrm))
2112+
aa = copymutable_oftype(a, float(Base.promote_eltype(a, nrm)))
21132113
return __normalize!(aa, nrm)
21142114
else
21152115
T = typeof(zero(eltype(a))/nrm)

0 commit comments

Comments
 (0)