Skip to content

Simplify cosh(x) / sinh(x) -> 1/tanh(x) with fast math #79817

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

Open
felixkellenbenz opened this issue Jan 29, 2024 · 1 comment
Open

Simplify cosh(x) / sinh(x) -> 1/tanh(x) with fast math #79817

felixkellenbenz opened this issue Jan 29, 2024 · 1 comment

Comments

@felixkellenbenz
Copy link
Contributor

felixkellenbenz commented Jan 29, 2024

When using sin(x) and cos(x) the optimization for cos(x) / sin(x) -> 1/tan(x) is already implemented. This is not the case for the hyperbolic functions, maybe it would be good to also implement this behavior for sinh(x) and cos(x).
However this is not how gcc behaves, gcc calculates it like cosh(x) / sinh(x).

See here:
https://godbolt.org/z/vrMTP3h9x

@felixkellenbenz felixkellenbenz changed the title Simplify cosh(x) / sinh(x) -> 1/tanh(x) with fast math Simplify cosh(x) / sinh(x) -> 1/tanh(x) with fast math Jan 29, 2024
@felixkellenbenz
Copy link
Contributor Author

felixkellenbenz commented Jan 30, 2024

I am currently working on #78871. I could fix this issue too. Should I create separate pull request for this issue and #78871 or is it fine if I include a fix for both issues in one PR.

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

No branches or pull requests

2 participants