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

Use correct C math.h functions for complex #578

Closed
garth-wells opened this issue Jun 25, 2023 · 4 comments
Closed

Use correct C math.h functions for complex #578

garth-wells opened this issue Jun 25, 2023 · 4 comments
Labels
task Something that needs to be done

Comments

@garth-wells
Copy link
Member

For float, FFCx generates code that uses fabs but it should use fabsf for floats. Same is likely for other math functions.

Need to check and use correct functions.

@garth-wells garth-wells added the task Something that needs to be done label Jun 25, 2023
@chrisrichardson
Copy link
Contributor

I don't find it is wrong. I tried ffcx --scalar_type=float Poisson.py and it contains fabsf. Maybe it depends how it is called - from Python I guess it may not be passing scalar_type properly? Can you provide an example?

@garth-wells
Copy link
Member Author

I don't find it is wrong. I tried ffcx --scalar_type=float Poisson.py and it contains fabsf. Maybe it depends how it is called - from Python I guess it may not be passing scalar_type properly? Can you provide an example?

I'll dig out the test that generated the compiler warnings.

@chrisrichardson
Copy link
Contributor

I think I have found the problem here - not so much with float but with complex - the code generator assumes that all math functions should be appropriate for the scalar type (e.g. complex), but the geometry is never complex, so using e.g. cabs() is wrong, and generates a compiler warning. I think this could be fixed e.g. with a "typing" system for CNodes Symbol but that will require quite a bit of work.

@chrisrichardson chrisrichardson changed the title Use correct C math.h functions for float Use correct C math.h functions for complex Aug 9, 2023
@chrisrichardson
Copy link
Contributor

Fixed in #594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Something that needs to be done
Projects
None yet
Development

No branches or pull requests

2 participants