-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[C#] Better support for decimal values which exceed the range of the BCL's System.Decimal in Decimal128 #38351
Comments
What about using SqlDecimal (https://learn.microsoft.com/en-us/dotnet/api/system.data.sqltypes.sqldecimal?view=netstandard-2.0)? Although it wouldn't work for Decimal256, but it should support same range as Decimal128. |
Oh, interesting; I didn't know about that type. My gut reaction is that it's a little weird to have different stories for Decimal128 than for Decimal256, but it also seems foolish not to take advantage of a standard type where one exists. |
### What changes are included in this PR? Adds support for reading and writing System.Data.SqlTypes.SqlDecimal against Decimal128Array. ### Are these changes tested? Yes. ### Are there any user-facing changes? Adds functions to the API. * Closes: #38351 Authored-by: Curt Hagenlocher <curt@hagenlocher.org> Signed-off-by: Curt Hagenlocher <curt@hagenlocher.org>
…e#38481) ### What changes are included in this PR? Adds support for reading and writing System.Data.SqlTypes.SqlDecimal against Decimal128Array. ### Are these changes tested? Yes. ### Are there any user-facing changes? Adds functions to the API. * Closes: apache#38351 Authored-by: Curt Hagenlocher <curt@hagenlocher.org> Signed-off-by: Curt Hagenlocher <curt@hagenlocher.org>
…e#38481) ### What changes are included in this PR? Adds support for reading and writing System.Data.SqlTypes.SqlDecimal against Decimal128Array. ### Are these changes tested? Yes. ### Are there any user-facing changes? Adds functions to the API. * Closes: apache#38351 Authored-by: Curt Hagenlocher <curt@hagenlocher.org> Signed-off-by: Curt Hagenlocher <curt@hagenlocher.org>
Describe the enhancement requested
There should be a way to read decimal values outside the (untruncated) range of System.Decimal despite the lack of a "standard" .NET type for doing this. Some possible options:
Add a new scalar type to represent BigDecimal
Allow the mantissa to be read as a BigInteger
Add an extension mechanism which allows consuming libraries to supply their own conversions
The drawback of the first is that (at least in my opinion) it would be better to keep "opinions" out of the base library and a new custom BigDecimal type won't be what anyone is already using.
One advantage of an extension mechanism is that (if general enough) it could also be used to e.g. consume Float16 on downlevel platforms which don't support it in the BCL.
Component(s)
C#
The text was updated successfully, but these errors were encountered: