Skip to content

Incorrect behavior of max(d::Dual, ::Float64) when partials are -Inf #603

Closed
JuliaDiff/DiffRules.jl
#87
@jeffreyesun

Description

@jeffreyesun

See the following MWE:

using ForwardDiff
a = ForwardDiff.Dual(-1.0, -Inf)
a = max(a, 0.0) #Dual{Nothing}(0.0,NaN)

The correct output should be Dual{Nothing}(0.0,0.0), as the constant 0.0 does not depend on the x. This was causing my code to fail as the solver I was using couldn't handle the NaN values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions