mirror of
https://github.com/golang/go
synced 2024-11-11 22:10:22 -07:00
spec: require 16 bit minimum exponent in constants rather than 32
A 16bit binary exponent permits a constant range covering roughly the range from 7e-9865 to 7e9863 which is more than enough for any practical and hypothetical constant arithmetic. Furthermore, until recently cmd/compile could not handle very large exponents correctly anyway; i.e., the chance that any real programs (but for tests that explore corner cases) are affected are close to zero. Finally, restricting the minimum supported range significantly reduces the implementation complexity in an area that hardly matters in reality for new or alternative spec-compliant implementations that don't or cannot rely on pre-existing arbitratry precision arithmetic packages that support a 32bit exponent range. This is technically a language change but for the reasons mentioned above this is unlikely to affect any real programs, and certainly not programs compiled with the gc or gccgo compilers as they currently support up to 32bit exponents. Fixes #13572. Change-Id: I970f919c57fc82c0175844364cf48ea335f17d39 Reviewed-on: https://go-review.googlesource.com/17711 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
3f2cb493e5
commit
8fbfdad281
@ -1,6 +1,6 @@
|
||||
<!--{
|
||||
"Title": "The Go Programming Language Specification",
|
||||
"Subtitle": "Version of October 14, 2016",
|
||||
"Subtitle": "Version of October 18, 2016",
|
||||
"Path": "/ref/spec"
|
||||
}-->
|
||||
|
||||
@ -605,7 +605,7 @@ implementation must:
|
||||
|
||||
<li>Represent floating-point constants, including the parts of
|
||||
a complex constant, with a mantissa of at least 256 bits
|
||||
and a signed exponent of at least 32 bits.</li>
|
||||
and a signed binary exponent of at least 16 bits.</li>
|
||||
|
||||
<li>Give an error if unable to represent an integer constant
|
||||
precisely.</li>
|
||||
|
Loading…
Reference in New Issue
Block a user