Skip to content

Printing partial of dual number fails  #410

@ghost

Description

Interactively calling:

using ForwardDiff
d = ForwardDiff.dual{Float64}(1.,1.)
d.partials

Gives the following error:

1-element ForwardDiff.Partials{1,Float64}:
Error showing value of type ForwardDiff.Partials{1,Float64}:
ERROR: MethodError: no method matching getindex(::Tuple{Float64}, ::Int64, ::Int64)
Closest candidates are:
getindex(::Tuple, ::Int64) at tuple.jl:24
getindex(::Tuple, ::Real) at tuple.jl:25
getindex(::Tuple, ::AbstractUnitRange{#s75} where #s75<:Real) at range.jl:288
...
Stacktrace:
[1] getindex at /Users/sebastian/.julia/packages/ForwardDiff/N0wMF/src/partials.jl:23 [inlined]
[2] isassigned(::ForwardDiff.Partials{1,Float64}, ::Int64, ::Int64) at ./abstractarray.jl:405
[3] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::ForwardDiff.Partials{1,Float64}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64)
at ./arrayshow.jl:67
...

Calling partials[1] works fine.

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