We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example:
a, _ := decimal.NewFromString("166.6666666666666667") b := decimal.NewFromFloat(166.6666666666666667) fmt.Println(a.Equal(b)) // false println(a.String()) // 166.6666666666666667 println(b.String()) // 166.66666666666666
Play with it: https://go.dev/play/p/isV9ODqEy5u
The same for:
decimal.NewFromFloatWithExponent(166.6666666666666667, -16)
Question is: why NewFromString and NewFromFloat returns different values?
The text was updated successfully, but these errors were encountered:
Because 166.6666666666666667 == 166.66666666666666 for float64.
This is a correct behavior.
Sorry, something went wrong.
No branches or pull requests
Example:
Play with it:
https://go.dev/play/p/isV9ODqEy5u
The same for:
Question is: why NewFromString and NewFromFloat returns different values?
The text was updated successfully, but these errors were encountered: