Skip to content

Dual / Real gives incurs unnecessary error. #264

Closed

Description

@simonbyrne

#247 seems to change the random numbers used (no idea why, perhaps due because it doesn't hash?). This exposed the fact that /(x::Dual, y::Real) = Dual(value(x) * inv(y), partials(x) * inv(y)), which can give different results than Dual(value(x) / y, partials(x) /y ).

The broken test is

@test Dual{1}(FDNUM / PRIMAL, FDNUM2 / PRIMAL) === Dual{1}(FDNUM, FDNUM2) / PRIMAL

julia> import ForwardDiff.Dual

julia> FDNUM2 = Dual{Void}(7,8,7,2)
Dual{Void}(7,8,7,2)

julia> FDNUM = Dual{Void}(6,9,7,5)
Dual{Void}(6,9,7,5)

julia> PRIMAL = 6
6

julia> Dual{1}(FDNUM / PRIMAL, FDNUM2 / PRIMAL) === Dual{1}(FDNUM, FDNUM2) / PRIMAL
false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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