]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: add a comment for SetMantExp
authorsurechen <surechen17@gmail.com>
Wed, 13 May 2020 09:03:36 +0000 (17:03 +0800)
committerRobert Griesemer <gri@golang.org>
Fri, 28 Aug 2020 16:25:32 +0000 (16:25 +0000)
Change-Id: I9ff5d1767cf70648c2251268e5e815944a7cb371
Reviewed-on: https://go-review.googlesource.com/c/go/+/233737
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/big/float.go

index da964eef3e8dc4dc4489fb7517424906900fc5cb..42050e2c39d76e2c703730ac8883b0dd2f31f715 100644 (file)
@@ -322,10 +322,11 @@ func (z *Float) SetMantExp(mant *Float, exp int) *Float {
                mant.validate()
        }
        z.Copy(mant)
-       if z.form != finite {
-               return z
+
+       if z.form == finite {
+               // 0 < |mant| < +Inf
+               z.setExpAndRound(int64(z.exp)+int64(exp), 0)
        }
-       z.setExpAndRound(int64(z.exp)+int64(exp), 0)
        return z
 }