Skip to content

Commit 380080c

Browse files
Fix type instability in quadratures
1 parent 4788064 commit 380080c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Quadratures/Quadratures.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ struct Uniform{Nq} <: QuadratureStyle end
8989
@inline degrees_of_freedom(::Uniform{Nq}) where {Nq} = Int(Nq)
9090

9191
@generated function quadrature_points(::Type{FT}, ::Uniform{Nq}) where {FT, Nq}
92-
points = SVector{Nq}(range(-1 + 1 / Nq, step = 2 / Nq, length = Nq))
93-
weights = SVector{Nq}(ntuple(i -> 2 / Nq, Nq))
92+
points = SVector{Nq}(range(-1 + FT(1 / Nq), step = FT(2 / Nq), length = Nq))
93+
weights = SVector{Nq}(ntuple(i -> FT(2 / Nq), Nq))
9494
:($points, $weights)
9595
end
9696

@@ -110,9 +110,9 @@ struct ClosedUniform{Nq} <: QuadratureStyle end
110110
) where {FT, Nq}
111111
points = SVector{Nq}(range(FT(-1), FT(1), length = Nq))
112112
weights = SVector{Nq}(
113-
1 / (Nq - 1),
114-
ntuple(i -> 2 / (Nq - 1), Nq - 2)...,
115-
1 / (Nq - 1),
113+
FT(1 / (Nq - 1)),
114+
ntuple(i -> FT(2 / (Nq - 1)), Nq - 2)...,
115+
FT(1 / (Nq - 1)),
116116
)
117117
:($points, $weights)
118118
end

0 commit comments

Comments
 (0)