]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: use lists in docstrings
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 11 Jul 2024 02:23:32 +0000 (19:23 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 16 Jul 2024 18:17:35 +0000 (18:17 +0000)
This looks way better than the code formatting.

Similar to CL 597656.

Change-Id: I2c8809c1d6f8a8387941567213880662ff649a73
Reviewed-on: https://go-review.googlesource.com/c/go/+/597659
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/math/big/float.go
src/math/big/int.go
src/math/big/rat.go

index 57ad236130a33b674d49ac7e42b3249c907790e4..813c4ebfa7477f830df2958e11d40cee502abd05 100644 (file)
@@ -232,10 +232,9 @@ func (x *Float) Acc() Accuracy {
 }
 
 // Sign returns:
-//
-//     -1 if x <   0
-//      0 if x is ±0
-//     +1 if x >   0
+//   - -1 if x < 0;
+//   - 0 if x is ±0;
+//   - +1 if x > 0.
 func (x *Float) Sign() int {
        if debugFloat {
                x.validate()
@@ -1673,10 +1672,9 @@ func (z *Float) Quo(x, y *Float) *Float {
 }
 
 // Cmp compares x and y and returns:
-//
-//     -1 if x <  y
-//      0 if x == y (incl. -0 == 0, -Inf == -Inf, and +Inf == +Inf)
-//     +1 if x >  y
+//   - -1 if x < y;
+//   - 0 if x == y (incl. -0 == 0, -Inf == -Inf, and +Inf == +Inf);
+//   - +1 if x > y.
 func (x *Float) Cmp(y *Float) int {
        if debugFloat {
                x.validate()
index ebd5ac7b5cfa5d8653c730cc1fbf78814574863f..944b70c0621afe2bc4ffd77721ddc1f588709045 100644 (file)
@@ -38,10 +38,9 @@ type Int struct {
 var intOne = &Int{false, natOne}
 
 // Sign returns:
-//
-//     -1 if x <  0
-//      0 if x == 0
-//     +1 if x >  0
+//   - -1 if x < 0;
+//   - 0 if x == 0;
+//   - +1 if x > 0.
 func (x *Int) Sign() int {
        // This function is used in cryptographic operations. It must not leak
        // anything but the Int's sign and bit size through side-channels. Any
@@ -366,10 +365,9 @@ func (z *Int) DivMod(x, y, m *Int) (*Int, *Int) {
 }
 
 // Cmp compares x and y and returns:
-//
-//     -1 if x <  y
-//      0 if x == y
-//     +1 if x >  y
+//   - -1 if x < y;
+//   - 0 if x == y;
+//   - +1 if x > y.
 func (x *Int) Cmp(y *Int) (r int) {
        // x cmp y == x cmp y
        // x cmp (-y) == x
@@ -392,10 +390,9 @@ func (x *Int) Cmp(y *Int) (r int) {
 }
 
 // CmpAbs compares the absolute values of x and y and returns:
-//
-//     -1 if |x| <  |y|
-//      0 if |x| == |y|
-//     +1 if |x| >  |y|
+//   - -1 if |x| < |y|;
+//   - 0 if |x| == |y|;
+//   - +1 if |x| > |y|.
 func (x *Int) CmpAbs(y *Int) int {
        return x.abs.cmp(y.abs)
 }
@@ -1150,9 +1147,10 @@ func (x *Int) Bit(i int) uint {
 }
 
 // SetBit sets z to x, with x's i'th bit set to b (0 or 1).
-// That is, if b is 1 SetBit sets z = x | (1 << i);
-// if b is 0 SetBit sets z = x &^ (1 << i). If b is not 0 or 1,
-// SetBit will panic.
+// That is,
+//   - if b is 1, SetBit sets z = x | (1 << i);
+//   - if b is 0, SetBit sets z = x &^ (1 << i);
+//   - if b is not 0 or 1, SetBit will panic.
 func (z *Int) SetBit(x *Int, i int, b uint) *Int {
        if i < 0 {
                panic("negative bit index")
index cb32b783a1b032f44fdedf06cfa5a005827fcc3f..e58433ecea333c5fc1b7fb24f9eabb1f68768f58 100644 (file)
@@ -388,10 +388,9 @@ func (z *Rat) Inv(x *Rat) *Rat {
 }
 
 // Sign returns:
-//
-//     -1 if x <  0
-//      0 if x == 0
-//     +1 if x >  0
+//   - -1 if x < 0;
+//   - 0 if x == 0;
+//   - +1 if x > 0.
 func (x *Rat) Sign() int {
        return x.a.Sign()
 }
@@ -477,10 +476,9 @@ func (z *Int) scaleDenom(x *Int, f nat) {
 }
 
 // Cmp compares x and y and returns:
-//
-//     -1 if x <  y
-//      0 if x == y
-//     +1 if x >  y
+//   - -1 if x < y;
+//   - 0 if x == y;
+//   - +1 if x > y.
 func (x *Rat) Cmp(y *Rat) int {
        var a, b Int
        a.scaleDenom(&x.a, y.b.abs)