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

math/big: Rat.SetFloat64: Inconsistent between document and actual result #17221

Closed
bupjae opened this issue Sep 24, 2016 · 1 comment
Closed

Comments

@bupjae
Copy link

bupjae commented Sep 24, 2016

What version of Go are you using (go version)?

go1.7

What operating system and processor architecture are you using (go env)?

windows/amd64

What did you do?

https://play.golang.org/p/kkiH1mxD7F

What did you expect to see?

6/5

The document https://golang.org/pkg/math/big says this:
z2 := new(Rat).SetFloat64(1.2) // z2 := 6/5

What did you see instead?

5404319552844595/4503599627370496

I understand the result of the program, as float64 can't represent 1.2 exactly.
If this is the case, the document should be changed; either mention the actual result with explaination, or select value that float64 can represent exactly.

@gopherbot
Copy link

CL https://golang.org/cl/29711 mentions this issue.

@golang golang locked and limited conversation to collaborators Sep 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants