]> Cypherpunks repositories - gostls13.git/commitdiff
math: add available godoc link
authorcui fliter <imcusg@gmail.com>
Sat, 14 Oct 2023 13:09:16 +0000 (21:09 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 19 Oct 2023 11:59:09 +0000 (11:59 +0000)
Change-Id: I4a6c2ef6fd21355952ab7d8eaad883646a95d364
Reviewed-on: https://go-review.googlesource.com/c/go/+/535087
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
24 files changed:
src/math/big/doc.go
src/math/big/float.go
src/math/big/floatconv.go
src/math/big/floatmarsh.go
src/math/big/ftoa.go
src/math/big/int.go
src/math/big/intconv.go
src/math/big/intmarsh.go
src/math/big/rat.go
src/math/big/ratmarsh.go
src/math/bits/bits.go
src/math/cmplx/pow.go
src/math/erfinv.go
src/math/exp.go
src/math/expm1.go
src/math/hypot.go
src/math/ldexp.go
src/math/lgamma.go
src/math/log10.go
src/math/log1p.go
src/math/rand/exp.go
src/math/rand/normal.go
src/math/rand/rand.go
src/math/rand/zipf.go

index fee5a65c7b915ed2613fa7ad2e734e84590ca547..2038546fa86ec54fc8e1a60f49a6d47c0e6a6797 100644 (file)
@@ -10,7 +10,7 @@ The following numeric types are supported:
        Rat    rational numbers
        Float  floating-point numbers
 
-The zero value for an Int, Rat, or Float correspond to 0. Thus, new
+The zero value for an [Int], [Rat], or [Float] correspond to 0. Thus, new
 values can be declared in the usual ways and denote 0 without further
 initialization:
 
@@ -23,9 +23,9 @@ functions of the form:
 
        func NewT(v V) *T
 
-For instance, NewInt(x) returns an *Int set to the value of the int64
-argument x, NewRat(a, b) returns a *Rat set to the fraction a/b where
-a and b are int64 values, and NewFloat(f) returns a *Float initialized
+For instance, [NewInt](x) returns an *[Int] set to the value of the int64
+argument x, [NewRat](a, b) returns a *[Rat] set to the fraction a/b where
+a and b are int64 values, and [NewFloat](f) returns a *[Float] initialized
 to the float64 argument f. More flexibility is provided with explicit
 setters, for instance:
 
@@ -42,7 +42,7 @@ the form:
        func (z *T) Binary(x, y *T) *T    // z = x binary y
        func (x *T) Pred() P              // p = pred(x)
 
-with T one of Int, Rat, or Float. For unary and binary operations, the
+with T one of [Int], [Rat], or [Float]. For unary and binary operations, the
 result is the receiver (usually named z in that case; see below); if it
 is one of the operands x or y it may be safely overwritten (and its memory
 reused).
@@ -81,18 +81,18 @@ Methods of this form typically return the incoming receiver as well, to
 enable simple call chaining.
 
 Methods which don't require a result value to be passed in (for instance,
-Int.Sign), simply return the result. In this case, the receiver is typically
+[Int.Sign]), simply return the result. In this case, the receiver is typically
 the first operand, named x:
 
        func (x *Int) Sign() int
 
 Various methods support conversions between strings and corresponding
-numeric values, and vice versa: *Int, *Rat, and *Float values implement
+numeric values, and vice versa: *[Int], *[Rat], and *[Float] values implement
 the Stringer interface for a (default) string representation of the value,
 but also provide SetString methods to initialize a value from a string in
 a variety of supported formats (see the respective SetString documentation).
 
-Finally, *Int, *Rat, and *Float satisfy [fmt.Scanner] for scanning
-and (except for *Rat) the Formatter interface for formatted printing.
+Finally, *[Int], *[Rat], and *[Float] satisfy [fmt.Scanner] for scanning
+and (except for *[Rat]) the Formatter interface for formatted printing.
 */
 package big
index 2f0635a03b2b8ad13e5715cda05f5eb67d19caf4..1c97ec98c004f2455125fe3901d29707cf181ae9 100644 (file)
@@ -36,7 +36,7 @@ const debugFloat = false // enable for debugging
 //
 // Unless specified otherwise, all operations (including setters) that
 // specify a *Float variable for the result (usually via the receiver
-// with the exception of MantExp), round the numeric result according
+// with the exception of [Float.MantExp]), round the numeric result according
 // to the precision and rounding mode of the result variable.
 //
 // If the provided result precision is 0 (see below), it is set to the
@@ -47,20 +47,20 @@ const debugFloat = false // enable for debugging
 // their mode is the zero value for RoundingMode (ToNearestEven).
 //
 // By setting the desired precision to 24 or 53 and using matching rounding
-// mode (typically ToNearestEven), Float operations produce the same results
+// mode (typically [ToNearestEven]), Float operations produce the same results
 // as the corresponding float32 or float64 IEEE-754 arithmetic for operands
 // that correspond to normal (i.e., not denormal) float32 or float64 numbers.
 // Exponent underflow and overflow lead to a 0 or an Infinity for different
 // values than IEEE-754 because Float exponents have a much larger range.
 //
 // The zero (uninitialized) value for a Float is ready to use and represents
-// the number +0.0 exactly, with precision 0 and rounding mode ToNearestEven.
+// the number +0.0 exactly, with precision 0 and rounding mode [ToNearestEven].
 //
 // Operations always take pointer arguments (*Float) rather
 // than Float values, and each unique Float value requires
 // its own unique *Float pointer. To "copy" a Float value,
 // an existing (or newly allocated) Float must be set to
