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

Add mode, which throws error in case of overflow (COBOL had this mode for many decades!) #171

Open
safinaskar opened this issue Jul 28, 2024 · 0 comments

Comments

@safinaskar
Copy link

I propose adding another variant of Decimal128 rounding mode. I will call it "prohibited". It will simply throw an error if exact result cannot be represented as Decimal128. The error should be throw in all cases when resulting mathematical value cannot be stored in Decimal128. This includes all kinds of overflow, underflow and rounding.

Why I want this? Well, because when dealing with money, one often needs to get exact answer or no answer at all. I. e. sometimes visible failure is better than inexact answer.

COBOL had this feature for many decades. COBOL allows one to specify so-called "rounding mode". One of possible rounding modes is "rounding mode prohibited", which is similar to this proposal. Are we worse than COBOL? I don't think so. This would be absurd if we in 2024 don't have this old COBOL feature

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