]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: fix a formula used as documentation
authorhearot <gabriel@hearot.it>
Sun, 28 Oct 2018 09:01:39 +0000 (10:01 +0100)
committerRobert Griesemer <gri@golang.org>
Sun, 28 Oct 2018 16:58:20 +0000 (16:58 +0000)
The function documentation was wrong, it was using a wrong parameter. This change
replaces it with the right parameter.

The wrong formula was: q = (u1<<_W + u0 - r)/y
The function has got a parameter "v" (of type Word), not a parameter "y".
So, the right formula is: q = (u1<<_W + u0 - r)/v

Fixes #28444

Change-Id: I82e57ba014735a9fdb6262874ddf498754d30d33
Reviewed-on: https://go-review.googlesource.com/c/145280
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/big/arith.go

index ad352403a7c5e7223ff1f6fb081d877542da6f95..f9db9118eb254e18a19e30a87ed0c55eca03e056 100644 (file)
@@ -82,7 +82,7 @@ func nlz(x Word) uint {
        return uint(bits.LeadingZeros(uint(x)))
 }
 
-// q = (u1<<_W + u0 - r)/y
+// q = (u1<<_W + u0 - r)/v
 // Adapted from Warren, Hacker's Delight, p. 152.
 func divWW_g(u1, u0, v Word) (q, r Word) {
        if u1 >= v {