ForwardDiff.jl
ForwardDiff.jl copied to clipboard
`construct_seeds` for types where `typeof(one(T)) !=T` is broken
as far as i understand, the type of one(T) is not necessarily T (https://github.com/JuliaPhysics/Measurements.jl/issues/134 for example). but construct_seeds uses this:
https://github.com/JuliaDiff/ForwardDiff.jl/blob/50ec9a1ccb0a4390edc88398aa322656d58e7202/src/partials.jl#L9-L12
Maybe using oneunit there is more correct?
If you want to get something of the same type, you should use oneunit, that's what it's for.
(e.g. for a dimensionful type, one must be dimensionless, i.e. of a different type, as otherwise it will not be a multiplicative identity.)