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

"Must be the same types" strange case #19

Closed
alexander-penev opened this issue Jul 18, 2014 · 1 comment
Closed

"Must be the same types" strange case #19

alexander-penev opened this issue Jul 18, 2014 · 1 comment
Assignees
Labels

Comments

@alexander-penev
Copy link
Collaborator

This function is differentiate without problems:

float sphere_implicit_func(float x, float y, float z, float px, float py, float pz, float r) {
  return (x-px)*(x-px) + (y-py)*(y-py) + (z-pz)*(z-pz) - r*r;
}

but this

float sphere_distance_func(float x, float y, float z, float px, float py, float pz, float r) {
  return (x-px)*(x-px) + (y-py)*(y-py) + (z-pz)*(z-pz) - r;
}

generate compile time assertion:

Assertion failed: (lhs_derived->getType() == rhs_derived->getType() && "Must be the same types."), function VisitBinaryOperator, file /Users/alexanderpenev/clad/src/tools/clad/lib/Differentiator/DerivativeBuilder.cpp, line 453.

This workaround

float sphere_distance_func(float x, float y, float z, float px, float py, float pz, float r) {
  return (x-px)*(x-px) + (y-py)*(y-py) + (z-pz)*(z-pz) - r*1.0f;
}

also is OK.

@alexander-penev alexander-penev changed the title Must be the same types "Must be the same types" strange case Jul 18, 2014
@vgvassilev vgvassilev self-assigned this Jul 18, 2014
@vgvassilev
Copy link
Owner

Thanks for the report. Should be fixed in f915dd3.
Vassil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants