Skip to content

li(n, z) returns incorrect values for Complex{ForwardDiff.Dual} inputs #40

Description

@NAThompson

PolyLog.li(2, z) returns incorrect values when z is Complex{ForwardDiff.Dual}. The value components of the returned Duals differ from the values computed for plain Complex{Float64} at the same point.

Reproducer

using ForwardDiff
using PolyLog
z = 0.5 + 0.8im
li2_plain = li(2, z)
z_dual = complex(ForwardDiff.Dual(real(z)), ForwardDiff.Dual(imag(z)))
li2_dual  = li(2, z_dual)

@assert li2_plain.re  li2_dual.re.value # will fail
@assert li2_plain.im  li2_dual.im.value # will fail

Impact

This bug propagates to downstream packages-I found this one in ClausenFunctions.jl.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions