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

Non-compilable code output for division operation in reverse mode #880

Closed
vaithak opened this issue May 6, 2024 · 0 comments · Fixed by #887
Closed

Non-compilable code output for division operation in reverse mode #880

vaithak opened this issue May 6, 2024 · 0 comments · Fixed by #887

Comments

@vaithak
Copy link
Collaborator

vaithak commented May 6, 2024

Minimal code:

#include "clad/Differentiator/Differentiator.h"

double f(double x) {
  return -0.5/x;
}

int main() {
  clad::gradient(f);
  return 0;
}

The output derivative code is:

void f_grad(double x, double *_d_x) {
    goto _label0;
  _label0:
    {
        double _r0 = 1 * --0.5 / (x * x);  // <-------- error - consecutive (--) operators do not compile.
        *_d_x += _r0;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant