Description
The following causes an overflow error:
var strValue = "10000.0000000000000000000000001"; |
Decimal128 decimal128Value;
|
Decimal128.TryParse( strValue, out decimal128Value ); |
var decimalValue = Decimal128.ToDecimal( decimal128Value ); |
Not that converting to double does not overflow:
var doubleValue = Decimal128.ToDouble( decimal128Value ); |
It is unclear why the Decimal128 value offers different precision than a standard .NET decimal. However the conversion to the .NET decimal should allow for a truncation of precision if necessary, as there currently is no other safe way to convert to decimal without going through some other type first (string or double).
Attachments
Issue Links
- is duplicated by
-
CSHARP-2098 Decimal128.Compare() gives inaccurate results
-
- Closed
-