]> Cypherpunks repositories - gostls13.git/commitdiff
math/pow10: remove overlapping boundary (n=0)
authormohanson <mohanson@outlook.com>
Mon, 15 Dec 2025 07:06:48 +0000 (15:06 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 23 Jan 2026 16:26:22 +0000 (08:26 -0800)
Both the first and second conditions include n=0, creating an
implicit logic that relies on order of evaluation.

Change-Id: Iefbc25a676242fabf272203a3e845363585bff56
Reviewed-on: https://go-review.googlesource.com/c/go/+/730060
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

src/math/pow10.go

index c31ad8dbc778fe5dbd2a676645019b7ac0e91974..6f84db002370203c7dfd0afea0c820a541f3eac8 100644 (file)
@@ -33,7 +33,7 @@ func Pow10(n int) float64 {
                return pow10postab32[uint(n)/32] * pow10tab[uint(n)%32]
        }
 
-       if -323 <= n && n <= 0 {
+       if -323 <= n && n < 0 {
                return pow10negtab32[uint(-n)/32] / pow10tab[uint(-n)%32]
        }