]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] go/constant: choose internal float representations more consistently
authorRobert Griesemer <gri@golang.org>
Mon, 25 Jan 2021 23:39:37 +0000 (15:39 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 26 Jan 2021 05:40:20 +0000 (05:40 +0000)
commitd39685e5e954aadcfca6ec3cf784d4af20fcae5d
tree7ccbf8838a913ffa8ae3f11d8a7076c3f6af526f
parent34704e374f08ea126786b7d454fc9b647663f95a
[dev.typeparams] go/constant: choose internal float representations more consistently

go/constant represents a Float constant either as a rational number
(if numerator and denominator are small enough), or, as a "catch-all",
as a arbitrary-precision floating-point number.

This CL cleans up some of these transitions by factoring out more
of the decision logic and documents the rationale between the state
transitions better.

This CL also simplifies some unrelated code that was overly complex.

Updates #43908.

Change-Id: Iccdd2d6b7fb7ed13d68ed5e6d992d1bc56a065bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/286572
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/go/constant/value.go