From 90d84471371eda27d660dbcb4ad48afe558b076f Mon Sep 17 00:00:00 2001 From: Alberto Mercurio Date: Tue, 23 Sep 2025 01:52:02 +0200 Subject: [PATCH] Avoid divide the first element for type check in normalize --- src/generic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generic.jl b/src/generic.jl index c92776e3..7d6219fc 100644 --- a/src/generic.jl +++ b/src/generic.jl @@ -2109,7 +2109,7 @@ NaN function normalize(a::AbstractArray, p::Real = 2) nrm = norm(a, p) if !isempty(a) - aa = copymutable_oftype(a, typeof(first(a)/nrm)) + aa = copymutable_oftype(a, float(Base.promote_eltype(a, nrm))) return __normalize!(aa, nrm) else T = typeof(zero(eltype(a))/nrm)