Closed jverzani closed 5 years ago
It already does do promotion, but I must have missed something?
It comes from dispatch, as
julia> isa((pi, 2pi), NTuple{2,<:Real}) # n = 2
false
Not sure you want to relax that. Please close this issue if not.
Ah, I see. I guess we could replace the current NTuple
method with something like:
hcubature_(f, a::Tuple, b::Tuple, norm, rtol, atol, maxevals, initdiv) =
hcubature_(f, SVector(a), SVector(b), norm, rtol, atol, maxevals, initdiv)
since it looks like the SVector(::Tuple)
constructor knows how to do promotion.
Very nice, thanks!
I was a bit surprised that this failed:
(Forcing
pi
to a float through1pi
works, or course.)Something similar happens with
hcubature(x -> 2.0, (0,0), (2, 2.0))
. Would there be any drawbacks to promoting the endpoints to a common type? I see this "T is a floating-point type determined by promoting the endpoint a and b coordinates to a floating-point type" in the README, which suggests that should happen, right?