JuliaDiff / JuliaDiff/ForwardDiff.jl
NaN partials and comparison
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 1k
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
Some operations generate Dual with NaN partials, and I'm not sure comparison operators are defined consistently for them...
julia> xs = Dual(0.0,NaN)
# it's not zero,
julia> iszero(xs)
false
# no, definitely not zero,
julia> xs ≈ 0
false
# it's a regular finite number:
julia> isnan(xs)
false
julia> isfinite(xs)
true
# moreover, it's a positive number
julia> xs > 0
true
# but adding this positive number, or multiplying it by anything still gives the same number back:
julia> xs + xs === xs
true
julia> xs * 1e100 === xs
true
# these are the defining properties of a zero
# shouldn't it be considered a zero really?
Intuitively I would say that the most natural thing is to compare equal to zero, but maybe there are other self-consistent choices as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Julia examples in the issue and inspect the Dual comparison, zero, NaN, and finiteness behavior. Done means agreeing on a consistent treatment of Dual values with NaN partials and adding tests for the selected semantics; no source files or existing tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100