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

Better handling of rounding-mode context for decimal calculations in table-generator #991

Open
PhilippWendler opened this issue Feb 14, 2024 · 0 comments

Comments

@PhilippWendler
Copy link
Member

In table-generator, we use the rounding mode ROUND_HALF_UP. We set this globally in columns.py, which creates problems if someone imports table-generator, and for #917.
We also do not want to specify the rounding mode for every single operation because it can easily be forgotten. But we can set the rounding mode using a local context by wrapping with decimal.localcontext() as context: around all entry points. That would avoid the change of the global state and still be less risk. We just have to check whether this automatically works for computations done in worker processes with the multiprocessing module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant