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

Rounding errors #2

Open
j-faria opened this issue Oct 6, 2015 · 1 comment
Open

Rounding errors #2

j-faria opened this issue Oct 6, 2015 · 1 comment

Comments

@j-faria
Copy link
Owner

j-faria commented Oct 6, 2015

As suggested by Chris Boon & Adam Hill

rounding errors and numerical inaccuracies sometimes mean that the values of CCh and SSh may be computationally equivalent to zero but may not exactly be zero.This can lead to K being positive and the code raising an error. In order to account for these numerical inaccuracies, we have added a catch clause in the code such that if these values fall below a defined threshold (1e-10 is the value I have been using arbitrarily) then it sets CCh and SSh to be exactly zero.

if (CCh < 1e-10):
    CCh = 0
elif (SSh < 1e-10):
    SSh = 0
@j-faria
Copy link
Owner Author

j-faria commented Oct 6, 2015

I would propose a solution with sys.float.min instead of the arbitrary 1e-10.

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

No branches or pull requests

1 participant