JuliaDiff / JuliaDiff/ForwardDiff.jl

Rationals and Modulo

Open
#647 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
1k
Forks
160
PR merge metrics
No merged PRs in 30d

Description

Differentiation with modulo function yields a Float, even for Rational input.

What doesn't work:

ForwardDiff.derivative(x->mod(x^2,1), 1//3)
0.6666666666666666

What works:

ForwardDiff.derivative(x->x^2, 1//3)
2//3

mod(1//2,1)
1//2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the ForwardDiff.derivative example with a Rational input and compare it with the working derivative and mod examples. Investigate the ForwardDiff.derivative and mod entry points to determine where the result becomes a Float; done means the derivative for this case retains the Rational result shown by the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.