-
Notifications
You must be signed in to change notification settings - Fork 860
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
Document.FromJson() changes the decimal value #1555
Comments
Related to #1039 |
Hi @simon10says, thanks for reviving interest in this issue. It is concerning to me. However, due to C# limitations with number precision at high digits and our current implementation, a decision was made to wait until a next major version for a fix. We recommend that anybody using large numbers that require greater precision than offered by the decimal class use strings to store these numbers instead so as to not lose any precision. Since the previous issue is so old and might not get as much attention, I'm going to mark that one as a duplicate and keep this one open going forward. |
Hi @klaytaybai , our teams had already used the workaround you suggested, so, we are good for now. However, IMHO, I urge you to add the workaround into the next release asap because this is the kind of bug that causes a 'ghost' effect in the code and the result, which go undetected by the developers and end-user, but caused tainted data; and I wonder how many have gone undetected with this bug. For us,
Bugs could be fixed; but if we had went live with tainted data, it will be catastrophe |
This bug needs to be fixed. Any update on this please? |
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
@ashishdhingra is it normal that issues with the label "bug" are closed automatically for staleness? |
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
No close |
Reproducible using customer provided code. The value gets changed from
Per Floating-point numeric types, below are the precision limits:
For customer's scenario, |
Another case: 0.0000087 in JSON gets translated into "8.7e-06", while should stay as is |
PR #3534, addressing this issue, has been merged into our next major version which we are are currently on preview 4. We are hoping to a preview 5 within the next couple weeks that will include this change. Keeping this issue open until preview 5 is released. |
Is there a possibility to backport the fix to V3? |
@Kralizek If it was a simple merge I would but we don't have System.Text.Json available in all of the targets for V3. |
When using
Document.FromJson()
, the decimal value always increment/decrement by 1 when the number of digits are more than 18.Expected Behavior
The
FromJson()
conversion should not alter the value and should support up to 38 digits of precision as supported by DynamoDB.Current Behavior
Steps to Reproduce (for bugs)
Create a blank Console application in Visual Studio and run the code below:
You will see the result
doc: 1584097275961.1233
; it should be xxx.1234Your Environment
The text was updated successfully, but these errors were encountered: