Ok, I looked a little deeper and for some reason <(g::GradientNumber, x::Real)
is calling <(x::Real, y::Real) = <(promote(x,y)...) which in the case of the example above promotes both arguments to GradientNumber. The method `isless(g1::GradientNumber, g2::GradientNumber)` is not defined in the ForwardDiff.jl version I have, but I can see that there seems to be a solution to this now <https://github.com/JuliaDiff/ForwardDiff.jl/blob/master/src/ForwardDiffNumber.jl> . I will try to chechout the newest version. Anyway if that doesn't fix this I will report the bug there. Sorry for the noise. Cheers, Pablo Zubieta