]> Cypherpunks.ru repositories - gostls13.git/commitdiff
math/big: rename Int.ToFloat64 to Float64
authorAlan Donovan <adonovan@google.com>
Thu, 1 Jun 2023 22:29:57 +0000 (18:29 -0400)
committerAlan Donovan <adonovan@google.com>
Fri, 2 Jun 2023 14:22:24 +0000 (14:22 +0000)
The "To" prefix was a relic of the first draft
that I failed to make consistent with the unprefixed
name used in the proposal. Fortunately iant spotted
it during the API audit.

Updates #56984
Updates #60560

Change-Id: Ifa6eeddf6dd5f0637c0568e383f9a4bef88b10f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/500116
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>

api/go1.21.txt
doc/go1.21.html
src/math/big/int.go
src/math/big/int_test.go

index b7967cd700de762fddc03d3763871a7aa3c38f78..ec11adf4b741ac67518165d8e6eda55343c64014 100644 (file)
@@ -345,7 +345,7 @@ pkg maps, func Equal[$0 interface{ ~map[$2]$3 }, $1 interface{ ~map[$2]$3 }, $2
 pkg maps, func EqualFunc[$0 interface{ ~map[$2]$3 }, $1 interface{ ~map[$2]$4 }, $2 comparable, $3 interface{}, $4 interface{}]($0, $1, func($3, $4) bool) bool #57436
 pkg maps, func Keys[$0 interface{ ~map[$1]$2 }, $1 comparable, $2 interface{}]($0) []$1 #57436
 pkg maps, func Values[$0 interface{ ~map[$1]$2 }, $1 comparable, $2 interface{}]($0) []$2 #57436
-pkg math/big, method (*Int) ToFloat64() (float64, Accuracy) #56984
+pkg math/big, method (*Int) Float64() (float64, Accuracy) #56984
 pkg net/http, method (*ProtocolError) Is(error) bool #41198
 pkg net/http, method (*ResponseController) EnableFullDuplex() error #57786
 pkg net/http, var ErrSchemeMismatch error #44855
index d15cff65d458aaec72d912d4e4956842e9250af0..8e9b170882934bcd887d2ba8da7af0e96afc9efd 100644 (file)
@@ -662,7 +662,7 @@ Do not send CLs removing the interior tags from such phrases.
 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
   <dd>
     <p><!-- https://go.dev/issue/56984, CL 453115 -->
-      The new <a href="/pkg/math/big/#Int.ToFloat64"><code>Int.ToFloat64</code></a>
+      The new <a href="/pkg/math/big/#Int.Float64"><code>Int.Float64</code></a>
       method returns the nearest floating-point value to a
       multi-precision integer, along with an indication of any
       rounding that occurred.
index c9788beebd53a9dc49f44863da1904bd163c7096..2cc3d7b4414792acf207941e0945c8efed37f85e 100644 (file)
@@ -450,9 +450,9 @@ func (x *Int) IsUint64() bool {
        return !x.neg && len(x.abs) <= 64/_W
 }
 
-// ToFloat64 returns the float64 value nearest x,
+// Float64 returns the float64 value nearest x,
 // and an indication of any rounding that occurred.
-func (x *Int) ToFloat64() (float64, Accuracy) {
+func (x *Int) Float64() (float64, Accuracy) {
        n := x.abs.bitLen() // NB: still uses slow crypto impl!
        if n == 0 {
                return 0.0, Exact
index dfbc17242d583774659e433c4d90cf9dea218f40..cb964a43cd2fa05faac34a74f5c8a18826705cc6 100644 (file)
@@ -1952,7 +1952,7 @@ func TestNewIntAllocs(t *testing.T) {
        }
 }
 
-func TestToFloat64(t *testing.T) {
+func TestFloat64(t *testing.T) {
        for _, test := range []struct {
                istr string
                f    float64
@@ -1988,7 +1988,7 @@ func TestToFloat64(t *testing.T) {
                }
 
                // Test against expectation.
-               f, acc := i.ToFloat64()
+               f, acc := i.Float64()
                if f != test.f || acc != test.acc {
                        t.Errorf("%s: got %f (%s); want %f (%s)", test.istr, f, acc, test.f, test.acc)
                }