math/big: use lists in docstrings

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>
This commit is contained in:
Kir Kolyshkin 2024-07-10 19:23:32 -07:00 committed by Gopher Robot
parent 66e940b6f8
commit 97ccc224f1
3 changed files with 25 additions and 31 deletions

View 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()

View 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")

View 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)