-
Notifications
You must be signed in to change notification settings - Fork 398
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
CppCheck log to log1p to see what diffs look like #10687
Conversation
@@ -6299,7 +6299,7 @@ Real64 CalcClearRoof(EnergyPlusData &state, | |||
|
|||
Real64 Rf = RoughnessMultiplier[(int)RoughnessIndex]; | |||
if (Rex > 0.1) { // avoid zero and crazy small denominators | |||
Real64 tmp = std::log(1.0 + GrLn / pow_2(Rex)); | |||
Real64 tmp = std::log1p(GrLn / pow_2(Rex)); |
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.
Testing this suggestion, diffs are very small:
[src/EnergyPlus/ConvectionCoefficients.cc:6302]:(style),[unpreciseMathCall],Expression 'log(1 + x)' can be replaced by 'log1p(x)' to avoid loss of precision.
ZoneCoupledKivaConvectionAdaptiveSmallOffice, diffs are small:
|
I'm fine with the extremely tiny diffs here. You want this to drop in @rraustad ? |
Please do. This was a test to see how the log1p function affected the answer without making that change in more than 1 place. |
In it goes, thanks @rraustad |
Pull request overview
NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.