aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwithsky <withsky2002@gmail.com>2024-07-17 12:06:34 +0000
committerGopher Robot <gobot@golang.org>2024-07-17 15:08:04 +0000
commitfc51e5023ec99fee405ae61ee4ab2c8c9bc66f24 (patch)
tree75d1cc6d5578437a2b7977e021bf8e609e11e257 /src
parent90c6558b6acef5a9b9fb8f3c35cff58423c8b00e (diff)
downloadgo-fc51e5023ec99fee405ae61ee4ab2c8c9bc66f24.tar.xz
math/big: fix comment typo in natdiv.go
Comment in line 395: [x₀ < S, so S - x₀ < 0; drop it] Should be: [x₀ < S, so S - x₀ > 0; drop it] The proof is based on S - x₀ > 0, thus it's a typo of comment. Fixes #68466 Change-Id: I68bb7cb909ba2bfe02a8873f74b57edc6679b72a GitHub-Last-Rev: 40a2fc80cf22e97e0f535454a9b87b31b2e51421 GitHub-Pull-Request: golang/go#68487 Reviewed-on: https://go-review.googlesource.com/c/go/+/598855 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/math/big/natdiv.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/big/natdiv.go b/src/math/big/natdiv.go
index 2172eeca40..b55f9990cd 100644
--- a/src/math/big/natdiv.go
+++ b/src/math/big/natdiv.go
@@ -392,7 +392,7 @@ Proof that q ≤ q̂:
≥ (1/y)·((x₁ - y₁ + 1)·S - x) [above: q̂·y₁ ≥ x₁ - y₁ + 1]
= (1/y)·(x₁·S - y₁·S + S - x) [distribute S]
= (1/y)·(S - x₀ - y₁·S) [-x = -x₁·S - x₀]
- > -y₁·S / y [x₀ < S, so S - x₀ < 0; drop it]
+ > -y₁·S / y [x₀ < S, so S - x₀ > 0; drop it]
≥ -1 [y₁·S ≤ y]
So q̂ - q > -1.