Quaternions.jl icon indicating copy to clipboard operation
Quaternions.jl copied to clipboard

abs broken with Symbolics

Open blegat opened this issue 2 years ago • 1 comments

We used to be able to use Symbolics.Num in quaternions but https://github.com/JuliaGeometry/Quaternions.jl/pull/122/ broke our workflow; see https://github.com/dionysos-dev/Dionysos.jl/issues/211

The issue is that isinf is not defined for Num types defined in Symbolics. Maybe these could be done only for AbstractFloat ?

cc @sethaxen

blegat avatar May 22 '23 07:05 blegat

Thanks for the issue! I don't think the solution is to restrict the more accurate branch to AbstractFloat, because then we would hit the less accurate branch whenever using wrappers of floating point numbers, e.g. those in ForwardDiff and ReverseDiff.

A better way is probably to specialize abs(::Quaternion{Num}) to hit the simpler version. On Julia v1.9, we can do this with a package extension (suggested in https://github.com/JuliaGeometry/Quaternions.jl/issues/123#issuecomment-1404150924). It makes more sense to include such an extension QuaternionsSymbolicsExt here than in Symbolics.

sethaxen avatar May 22 '23 08:05 sethaxen