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

solve_bicgstab: consistent RT casting #3625

Conversation

eebasso
Copy link
Contributor

@eebasso eebasso commented Nov 13, 2023

Summary

This PR makes sure that every instance in solve_bicgstab of setting an RT variable to 0 or checking if it is equal to 0 uses the explicit RT(0.0) cast.

@eebasso eebasso changed the title solve_bicgstab: consistent ==RT(0.0) checks solve_bicgstab: consistent RT casting Nov 13, 2023
@WeiqunZhang
Copy link
Member

Why do we need to change from

if (rhTv != RT(0.0))
{
    alpha = rho/rhTv;
}
else
{
    ret = 2; break;
}

to

if (rhTv == RT(0.0))
{
   ret = 2; break;
}
alpha = rho/rhTv;

I did not write the original code. Either way is fine with me. But why does it matter?

@eebasso
Copy link
Contributor Author

eebasso commented Nov 14, 2023

This change takes up less lines of code, and makes this zero check consistent in structure with the rho == RT(0.0) and omega == RT(0.0) checks. In my humble opinion, it looks more elegant this way.

@asalmgren
Copy link
Member

This is a small change for the sake of change; in the best interest of the developers' time we would like contributors to focus their efforts on fixing erroneous code (aka bugs) and contributing new functionality.

@asalmgren asalmgren closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants