[CSHARP-2582] Decimal128 to decimal conversion loses precision for zero Created: 10/Apr/19 Updated: 28/Oct/23 Resolved: 02/May/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.8.0 |
| Fix Version/s: | 2.8.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Thomas Hjorslev | Assignee: | Dmitry Lukyanov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10, dotnet core 2.1 |
||
| Description |
|
When converting a decimal to Decimal128 and back, the result is not as expected when the original decimal is "zero with decimals", e.g. 0.000 Code to reproduce:
The last value, 0.000M is converted to a straight Decimal.Zero. I think this is due to line 719 in Decimal128.cs:
I don't believe this is the correct behavior. |
| Comments |
| Comment by Githook User [ 03/May/19 ] |
|
Author: {'name': 'Dmitry Lukyanov', 'username': 'DmitryLukyanov', 'email': 'dmitry.lukyanov@mongodb.com'}Message: |
| Comment by Githook User [ 02/May/19 ] |
|
Author: {'name': 'Dmitry Lukyanov', 'username': 'DmitryLukyanov', 'email': 'dmitry.lukyanov@mongodb.com'}Message: |