Skip to content

test/float_lit2: Wrong exponent in comment. #17012

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

Closed
cznic opened this issue Sep 7, 2016 · 3 comments
Closed

test/float_lit2: Wrong exponent in comment. #17012

cznic opened this issue Sep 7, 2016 · 3 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Milestone

Comments

@cznic
Copy link
Contributor

cznic commented Sep 7, 2016

Please answer these questions before submitting your issue. Thanks!

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

tip @ 0cff219

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

N/A


test/float_lit2:21 reads

// The halfway point is (f₁+f₂)/2 = 2¹²⁸ - 2¹⁰⁵.

The expression should be 2^128-2^103, ie. s/105/103/ above.

If approved, I can send a CL later today.

@bradfitz bradfitz added the Documentation Issues describing a change to documentation. label Sep 7, 2016
@bradfitz
Copy link
Contributor

bradfitz commented Sep 7, 2016

/cc @griesemer

@quentinmit quentinmit added this to the Go1.8Maybe milestone Sep 7, 2016
@griesemer
Copy link
Contributor

griesemer commented Sep 13, 2016

I think there are other mistakes in this comment as well. The largest float32 exponent is 127, thus the largest float32 is maxMant * 2**127. maxMant is 1 (implicit) + (2**23 -1)/(2**23) == 1 + 1 - 1/(2**23). Together we have maxFloat32 == (1 + 1 - 1/(2**23)) * 2**127 == (2 - 2**-23) * 2**127 == 2**128 - 2**104 == f1 (first line).

With f2 == 2**128, f1 + f2 == 2**128 - 2**104 + 2**128 == 2**129 - 2**104. Thus (f1 + f2)/2 == 2**128 - 2**103, as you suggest.

Feel free to send me a CL and assign it to me for review. Thanks.

@gopherbot
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Sep 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

5 participants