-
Notifications
You must be signed in to change notification settings - Fork 116
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
Fix issues of tanh(x) when x=INF or -INF #2786
Conversation
Test summary for commit 50d32aaCTS tests (Failed: 0/137949)
Ubuntu navi3x, SrdcvkUbuntu navi2x, Srdcvk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like I've had a discussion with @kezhaoAMD about this recently. But I think it was in an llpcfe context. Did you discuss with him? He had a solution using copysign which might be a little better.
Yes, llpcfe uses a copysign.
|
Thank you. Yes, this is better and saves a v_cndmask. I will follow it. |
I didn't add it into lgc because I was not sure whether GLSL spec requires this. I can drop the llpcfe approach when the lgc commit is merged. |
We didn't check this special case. We just computed tanh(x) by sinh(x)/cosh(x). But when x=INF or -INF, the limit of tanh(x) is defined as follow: lim(tanh(x)) = 1.0, x -> INF; lim(tanh(x)) = -1.0, x -> -INF
Test summary for commit db6e682CTS tests (Failed: 0/137949)
Ubuntu navi3x, SrdcvkUbuntu navi2x, Srdcvk |
Thank you. Actually, GLSL spec allows this but we didn't encounter such issues because there is no test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
We didn't check this special case. We just computed tanh(x) by sinh(x)/cosh(x). But when x=INF or -INF, the limit of tanh(x) is defined as follow:
lim(tanh(x)) = 1.0, x -> INF; lim(tanh(x)) = -1.0, x -> -INF