-
Notifications
You must be signed in to change notification settings - Fork 118
Throw for complex std::pow results in CO2::vaporPressure #4514
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
base: master
Are you sure you want to change the base?
Conversation
|
jenkins build this please |
|
The safeguard added here is fine. I will add a fix that make sure it never is thrown. I suggest we merge that fix first. |
|
jenkins build this please |
| Evaluation exponent = 0; | ||
| Evaluation critTemp = criticalTemperature(); | ||
| Evaluation Tred = T/criticalTemperature(); | ||
|
|
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.
Maybe use critTemp here since you just copied it.
| // this is on page 1524 of the reference | ||
| Evaluation exponent = 0; | ||
| Evaluation critTemp = criticalTemperature(); | ||
| Evaluation Tred = T/criticalTemperature(); |
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.
critTemp is Scalar
| for (int i = 0; i < 4; ++i) | ||
| exponent += a[i]*pow(1 - Tred, t[i]); | ||
| exponent += a[i]*pow(1 - T/critTemp, t[i]); | ||
| exponent *= 1.0/Tred; |
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.
why not just use Tred here?
|
This can be merged when the small nitpicks have been fixed. |
|
It seems to me that the solution actually goes to zero when we approach zero from the positive side. Maybe we should just use 0 values <=0? |
std::pow may throw for negative base and non-integer exponent, g++ doesn't. Here we add an explicit throw.