diff options
| author | Robert Griesemer <gri@golang.org> | 2015-09-17 18:10:20 -0700 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2015-10-20 18:16:57 +0000 |
| commit | 55ecda4ffd1899463db19bf224106fd73de21898 (patch) | |
| tree | 87fc5d929df3315c35a505feded90eed56c9a80b /src | |
| parent | 27838f3990f345629b397f9f3902163392f08f9d (diff) | |
| download | go-55ecda4ffd1899463db19bf224106fd73de21898.tar.xz | |
spec: clarify numeric conversions where IEEE-754 produces -0.0
The spec defines precise numeric constants which do not overflow.
Consequently, +/-Inf and NaN values were excluded. The case was not
clear for -0.0 but they are mostly of interest to determine the sign
of infinities which don't exist.
That said, the conversion rules explicitly say that T(x) (for a numeric
x and floating-point type T) is the value after rounding per IEEE-754.
The result is constant if x is constant. Rounding per IEEE-754 can
produce a -0.0 which we cannot represent as a constant.
Thus, the spec is inconsistent. Attempt to fix the inconsistency by
adjusting the rounding rule rather than letting -0.0 into the language.
For more details, see the issue below.
Open to discussion.
Fixes #12576.
Change-Id: Ibe3c676372ab16d9229f1f9daaf316f761e074ee
Reviewed-on: https://go-review.googlesource.com/14727
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions
