Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding rules for rem2pi, mod2pi #18

Open
tkoolen opened this issue Sep 13, 2017 · 2 comments
Open

Adding rules for rem2pi, mod2pi #18

tkoolen opened this issue Sep 13, 2017 · 2 comments

Comments

@tkoolen
Copy link

tkoolen commented Sep 13, 2017

To get both rem2pi and mod2pi, it should be sufficient to just define a rule for rem2pi, as mod2pi is implemented in terms of rem2pi in Base. Unfortunately, rem2pi, with its RoundingMode argument, doesn't really fit the mold of functions accepting only numeric arguments (and thus having derivatives with respect to all of the arguments). I also don't really think it makes sense to define rules for the lower-level functions that are called in rem2pi (e.g., ieee754_rem_pio2, add22condh), as those seem more like implementation details.

Do you have any plans for how to handle this case? I can help implement this, but if you could give me an idea of what the required changes to DiffBase (and possibly dependent packages) would be, that would be very helpful.

Ref: JuliaDiff/ForwardDiff.jl#113.

@jrevels
Copy link
Contributor

jrevels commented Sep 14, 2017

If a derivative for an argument doesn't exist/make sense, my general strategy has just been to pop a NaN in there (see the bessel* diffrules, for example).

ref JuliaMath/Calculus.jl#89

@tkoolen
Copy link
Author

tkoolen commented Sep 14, 2017

OK great, that's what I'll do then.

tkoolen added a commit to tkoolen/DiffBase.jl that referenced this issue Sep 14, 2017
tkoolen added a commit to tkoolen/DiffBase.jl that referenced this issue Sep 14, 2017
@tkoolen tkoolen mentioned this issue Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants