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

NewFromString loss precsion with zero trailing #181

Closed
guotie opened this issue Jul 16, 2020 · 2 comments
Closed

NewFromString loss precsion with zero trailing #181

guotie opened this issue Jul 16, 2020 · 2 comments

Comments

@guotie
Copy link

guotie commented Jul 16, 2020

if I use NewFromString to convert a string like 100.000, the decimal i got precision is 0!

for example:

ss := "100.000"
d, _ := decimal.NewFromString(ss)
fmt.Println(-d.Exponent())  // here is 0, but should be 3!
@mwoss
Copy link
Member

mwoss commented Jul 19, 2020

Hi @guotie. Are you sure that you are using the latest decimal library version? The issue with truncated zeroes was fixed in PR #159.
I tried to run your code sample on version 1.2.0 and it works as supposed to.

@guotie
Copy link
Author

guotie commented Jul 21, 2020

yes, my problem. my version is v0.0.0-20200105231215-408a2507e114

@guotie guotie closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants