File tree 3 files changed +21
-1
lines changed 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ const debugFloat = false // enable for debugging
43
43
// precision of the argument with the largest precision value before any
44
44
// rounding takes place, and the rounding mode remains unchanged. Thus,
45
45
// uninitialized Floats provided as result arguments will have their
46
- // precision set to a reasonable value determined by the operands and
46
+ // precision set to a reasonable value determined by the operands, and
47
47
// their mode is the zero value for RoundingMode (ToNearestEven).
48
48
//
49
49
// By setting the desired precision to 24 or 53 and using matching rounding
@@ -56,6 +56,12 @@ const debugFloat = false // enable for debugging
56
56
// The zero (uninitialized) value for a Float is ready to use and represents
57
57
// the number +0.0 exactly, with precision 0 and rounding mode ToNearestEven.
58
58
//
59
+ // Operations always take pointer arguments (*Float) rather
60
+ // than Float values, and each unique Float value requires
61
+ // its own unique *Float pointer. To "copy" a Float value,
62
+ // an existing (or newly allocated) Float must be set to
63
+ // a new value using the Float.Set method; shallow copies
64
+ // of Floats are not supported and may lead to errors.
59
65
type Float struct {
60
66
prec uint32
61
67
mode RoundingMode
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ import (
15
15
16
16
// An Int represents a signed multi-precision integer.
17
17
// The zero value for an Int represents the value 0.
18
+ //
19
+ // Operations always take pointer arguments (*Int) rather
20
+ // than Int values, and each unique Int value requires
21
+ // its own unique *Int pointer. To "copy" an Int value,
22
+ // an existing (or newly allocated) Int must be set to
23
+ // a new value using the Int.Set method; shallow copies
24
+ // of Ints are not supported and may lead to errors.
18
25
type Int struct {
19
26
neg bool // sign
20
27
abs nat // absolute value of the integer
Original file line number Diff line number Diff line change @@ -13,6 +13,13 @@ import (
13
13
14
14
// A Rat represents a quotient a/b of arbitrary precision.
15
15
// The zero value for a Rat represents the value 0.
16
+ //
17
+ // Operations always take pointer arguments (*Rat) rather
18
+ // than Rat values, and each unique Rat value requires
19
+ // its own unique *Rat pointer. To "copy" a Rat value,
20
+ // an existing (or newly allocated) Rat must be set to
21
+ // a new value using the Rat.Set method; shallow copies
22
+ // of Rats are not supported and may lead to errors.
16
23
type Rat struct {
17
24
// To make zero values for Rat work w/o initialization,
18
25
// a zero value of b (len(b) == 0) acts like b == 1.
You can’t perform that action at this time.
0 commit comments