Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Probably fixes #3.
I tried to make this PR as minimal as possible.
Hopefully this change is sufficient! Quick testing shows that the new slope is accurate close to machine precision (relative error bounded by about 1e-14).
I think this should only make pH solves a little bit more accurate where it used to be inaccurate (e.g., for extreme input) at the price of a few extra computations that I hope incur only a marginal cost. This also potentially reduces the number of Newton iterations, so it could turn out a bit more efficient.
But just to be sure, could someone check that I did not mess anything up? Is there a test suite available somewhere?