Skip to content

log(Dual(0.0,0.0)) is Dual(-Inf,NaN) #178

@tpapp

Description

@tpapp

I have been tracking an issue of NaN propagation in my code, and narrowed it down to the following MWE:

julia>  log(Dual(0.0,0.0))
Dual(-Inf,NaN)

Would Dual(-Inf,0.0) make sense? After all, the value is not sensitive to that variable.

The context is a Hidden Markov Chain problem for which I am fitting a model using derivative-based Bayesian methods. It makes sense to keep track of the log likelihood because of underflow/overflow.

A quick workaround (that would overwrite the method) would be appreciated so that I could proceed with work (I haven't had time to dig into ForwardDiff internals yet), but given some advice on what to do I would also submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions