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: Typo in the documentation of Int.DivMod #13875

Closed
Tom-Coates opened this issue Jan 8, 2016 · 4 comments
Closed

math/big: Typo in the documentation of Int.DivMod #13875

Tom-Coates opened this issue Jan 8, 2016 · 4 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Milestone

Comments

@Tom-Coates
Copy link

The documentation for DivMod, in the big library, suggests that z.DivMod(x,y,w) sets z to the quotient q and w to the modulus m, where q and m satisfy

m = x - y*q with 0 <= m < |q|

I believe that this should read

m = x - y*q with 0 <= m < |y|

so that it agrees with the reference mentioned in the documentation for DivMod: Raymond T. Boute, “The Euclidean definition of the functions div and mod”. ACM Transactions on Programming Languages and Systems (TOPLAS), 14(2):127-144, New York, NY, USA, 4/1992. ACM press.

@Tom-Coates Tom-Coates changed the title mistake in the definition of DivMod math/big: mistake in the definition of DivMod Jan 8, 2016
@ianlancetaylor
Copy link
Member

I can't tell: is this a problem with the docs, or a problem with the code?

@Tom-Coates
Copy link
Author

Code looks OK to me.

@ianlancetaylor ianlancetaylor added the Documentation Issues describing a change to documentation. label Jan 8, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.6Maybe milestone Jan 8, 2016
@rsc
Copy link
Contributor

rsc commented Jan 8, 2016

Yes, if the operation is q=x/y then clearly the remainder (sorry, modulus) must be < y, not < q. Thanks.

@griesemer griesemer changed the title math/big: mistake in the definition of DivMod math/big: Typo in the documentation of Int.DivMod Jan 8, 2016
@gopherbot
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Jan 7, 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