-// a new value using the Float.Set method; shallow copies
+// a new value using the [Float.Set] method; shallow copies
 // of Floats are not supported and may lead to errors.
 type Float struct {
        prec uint32
@@ -72,7 +72,7 @@ type Float struct {
        exp  int32
 }
 
-// An ErrNaN panic is raised by a Float operation that would lead to
+// An ErrNaN panic is raised by a [Float] operation that would lead to
 // a NaN under IEEE-754 rules. An ErrNaN implements the error interface.
 type ErrNaN struct {
        msg string
@@ -82,9 +82,9 @@ func (err ErrNaN) Error() string {
        return err.msg
 }
 
-// NewFloat allocates and returns a new Float set to x,
-// with precision 53 and rounding mode ToNearestEven.
-// NewFloat panics with ErrNaN if x is a NaN.
+// NewFloat allocates and returns a new [Float] set to x,
+// with precision 53 and rounding mode [ToNearestEven].
+// NewFloat panics with [ErrNaN] if x is a NaN.
 func NewFloat(x float64) *Float {
        if math.IsNaN(x) {
                panic(ErrNaN{"NewFloat(NaN)"})
@@ -126,9 +126,9 @@ const (
        inf
 )
 
-// RoundingMode determines how a Float value is rounded to the
-// desired precision. Rounding may change the Float value; the
-// rounding error is described by the Float's Accuracy.
+// RoundingMode determines how a [Float] value is rounded to the
+// desired precision. Rounding may change the [Float] value; the
+// rounding error is described by the [Float]'s [Accuracy].
 type RoundingMode byte
 
 // These constants define supported rounding modes.
@@ -144,10 +144,10 @@ const (
 //go:generate stringer -type=RoundingMode
 
 // Accuracy describes the rounding error produced by the most recent
-// operation that generated a Float value, relative to the exact value.
+// operation that generated a [Float] value, relative to the exact value.
 type Accuracy int8
 
-// Constants describing the Accuracy of a Float.
+// Constants describing the [Accuracy] of a [Float].
 const (
        Below Accuracy = -1
        Exact Accuracy = 0
@@ -160,7 +160,7 @@ const (
 // value of z. Rounding occurs according to z's rounding mode if the mantissa
 // cannot be represented in prec bits without loss of precision.
 // SetPrec(0) maps all finite values to ±0; infinite values remain unchanged.
-// If prec > MaxPrec, it is set to MaxPrec.
+// If prec > [MaxPrec], it is set to [MaxPrec].
 func (z *Float) SetPrec(prec uint) *Float {
        z.acc = Exact // optimistically assume no rounding is needed
 
@@ -196,7 +196,7 @@ func makeAcc(above bool) Accuracy {
 
 // SetMode sets z's rounding mode to mode and returns an exact z.
 // z remains unchanged otherwise.
-// z.SetMode(z.Mode()) is a cheap way to set z's accuracy to Exact.
+// z.SetMode(z.Mode()) is a cheap way to set z's accuracy to [Exact].
 func (z *Float) SetMode(mode RoundingMode) *Float {
        z.mode = mode
        z.acc = Exact
@@ -302,9 +302,9 @@ func (z *Float) setExpAndRound(exp int64, sbit uint) {
 
 // SetMantExp sets z to mant × 2**exp and returns z.
 // The result z has the same precision and rounding mode
-// as mant. SetMantExp is an inverse of MantExp but does
+// as mant. SetMantExp is an inverse of [Float.MantExp] but does
 // not require 0.5 <= |mant| < 1.0. Specifically, for a
-// given x of type *Float, SetMantExp relates to MantExp
+// given x of type *[Float], SetMantExp relates to [Float.MantExp]
 // as follows:
 //
 //     mant := new(Float)
@@ -548,7 +548,7 @@ func (z *Float) SetInt64(x int64) *Float {
 
 // SetFloat64 sets z to the (possibly rounded) value of x and returns z.
 // If z's precision is 0, it is changed to 53 (and rounding will have
-// no effect). SetFloat64 panics with ErrNaN if x is a NaN.
+// no effect). SetFloat64 panics with [ErrNaN] if x is a NaN.
 func (z *Float) SetFloat64(x float64) *Float {
        if z.prec == 0 {
                z.prec = 53
@@ -637,7 +637,7 @@ func (z *Float) SetRat(x *Rat) *Float {
 // SetInf sets z to the infinite Float -Inf if signbit is
 // set, or +Inf if signbit is not set, and returns z. The
 // precision of z is unchanged and the result is always
-// Exact.
+// [Exact].
 func (z *Float) SetInf(signbit bool) *Float {
        z.acc = Exact
        z.form = inf
@@ -734,10 +734,10 @@ func msb64(x nat) uint64 {
 }
 
 // Uint64 returns the unsigned integer resulting from truncating x
-// towards zero. If 0 <= x <= math.MaxUint64, the result is Exact
-// if x is an integer and Below otherwise.
-// The result is (0, Above) for x < 0, and (math.MaxUint64, Below)
-// for x > math.MaxUint64.
+// towards zero. If 0 <= x <= math.MaxUint64, the result is [Exact]
+// if x is an integer and [Below] otherwise.
+// The result is (0, [Above]) for x < 0, and ([math.MaxUint64], [Below])
+// for x > [math.MaxUint64].
 func (x *Float) Uint64() (uint64, Accuracy) {
        if debugFloat {
                x.validate()
@@ -779,10 +779,10 @@ func (x *Float) Uint64() (uint64, Accuracy) {
 }
 
 // Int64 returns the integer resulting from truncating x towards zero.
-// If math.MinInt64 <= x <= math.MaxInt64, the result is Exact if x is
-// an integer, and Above (x < 0) or Below (x > 0) otherwise.
-// The result is (math.MinInt64, Above) for x < math.MinInt64,
-// and (math.MaxInt64, Below) for x > math.MaxInt64.
+// If [math.MinInt64] <= x <= [math.MaxInt64], the result is [Exact] if x is
+// an integer, and [Above] (x < 0) or [Below] (x > 0) otherwise.
+// The result is ([math.MinInt64], [Above]) for x < [math.MinInt64],
+// and ([math.MaxInt64], [Below]) for x > [math.MaxInt64].
 func (x *Float) Int64() (int64, Accuracy) {
        if debugFloat {
                x.validate()
@@ -834,10 +834,10 @@ func (x *Float) Int64() (int64, Accuracy) {
 }
 
 // Float32 returns the float32 value nearest to x. If x is too small to be
-// represented by a float32 (|x| < math.SmallestNonzeroFloat32), the result
-// is (0, Below) or (-0, Above), respectively, depending on the sign of x.
-// If x is too large to be represented by a float32 (|x| > math.MaxFloat32),
-// the result is (+Inf, Above) or (-Inf, Below), depending on the sign of x.
+// represented by a float32 (|x| < [math.SmallestNonzeroFloat32]), the result
+// is (0, [Below]) or (-0, [Above]), respectively, depending on the sign of x.
+// If x is too large to be represented by a float32 (|x| > [math.MaxFloat32]),
+// the result is (+Inf, [Above]) or (-Inf, [Below]), depending on the sign of x.
 func (x *Float) Float32() (float32, Accuracy) {
        if debugFloat {
                x.validate()
@@ -954,10 +954,10 @@ func (x *Float) Float32() (float32, Accuracy) {
 }
 
 // Float64 returns the float64 value nearest to x. If x is too small to be
-// represented by a float64 (|x| < math.SmallestNonzeroFloat64), the result
-// is (0, Below) or (-0, Above), respectively, depending on the sign of x.
-// If x is too large to be represented by a float64 (|x| > math.MaxFloat64),
-// the result is (+Inf, Above) or (-Inf, Below), depending on the sign of x.
+// represented by a float64 (|x| < [math.SmallestNonzeroFloat64]), the result
+// is (0, [Below]) or (-0, [Above]), respectively, depending on the sign of x.
+// If x is too large to be represented by a float64 (|x| > [math.MaxFloat64]),
+// the result is (+Inf, [Above]) or (-Inf, [Below]), depending on the sign of x.
 func (x *Float) Float64() (float64, Accuracy) {
        if debugFloat {
                x.validate()
@@ -1075,10 +1075,10 @@ func (x *Float) Float64() (float64, Accuracy) {
 
 // Int returns the result of truncating x towards zero;
 // or nil if x is an infinity.
-// The result is Exact if x.IsInt(); otherwise it is Below
-// for x > 0, and Above for x < 0.
-// If a non-nil *Int argument z is provided, Int stores
-// the result in z instead of allocating a new Int.
+// The result is [Exact] if x.IsInt(); otherwise it is [Below]
+// for x > 0, and [Above] for x < 0.
+// If a non-nil *[Int] argument z is provided, [Int] stores
+// the result in z instead of allocating a new [Int].
 func (x *Float) Int(z *Int) (*Int, Accuracy) {
        if debugFloat {
                x.validate()
@@ -1132,9 +1132,9 @@ func (x *Float) Int(z *Int) (*Int, Accuracy) {
 
 // Rat returns the rational number corresponding to x;
 // or nil if x is an infinity.
-// The result is Exact if x is not an Inf.
-// If a non-nil *Rat argument z is provided, Rat stores
-// the result in z instead of allocating a new Rat.
+// The result is [Exact] if x is not an Inf.
+// If a non-nil *[Rat] argument z is provided, [Rat] stores
+// the result in z instead of allocating a new [Rat].
 func (x *Float) Rat(z *Rat) (*Rat, Accuracy) {
        if debugFloat {
                x.validate()
@@ -1444,7 +1444,7 @@ func (x *Float) ucmp(y *Float) int {
 // it is changed to the larger of x's or y's precision before the operation.
 // Rounding is performed according to z's precision and rounding mode; and
 // z's accuracy reports the result error relative to the exact (not rounded)
-// result. Add panics with ErrNaN if x and y are infinities with opposite
+// result. Add panics with [ErrNaN] if x and y are infinities with opposite
 // signs. The value of z is undefined in that case.
 func (z *Float) Add(x, y *Float) *Float {
        if debugFloat {
@@ -1517,8 +1517,8 @@ func (z *Float) Add(x, y *Float) *Float {
 }
 
 // Sub sets z to the rounded difference x-y and returns z.
-// Precision, rounding, and accuracy reporting are as for Add.
-// Sub panics with ErrNaN if x and y are infinities with equal
+// Precision, rounding, and accuracy reporting are as for [Float.Add].
+// Sub panics with [ErrNaN] if x and y are infinities with equal
 // signs. The value of z is undefined in that case.
 func (z *Float) Sub(x, y *Float) *Float {
        if debugFloat {
@@ -1584,8 +1584,8 @@ func (z *Float) Sub(x, y *Float) *Float {
 }
 
 // Mul sets z to the rounded product x*y and returns z.
-// Precision, rounding, and accuracy reporting are as for Add.
-// Mul panics with ErrNaN if one operand is zero and the other
+// Precision, rounding, and accuracy reporting are as for [Float.Add].
+// Mul panics with [ErrNaN] if one operand is zero and the other
 // operand an infinity. The value of z is undefined in that case.
 func (z *Float) Mul(x, y *Float) *Float {
        if debugFloat {
@@ -1629,8 +1629,8 @@ func (z *Float) Mul(x, y *Float) *Float {
 }
 
 // Quo sets z to the rounded quotient x/y and returns z.
-// Precision, rounding, and accuracy reporting are as for Add.
-// Quo panics with ErrNaN if both operands are zero or infinities.
+// Precision, rounding, and accuracy reporting are as for [Float.Add].
+// Quo panics with [ErrNaN] if both operands are zero or infinities.
 // The value of z is undefined in that case.
 func (z *Float) Quo(x, y *Float) *Float {
        if debugFloat {
index 6501185fbed3df6996fa830037f7eeb08059ffd4..d8c69b8b283e0baa876ad17a6fe2a4f9642074e5 100644 (file)
@@ -16,7 +16,7 @@ var floatZero Float
 
 // SetString sets z to the value of s and returns z and a boolean indicating
 // success. s must be a floating-point number of the same format as accepted
-// by Parse, with base argument 0. The entire string (not just a prefix) must
+// by [Float.Parse], with base argument 0. The entire string (not just a prefix) must
 // be valid for success. If the operation failed, the value of z is undefined
 // but the returned value is nil.
 func (z *Float) SetString(s string) (*Float, bool) {
@@ -290,9 +290,9 @@ func ParseFloat(s string, base int, prec uint, mode RoundingMode) (f *Float, b i
 
 var _ fmt.Scanner = (*Float)(nil) // *Float must implement fmt.Scanner
 
-// Scan is a support routine for fmt.Scanner; it sets z to the value of
+// Scan is a support routine for [fmt.Scanner]; it sets z to the value of
 // the scanned number. It accepts formats whose verbs are supported by
-// fmt.Scan for floating point values, which are:
+// [fmt.Scan] for floating point values, which are:
 // 'b' (binary), 'e', 'E', 'f', 'F', 'g' and 'G'.
 // Scan doesn't handle ±Inf.
 func (z *Float) Scan(s fmt.ScanState, ch rune) error {
index 2a78c69e34aaf8c9c0287198566d814dbcbe32f4..8a908cef28ab9f7a4bbb588cd45600f25cf1f059 100644 (file)
@@ -15,8 +15,8 @@ import (
 // Gob codec version. Permits backward-compatible changes to the encoding.
 const floatGobVersion byte = 1
 
-// GobEncode implements the gob.GobEncoder interface.
-// The Float value and all its attributes (precision,
+// GobEncode implements the [encoding/gob.GobEncoder] interface.
+// The [Float] value and all its attributes (precision,
 // rounding mode, accuracy) are marshaled.
 func (x *Float) GobEncode() ([]byte, error) {
        if x == nil {
@@ -58,7 +58,7 @@ func (x *Float) GobEncode() ([]byte, error) {
        return buf, nil
 }
 
-// GobDecode implements the gob.GobDecoder interface.
+// GobDecode implements the [encoding/gob.GobDecoder] interface.
 // The result is rounded per the precision and rounding mode of
 // z unless z's precision is 0, in which case z is set exactly
 // to the decoded value.
@@ -106,8 +106,8 @@ func (z *Float) GobDecode(buf []byte) error {
        return nil
 }
 
-// MarshalText implements the encoding.TextMarshaler interface.
-// Only the Float value is marshaled (in full precision), other
+// MarshalText implements the [encoding.TextMarshaler] interface.
+// Only the [Float] value is marshaled (in full precision), other
 // attributes such as precision or accuracy are ignored.
 func (x *Float) MarshalText() (text []byte, err error) {
        if x == nil {
@@ -117,7 +117,7 @@ func (x *Float) MarshalText() (text []byte, err error) {
        return x.Append(buf, 'g', -1), nil
 }
 
-// UnmarshalText implements the encoding.TextUnmarshaler interface.
+// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
 // The result is rounded per the precision and rounding mode of z.
 // If z's precision is 0, it is changed to 64 before rounding takes
 // effect.
index 6daea344964f4014787d6f3607ad2e014f3605ed..f7a4345d3acf98821a6071b9c54d025ba54d3a5a 100644 (file)
@@ -53,7 +53,7 @@ func (x *Float) Text(format byte, prec int) string {
 }
 
 // String formats x like x.Text('g', 10).
-// (String must be called explicitly, Float.Format does not support %s verb.)
+// (String must be called explicitly, [Float.Format] does not support %s verb.)
 func (x *Float) String() string {
        return x.Text('g', 10)
 }
@@ -446,7 +446,7 @@ func (x *Float) fmtP(buf []byte) []byte {
 
 var _ fmt.Formatter = &floatZero // *Float must implement fmt.Formatter
 
-// Format implements fmt.Formatter. It accepts all the regular
+// Format implements [fmt.Formatter]. It accepts all the regular
 // formats for floating-point numbers ('b', 'e', 'E', 'f', 'F',
 // 'g', 'G', 'x') as well as 'p' and 'v'. See (*Float).Text for the
 // interpretation of 'p'. The 'v' format is handled like 'g'.
index 2cc3d7b4414792acf207941e0945c8efed37f85e..b79b4592709f9704ab314a07f0361a3f338f5eaa 100644 (file)
@@ -20,7 +20,7 @@ import (
 // than Int values, and each unique Int value requires
 // its own unique *Int pointer. To "copy" an Int value,
 // an existing (or newly allocated) Int must be set to
-// a new value using the Int.Set method; shallow copies
+// a new value using the [Int.Set] method; shallow copies
 // of Ints are not supported and may lead to errors.
 //
 // Note that methods may leak the Int's value through timing side-channels.
@@ -74,7 +74,7 @@ func (z *Int) SetUint64(x uint64) *Int {
        return z
 }
 
-// NewInt allocates and returns a new Int set to x.
+// NewInt allocates and returns a new [Int] set to x.
 func NewInt(x int64) *Int {
        // This code is arranged to be inlineable and produce
        // zero allocations when inlined. See issue 29951.
@@ -102,9 +102,9 @@ func (z *Int) Set(x *Int) *Int {
 }
 
 // Bits provides raw (unchecked but fast) access to x by returning its
-// absolute value as a little-endian Word slice. The result and x share
+// absolute value as a little-endian [Word] slice. The result and x share
 // the same underlying array.
-// Bits is intended to support implementation of missing low-level Int
+// Bits is intended to support implementation of missing low-level [Int]
 // functionality outside this package; it should be avoided otherwise.
 func (x *Int) Bits() []Word {
        // This function is used in cryptographic operations. It must not leak
@@ -114,9 +114,9 @@ func (x *Int) Bits() []Word {
 }
 
 // SetBits provides raw (unchecked but fast) access to z by setting its
-// value to abs, interpreted as a little-endian Word slice, and returning
+// value to abs, interpreted as a little-endian [Word] slice, and returning
 // z. The result and abs share the same underlying array.
-// SetBits is intended to support implementation of missing low-level Int
+// SetBits is intended to support implementation of missing low-level [Int]
 // functionality outside this package; it should be avoided otherwise.
 func (z *Int) SetBits(abs []Word) *Int {
        z.abs = nat(abs).norm()
@@ -263,7 +263,7 @@ func (z *Int) Binomial(n, k int64) *Int {
 
 // Quo sets z to the quotient x/y for y != 0 and returns z.
 // If y == 0, a division-by-zero run-time panic occurs.
-// Quo implements truncated division (like Go); see QuoRem for more details.
+// Quo implements truncated division (like Go); see [Int.QuoRem] for more details.
 func (z *Int) Quo(x, y *Int) *Int {
        z.abs, _ = z.abs.div(nil, x.abs, y.abs)
        z.neg = len(z.abs) > 0 && x.neg != y.neg // 0 has no sign
@@ -272,7 +272,7 @@ func (z *Int) Quo(x, y *Int) *Int {
 
 // Rem sets z to the remainder x%y for y != 0 and returns z.
 // If y == 0, a division-by-zero run-time panic occurs.
-// Rem implements truncated modulus (like Go); see QuoRem for more details.
+// Rem implements truncated modulus (like Go); see [Int.QuoRem] for more details.
 func (z *Int) Rem(x, y *Int) *Int {
        _, z.abs = nat(nil).div(z.abs, x.abs, y.abs)
        z.neg = len(z.abs) > 0 && x.neg // 0 has no sign
@@ -298,7 +298,7 @@ func (z *Int) QuoRem(x, y, r *Int) (*Int, *Int) {
 
 // Div sets z to the quotient x/y for y != 0 and returns z.
 // If y == 0, a division-by-zero run-time panic occurs.
-// Div implements Euclidean division (unlike Go); see DivMod for more details.
+// Div implements Euclidean division (unlike Go); see [Int.DivMod] for more details.
 func (z *Int) Div(x, y *Int) *Int {
        y_neg := y.neg // z may be an alias for y
        var r Int
@@ -315,7 +315,7 @@ func (z *Int) Div(x, y *Int) *Int {
 
 // Mod sets z to the modulus x%y for y != 0 and returns z.
 // If y == 0, a division-by-zero run-time panic occurs.
-// Mod implements Euclidean modulus (unlike Go); see DivMod for more details.
+// Mod implements Euclidean modulus (unlike Go); see [Int.DivMod] for more details.
 func (z *Int) Mod(x, y *Int) *Int {
        y0 := y // save y
        if z == y || alias(z.abs, y.abs) {
@@ -346,7 +346,7 @@ func (z *Int) Mod(x, y *Int) *Int {
 // div and mod”. ACM Transactions on Programming Languages and
 // Systems (TOPLAS), 14(2):127-144, New York, NY, USA, 4/1992.
 // ACM press.)
-// See QuoRem for T-division and modulus (like Go).
+// See [Int.QuoRem] for T-division and modulus (like Go).
 func (z *Int) DivMod(x, y, m *Int) (*Int, *Int) {
        y0 := y // save y
        if z == y || alias(z.abs, y.abs) {
@@ -475,7 +475,7 @@ func (x *Int) Float64() (float64, Accuracy) {
 // (not just a prefix) must be valid for success. If SetString fails,
 // the value of z is undefined but the returned value is nil.
 //
-// The base argument must be 0 or a value between 2 and MaxBase.
+// The base argument must be 0 or a value between 2 and [MaxBase].
 // For base 0, the number prefix determines the actual base: A prefix of
 // “0b” or “0B” selects base 2, “0”, “0o” or “0O” selects base 8,
 // and “0x” or “0X” selects base 16. Otherwise, the selected base is 10
@@ -519,7 +519,7 @@ func (z *Int) SetBytes(buf []byte) *Int {
 
 // Bytes returns the absolute value of x as a big-endian byte slice.
 //
-// To use a fixed length slice, or a preallocated one, use FillBytes.
+// To use a fixed length slice, or a preallocated one, use [Int.FillBytes].
 func (x *Int) Bytes() []byte {
        // This function is used in cryptographic operations. It must not leak
        // anything but the Int's sign and bit size through side-channels. Any
@@ -881,8 +881,8 @@ func (z *Int) lehmerGCD(x, y, a, b *Int) *Int {
 
 // Rand sets z to a pseudo-random number in [0, n) and returns z.
 //
-// As this uses the math/rand package, it must not be used for
-// security-sensitive work. Use crypto/rand.Int instead.
+// As this uses the [math/rand] package, it must not be used for
+// security-sensitive work. Use [crypto/rand.Int] instead.
 func (z *Int) Rand(rnd *rand.Rand, n *Int) *Int {
        // z.neg is not modified before the if check, because z and n might alias.
        if n.neg || len(n.abs) == 0 {
index 04e8c24ed52c98e6b58aa52da2c7bbf6e54a4d75..51e75ffc52b6f40c73cc3e87c4c055619b128e41 100644 (file)
@@ -52,7 +52,7 @@ func writeMultiple(s fmt.State, text string, count int) {
 
 var _ fmt.Formatter = intOne // *Int must implement fmt.Formatter
 
-// Format implements fmt.Formatter. It accepts the formats
+// Format implements [fmt.Formatter]. It accepts the formats
 // 'b' (binary), 'o' (octal with 0 prefix), 'O' (octal with 0o prefix),
 // 'd' (decimal), 'x' (lowercase hexadecimal), and
 // 'X' (uppercase hexadecimal).
@@ -230,7 +230,7 @@ func (r byteReader) UnreadByte() error {
 
 var _ fmt.Scanner = intOne // *Int must implement fmt.Scanner
 
-// Scan is a support routine for fmt.Scanner; it sets z to the value of
+// Scan is a support routine for [fmt.Scanner]; it sets z to the value of
 // the scanned number. It accepts the formats 'b' (binary), 'o' (octal),
 // 'd' (decimal), 'x' (lowercase hexadecimal), and 'X' (uppercase hexadecimal).
 func (z *Int) Scan(s fmt.ScanState, ch rune) error {
index ce429ffc11e71d226609492009204c0f4eb29f15..56eeefb884d8c26f77509b2f8898c3f45f574365 100644 (file)
@@ -14,7 +14,7 @@ import (
 // Gob codec version. Permits backward-compatible changes to the encoding.
 const intGobVersion byte = 1
 
-// GobEncode implements the gob.GobEncoder interface.
+// GobEncode implements the [encoding/gob.GobEncoder] interface.
 func (x *Int) GobEncode() ([]byte, error) {
        if x == nil {
                return nil, nil
@@ -29,7 +29,7 @@ func (x *Int) GobEncode() ([]byte, error) {
        return buf[i:], nil
 }
 
-// GobDecode implements the gob.GobDecoder interface.
+// GobDecode implements the [encoding/gob.GobDecoder] interface.
 func (z *Int) GobDecode(buf []byte) error {
        if len(buf) == 0 {
                // Other side sent a nil or default value.
@@ -45,7 +45,7 @@ func (z *Int) GobDecode(buf []byte) error {
        return nil
 }
 
-// MarshalText implements the encoding.TextMarshaler interface.
+// MarshalText implements the [encoding.TextMarshaler] interface.
 func (x *Int) MarshalText() (text []byte, err error) {
        if x == nil {
                return []byte("<nil>"), nil
@@ -53,7 +53,7 @@ func (x *Int) MarshalText() (text []byte, err error) {
        return x.abs.itoa(x.neg, 10), nil
 }
 
-// UnmarshalText implements the encoding.TextUnmarshaler interface.
+// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
 func (z *Int) UnmarshalText(text []byte) error {
        if _, ok := z.setFromScanner(bytes.NewReader(text), 0); !ok {
                return fmt.Errorf("math/big: cannot unmarshal %q into a *big.Int", text)
@@ -65,7 +65,7 @@ func (z *Int) UnmarshalText(text []byte) error {
 // (programs that explicitly look for these two methods). JSON works
 // fine with the TextMarshaler only.
 
-// MarshalJSON implements the json.Marshaler interface.
+// MarshalJSON implements the [encoding/json.Marshaler] interface.
 func (x *Int) MarshalJSON() ([]byte, error) {
        if x == nil {
                return []byte("null"), nil
@@ -73,7 +73,7 @@ func (x *Int) MarshalJSON() ([]byte, error) {
        return x.abs.itoa(x.neg, 10), nil
 }
 
-// UnmarshalJSON implements the json.Unmarshaler interface.
+// UnmarshalJSON implements the [encoding/json.Unmarshaler] interface.
 func (z *Int) UnmarshalJSON(text []byte) error {
        // Ignore null, like in the main JSON package.
        if string(text) == "null" {
index 700a6432659c40b459cfbeed71e998ac45a46fa8..cb32b783a1b032f44fdedf06cfa5a005827fcc3f 100644 (file)
@@ -18,7 +18,7 @@ import (
 // than Rat values, and each unique Rat value requires
 // its own unique *Rat pointer. To "copy" a Rat value,
 // an existing (or newly allocated) Rat must be set to
-// a new value using the Rat.Set method; shallow copies
+// a new value using the [Rat.Set] method; shallow copies
 // of Rats are not supported and may lead to errors.
 type Rat struct {
        // To make zero values for Rat work w/o initialization,
@@ -29,7 +29,7 @@ type Rat struct {
        a, b Int
 }
 
-// NewRat creates a new Rat with numerator a and denominator b.
+// NewRat creates a new [Rat] with numerator a and denominator b.
 func NewRat(a, b int64) *Rat {
        return new(Rat).SetFrac64(a, b)
 }
@@ -411,8 +411,8 @@ func (x *Rat) Num() *Int {
 
 // Denom returns the denominator of x; it is always > 0.
 // The result is a reference to x's denominator, unless
-// x is an uninitialized (zero value) Rat, in which case
-// the result is a new Int of value 1. (To initialize x,
+// x is an uninitialized (zero value) [Rat], in which case
+// the result is a new [Int] of value 1. (To initialize x,
 // any operation that sets x will do, including x.Set(x).)
 // If the result is a reference to x's denominator it
 // may change if a new value is assigned to x, and vice versa.
index b69c59dfb6a1c8869318b305290546f19a8e1342..033fb4459df8a74bcd93fbaa3ed7d586444973ad 100644 (file)
@@ -16,7 +16,7 @@ import (
 // Gob codec version. Permits backward-compatible changes to the encoding.
 const ratGobVersion byte = 1
 
-// GobEncode implements the gob.GobEncoder interface.
+// GobEncode implements the [encoding/gob.GobEncoder] interface.
 func (x *Rat) GobEncode() ([]byte, error) {
        if x == nil {
                return nil, nil
@@ -39,7 +39,7 @@ func (x *Rat) GobEncode() ([]byte, error) {
        return buf[j:], nil
 }
 
-// GobDecode implements the gob.GobDecoder interface.
+// GobDecode implements the [encoding/gob.GobDecoder] interface.
 func (z *Rat) GobDecode(buf []byte) error {
        if len(buf) == 0 {
                // Other side sent a nil or default value.
@@ -68,7 +68,7 @@ func (z *Rat) GobDecode(buf []byte) error {
        return nil
 }
 
-// MarshalText implements the encoding.TextMarshaler interface.
+// MarshalText implements the [encoding.TextMarshaler] interface.
 func (x *Rat) MarshalText() (text []byte, err error) {
        if x.IsInt() {
                return x.a.MarshalText()
@@ -76,7 +76,7 @@ func (x *Rat) MarshalText() (text []byte, err error) {
        return x.marshal(), nil
 }
 
-// UnmarshalText implements the encoding.TextUnmarshaler interface.
+// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
 func (z *Rat) UnmarshalText(text []byte) error {
        // TODO(gri): get rid of the []byte/string conversion
        if _, ok := z.SetString(string(text)); !ok {
index c1c7b7978aceae3bb54b0633caf8c693bec58c73..235d63e85bc53d3e14c46d6c07f8fa647c35aadd 100644 (file)
@@ -21,7 +21,7 @@ const UintSize = uintSize
 
 // --- LeadingZeros ---
 
-// LeadingZeros returns the number of leading zero bits in x; the result is UintSize for x == 0.
+// LeadingZeros returns the number of leading zero bits in x; the result is [UintSize] for x == 0.
 func LeadingZeros(x uint) int { return UintSize - Len(x) }
 
 // LeadingZeros8 returns the number of leading zero bits in x; the result is 8 for x == 0.
@@ -55,7 +55,7 @@ var deBruijn64tab = [64]byte{
        54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6,
 }
 
-// TrailingZeros returns the number of trailing zero bits in x; the result is UintSize for x == 0.
+// TrailingZeros returns the number of trailing zero bits in x; the result is [UintSize] for x == 0.
 func TrailingZeros(x uint) int {
        if UintSize == 32 {
                return TrailingZeros32(uint32(x))
@@ -169,7 +169,7 @@ func OnesCount64(x uint64) int {
 
 // --- RotateLeft ---
 
-// RotateLeft returns the value of x rotated left by (k mod UintSize) bits.
+// RotateLeft returns the value of x rotated left by (k mod [UintSize]) bits.
 // To rotate x right by k bits, call RotateLeft(x, -k).
 //
 // This function's execution time does not depend on the inputs.
@@ -578,14 +578,14 @@ func Rem(hi, lo, y uint) uint {
 }
 
 // Rem32 returns the remainder of (hi, lo) divided by y. Rem32 panics
-// for y == 0 (division by zero) but, unlike Div32, it doesn't panic
+// for y == 0 (division by zero) but, unlike [Div32], it doesn't panic
 // on a quotient overflow.
 func Rem32(hi, lo, y uint32) uint32 {
        return uint32((uint64(hi)<<32 | uint64(lo)) % uint64(y))
 }
 
 // Rem64 returns the remainder of (hi, lo) divided by y. Rem64 panics
-// for y == 0 (division by zero) but, unlike Div64, it doesn't panic
+// for y == 0 (division by zero) but, unlike [Div64], it doesn't panic
 // on a quotient overflow.
 func Rem64(hi, lo, y uint64) uint64 {
        // We scale down hi so that hi < y, then use Div64 to compute the
index 666bba28c5b5991218129ee93caf5f6fa0223afe..434f80f4cb18d480f072be78c55d381f2a7b168d 100644 (file)
@@ -43,7 +43,7 @@ import "math"
 //    IEEE      -10,+10     30000       9.4e-15     1.5e-15
 
 // Pow returns x**y, the base-x exponential of y.
-// For generalized compatibility with math.Pow:
+// For generalized compatibility with [math.Pow]:
 //
 //     Pow(0, ±0) returns 1+0i
 //     Pow(0, c) for real(c)<0 returns Inf+0i if imag(c) is zero, otherwise Inf+Inf i.
index eed0feb42ddeec3f13a966bd622bd028a121a335..8e630f9736810e13cd32f8701fa38efb5cac3269 100644 (file)
@@ -116,7 +116,7 @@ func Erfinv(x float64) float64 {
        return ans
 }
 
-// Erfcinv returns the inverse of Erfc(x).
+// Erfcinv returns the inverse of [Erfc](x).
 //
 // Special cases are:
 //
index 760795f46feef5321745a292bf179ee969217cde..050e0ee9d88239988c36d20fc043820c627a5bac 100644 (file)
@@ -138,7 +138,7 @@ func exp(x float64) float64 {
 
 // Exp2 returns 2**x, the base-2 exponential of x.
 //
-// Special cases are the same as Exp.
+// Special cases are the same as [Exp].
 func Exp2(x float64) float64 {
        if haveArchExp2 {
                return archExp2(x)
index ff1c82f524143b2b1991e5b930c87c8fb10b66e4..f8e45d9becf2be550498dd58d2b3efb56cfd107d 100644 (file)
@@ -114,7 +114,7 @@ package math
 //
 
 // Expm1 returns e**x - 1, the base-e exponential of x minus 1.
-// It is more accurate than Exp(x) - 1 when x is near zero.
+// It is more accurate than [Exp](x) - 1 when x is near zero.
 //
 // Special cases are:
 //
index 6ae70c1333f335410613777eac3f704b2d1e92a7..03c3602acfe2851ff068ab08ec247116dab0e756 100644 (file)
@@ -8,7 +8,7 @@ package math
        Hypot -- sqrt(p*p + q*q), but overflows only if the result does.
 */
 
-// Hypot returns Sqrt(p*p + q*q), taking care to avoid
+// Hypot returns [Sqrt](p*p + q*q), taking care to avoid
 // unnecessary overflow and underflow.
 //
 // Special cases are:
index df365c0b1ac3ab90fdf832f59372d5442273033f..fad099dfa26e6f18aad278766f159d2130384b5c 100644 (file)
@@ -4,7 +4,7 @@
 
 package math
 
-// Ldexp is the inverse of Frexp.
+// Ldexp is the inverse of [Frexp].
 // It returns frac × 2**exp.
 //
 // Special cases are:
index 4058ad6631eb2c500ca7ed19e7c7330049a2cbdb..5a7ea2a58c7cf0a918b78938369090b2d518591f 100644 (file)
@@ -163,7 +163,7 @@ var _lgamW = [...]float64{
        -1.63092934096575273989e-03, // 0xBF5AB89D0B9E43E4
 }
 
-// Lgamma returns the natural logarithm and sign (-1 or +1) of Gamma(x).
+// Lgamma returns the natural logarithm and sign (-1 or +1) of [Gamma](x).
 //
 // Special cases are:
 //
index e6916a53b60436dd80f18d33eb2749d0613c0686..02c3a757c012be60ff3654fe063364390b8b947a 100644 (file)
@@ -5,7 +5,7 @@
 package math
 
 // Log10 returns the decimal logarithm of x.
-// The special cases are the same as for Log.
+// The special cases are the same as for [Log].
 func Log10(x float64) float64 {
        if haveArchLog10 {
                return archLog10(x)
@@ -18,7 +18,7 @@ func log10(x float64) float64 {
 }
 
 // Log2 returns the binary logarithm of x.
-// The special cases are the same as for Log.
+// The special cases are the same as for [Log].
 func Log2(x float64) float64 {
        if haveArchLog2 {
                return archLog2(x)
index 3a7b3854a81038cd906be18e439b17679e096289..bfcb813be8ceeccd197e374fdfb2595cc41346fe 100644 (file)
@@ -84,7 +84,7 @@ package math
 //       See HP-15C Advanced Functions Handbook, p.193.
 
 // Log1p returns the natural logarithm of 1 plus its argument x.
-// It is more accurate than Log(1 + x) when x is near zero.
+// It is more accurate than [Log](1 + x) when x is near zero.
 //
 // Special cases are:
 //
index c1162c19b68809520907ac1d0e49155a124c2179..55d7d7de8ac5d641e38a467887d302199bc08a19 100644 (file)
@@ -21,7 +21,7 @@ const (
 )
 
 // ExpFloat64 returns an exponentially distributed float64 in the range
-// (0, +math.MaxFloat64] with an exponential distribution whose rate parameter
+// (0, +[math.MaxFloat64]] with an exponential distribution whose rate parameter
 // (lambda) is 1 and whose mean is 1/lambda (1).
 // To produce a distribution with a different rate parameter,
 // callers can adjust the output using:
index 6654479a0052cbebff06ca2108147c5f01f49a74..4d441d4505dbbb062d86125de1e8aa7506e85f44 100644 (file)
@@ -28,7 +28,7 @@ func absInt32(i int32) uint32 {
 }
 
 // NormFloat64 returns a normally distributed float64 in
-// the range -math.MaxFloat64 through +math.MaxFloat64 inclusive,
+// the range -[math.MaxFloat64] through +[math.MaxFloat64] inclusive,
 // with standard normal distribution (mean = 0, stddev = 1).
 // To produce a different normal distribution, callers can
 // adjust the output using:
index cc1f95c88d5a0fecf6b7f30476573cfe0c265502..78e176e78fa5ea5d6a4f0d11dc2b9cba0294de48 100644 (file)
@@ -33,10 +33,10 @@ type Source interface {
        Seed(seed int64)
 }
 
-// A Source64 is a Source that can also generate
+// A Source64 is a [Source] that can also generate
 // uniformly-distributed pseudo-random uint64 values in
 // the range [0, 1<<64) directly.
-// If a Rand r's underlying Source s implements Source64,
+// If a [Rand] r's underlying [Source] s implements Source64,
 // then r.Uint64 returns the result of one call to s.Uint64
 // instead of making two calls to s.Int63.
 type Source64 interface {
@@ -44,10 +44,10 @@ type Source64 interface {
        Uint64() uint64
 }
 
-// NewSource returns a new pseudo-random Source seeded with the given value.
-// Unlike the default Source used by top-level functions, this source is not
+// NewSource returns a new pseudo-random [Source] seeded with the given value.
+// Unlike the default [Source] used by top-level functions, this source is not
 // safe for concurrent use by multiple goroutines.
-// The returned Source implements Source64.
+// The returned [Source] implements [Source64].
 func NewSource(seed int64) Source {
        return newSource(seed)
 }
@@ -73,7 +73,7 @@ type Rand struct {
        readPos int8
 }
 
-// New returns a new Rand that uses random values from src
+// New returns a new [Rand] that uses random values from src
 // to generate other random values.
 func New(src Source) *Rand {
        s64, _ := src.(Source64)
@@ -81,7 +81,7 @@ func New(src Source) *Rand {
 }
 
 // Seed uses the provided seed value to initialize the generator to a deterministic state.
-// Seed should not be called concurrently with any other Rand method.
+// Seed should not be called concurrently with any other [Rand] method.
 func (r *Rand) Seed(seed int64) {
        if lk, ok := r.src.(*lockedSource); ok {
                lk.seedPos(seed, &r.readPos)
@@ -378,7 +378,7 @@ func (fs *fastSource) read(p []byte, readVal *int64, readPos *int8) (n int, err
 // Seed uses the provided seed value to initialize the default Source to a
 // deterministic state. Seed values that have the same remainder when
 // divided by 2³¹-1 generate the same pseudo-random sequence.
-// Seed, unlike the Rand.Seed method, is safe for concurrent use.
+// Seed, unlike the [Rand.Seed] method, is safe for concurrent use.
 //
 // If Seed is not called, the generator is seeded randomly at program startup.
 //
@@ -419,67 +419,67 @@ func Seed(seed int64) {
 }
 
 // Int63 returns a non-negative pseudo-random 63-bit integer as an int64
-// from the default Source.
+// from the default [Source].
 func Int63() int64 { return globalRand().Int63() }
 
 // Uint32 returns a pseudo-random 32-bit value as a uint32
-// from the default Source.
+// from the default [Source].
 func Uint32() uint32 { return globalRand().Uint32() }
 
 // Uint64 returns a pseudo-random 64-bit value as a uint64
-// from the default Source.
+// from the default [Source].
 func Uint64() uint64 { return globalRand().Uint64() }
 
 // Int31 returns a non-negative pseudo-random 31-bit integer as an int32
-// from the default Source.
+// from the default [Source].
 func Int31() int32 { return globalRand().Int31() }
 
-// Int returns a non-negative pseudo-random int from the default Source.
+// Int returns a non-negative pseudo-random int from the default [Source].
 func Int() int { return globalRand().Int() }
 
 // Int63n returns, as an int64, a non-negative pseudo-random number in the half-open interval [0,n)
-// from the default Source.
+// from the default [Source].
 // It panics if n <= 0.
 func Int63n(n int64) int64 { return globalRand().Int63n(n) }
 
 // Int31n returns, as an int32, a non-negative pseudo-random number in the half-open interval [0,n)
-// from the default Source.
+// from the default [Source].
 // It panics if n <= 0.
 func Int31n(n int32) int32 { return globalRand().Int31n(n) }
 
 // Intn returns, as an int, a non-negative pseudo-random number in the half-open interval [0,n)
-// from the default Source.
+// from the default [Source].
 // It panics if n <= 0.
 func Intn(n int) int { return globalRand().Intn(n) }
 
 // Float64 returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0)
-// from the default Source.
+// from the default [Source].
 func Float64() float64 { return globalRand().Float64() }
 
 // Float32 returns, as a float32, a pseudo-random number in the half-open interval [0.0,1.0)
-// from the default Source.
+// from the default [Source].
 func Float32() float32 { return globalRand().Float32() }
 
 // Perm returns, as a slice of n ints, a pseudo-random permutation of the integers
-// in the half-open interval [0,n) from the default Source.
+// in the half-open interval [0,n) from the default [Source].
 func Perm(n int) []int { return globalRand().Perm(n) }
 
-// Shuffle pseudo-randomizes the order of elements using the default Source.
+// Shuffle pseudo-randomizes the order of elements using the default [Source].
 // n is the number of elements. Shuffle panics if n < 0.
 // swap swaps the elements with indexes i and j.
 func Shuffle(n int, swap func(i, j int)) { globalRand().Shuffle(n, swap) }
 
-// Read generates len(p) random bytes from the default Source and
+// Read generates len(p) random bytes from the default [Source] and
 // writes them into p. It always returns len(p) and a nil error.
-// Read, unlike the Rand.Read method, is safe for concurrent use.
+// Read, unlike the [Rand.Read] method, is safe for concurrent use.
 //
-// Deprecated: For almost all use cases, crypto/rand.Read is more appropriate.
+// Deprecated: For almost all use cases, [crypto/rand.Read] is more appropriate.
 func Read(p []byte) (n int, err error) { return globalRand().Read(p) }
 
 // NormFloat64 returns a normally distributed float64 in the range
-// [-math.MaxFloat64, +math.MaxFloat64] with
+// [-[math.MaxFloat64], +[math.MaxFloat64]] with
 // standard normal distribution (mean = 0, stddev = 1)
-// from the default Source.
+// from the default [Source].
 // To produce a different normal distribution, callers can
 // adjust the output using:
 //
@@ -487,8 +487,8 @@ func Read(p []byte) (n int, err error) { return globalRand().Read(p) }
 func NormFloat64() float64 { return globalRand().NormFloat64() }
 
 // ExpFloat64 returns an exponentially distributed float64 in the range
-// (0, +math.MaxFloat64] with an exponential distribution whose rate parameter
-// (lambda) is 1 and whose mean is 1/lambda (1) from the default Source.
+// (0, +[math.MaxFloat64]] with an exponential distribution whose rate parameter
+// (lambda) is 1 and whose mean is 1/lambda (1) from the default [Source].
 // To produce a distribution with a different rate parameter,
 // callers can adjust the output using:
 //
index f04c814eb751ffe36ed259c98cf9e461d8ed7168..83c8e336491a2e294233735f012348cca349cba4 100644 (file)
@@ -32,7 +32,7 @@ func (z *Zipf) hinv(x float64) float64 {
        return math.Exp(z.oneminusQinv*math.Log(z.oneminusQ*x)) - z.v
 }
 
-// NewZipf returns a Zipf variate generator.
+// NewZipf returns a [Zipf] variate generator.
 // The generator generates values k ∈ [0, imax]
 // such that P(k) is proportional to (v + k) ** (-s).
 // Requirements: s > 1 and v >= 1.
@@ -53,8 +53,8 @@ func NewZipf(r *Rand, s float64, v float64, imax uint64) *Zipf {
        return z
 }
 
-// Uint64 returns a value drawn from the Zipf distribution described
-// by the Zipf object.
+// Uint64 returns a value drawn from the [Zipf] distribution described
+// by the [Zipf] object.
 func (z *Zipf) Uint64() uint64 {
        if z == nil {
                panic("rand: nil Zipf")