Skip to content
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

[Go] Decimal types GetOneForMarshal loses precision #40693

Closed
disq opened this issue Mar 20, 2024 · 1 comment
Closed

[Go] Decimal types GetOneForMarshal loses precision #40693

disq opened this issue Mar 20, 2024 · 1 comment
Assignees
Milestone

Comments

@disq
Copy link
Contributor

disq commented Mar 20, 2024

Describe the bug, including details regarding any error messages, version, and platform.

Decimal types seem to lose precision with GetOneForMarshal.

// Decimal128(38,20)
        	            	expected: "0.99"
        	            	actual  : "0.99000000000000000000189735380184963276"

        	            	expected: "1234567890.123456789"
        	            	actual  : "1234567890.1234567890000000000059023411"

// Decimal256(50,25)
        	            	expected: "0.99"
        	            	actual  : "0.9899999999999999103090032649279560980669703806889"

        	            	expected: "1234567890.123456789"
        	            	actual  : "1234567890.1234566771518943399663035833026736798823"

Will follow up with a PR including these tests.

Component(s)

Go

@disq disq added the Type: bug label Mar 20, 2024
zeroshade pushed a commit that referenced this issue Mar 25, 2024
…40694)

### Rationale for this change

Loss of precision when using `GetOneForMarshal` on `Decimal128` and `Decimal256`

### What changes are included in this PR?

Fixes for precision loss with `DecimalType.GetOneForMarshal`

* GitHub Issue: #40693

Lead-authored-by: Herman Schaaf <hermanschaaf@gmail.com>
Co-authored-by: Kemal Hadimli <disq@users.noreply.github.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
@zeroshade zeroshade added this to the 16.0.0 milestone Mar 25, 2024
@zeroshade
Copy link
Member

Issue resolved by pull request 40694
#40694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants