-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[API Proposal]: Implement decimal floating-point types that conform to the IEEE 754 standard. #69777
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsBackground and motivationWhile reading the documentation I noticed that the decimal type implemented in C# and .NET does not conform to the IEEE standard and appears to use it's own format, which can potentially cause issues and limitations in cases where using IEEE conforming decimal floating-point arithmetic are a must (Banks and financial systems). Extending the current Decimal type with Decimal32, Decimal64 and Decimal128 types as specified in the IEEE standard could make C# and .NET more compatible with banking and financial systems. It would also make C# one of the few languages that have these decimal types built-in instead of requiring big and complex third-party libraries for decimal floating-point arithmetic. API Proposal
API Usage
Alternative DesignsAlternatively, instead of providing new decimal types, change the current implementation to conform to the IEEE standard. This is a risky alternative though as it could potentially break backwards compatibility of apps that rely on the old implemention. RisksThere shouldn't be any risks of adding new alternative decimal types (decimal32, decimal64 amd decimal128) since the original type will be unchanged and use of them would be "opt-in" by manually changing source code to use the new types. Changing the current implementation of the decimal type instead would most likely be risky as there could be a number of different apps relying on that particular implementation.
|
If we implement this, we'd probably implement The implemented interfaces would be a hybrid of newly introduced
|
I generally have a desire to expose these types both to solve some common user-requests around things It's worth noting that
Some feedback:
The
All of the described APIs unique to that interface likely need a bit more thought
|
Closing this as a duplicate of the above. Thank you for the proposal @KTSnowy! |
Background and motivation
While reading the documentation I noticed that the decimal type implemented in C# and .NET does not conform to the IEEE standard and appears to use it's own format, which can potentially cause issues and limitations in cases where using IEEE conforming decimal floating-point arithmetic are a must (Banks and financial systems).
Extending the current Decimal type with Decimal32, Decimal64 and Decimal128 types as specified in the IEEE standard could make C# and .NET more compatible with banking and financial systems.
It would also make C# one of the few languages that have these decimal types built-in instead of requiring big and complex third-party libraries for decimal floating-point arithmetic.
API Proposal
API Usage
Alternative Designs
Alternatively, instead of providing new decimal types, change the current implementation to conform to the IEEE standard. This is a risky alternative though as it could potentially break backwards compatibility of apps that rely on the old implemention.
Risks
There shouldn't be any risks of adding new alternative decimal types (decimal32, decimal64 amd decimal128) since the original type will be unchanged and use of them would be "opt-in" by manually changing source code to use the new types.
Changing the current implementation of the decimal type instead would most likely be risky as there could be a number of different apps relying on that particular implementation.
The text was updated successfully, but these errors were encountered: