• Robert Griesemer's avatar
    spec: clarify numeric conversions where IEEE-754 produces -0.0 · 55ecda4f
    Robert Griesemer authored
    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/14727Reviewed-by: 's avatarRob Pike <r@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    55ecda4f
Name
Last commit
Last update
..
articles Loading commit data...
codewalk Loading commit data...
devel Loading commit data...
gopher Loading commit data...
play Loading commit data...
progs Loading commit data...
asm.html Loading commit data...
cmd.html Loading commit data...
code.html Loading commit data...
contrib.html Loading commit data...
contribute.html Loading commit data...
debugging_with_gdb.html Loading commit data...
docs.html Loading commit data...
effective_go.html Loading commit data...
gccgo_contribute.html Loading commit data...
gccgo_install.html Loading commit data...
go-logo-black.png Loading commit data...
go-logo-blue.png Loading commit data...
go-logo-white.png Loading commit data...
go1.1.html Loading commit data...
go1.2.html Loading commit data...
go1.3.html Loading commit data...
go1.4.html Loading commit data...
go1.5.html Loading commit data...
go1.6.txt Loading commit data...
go1.html Loading commit data...
go1compat.html Loading commit data...
go_faq.html Loading commit data...
go_mem.html Loading commit data...
go_spec.html Loading commit data...
help.html Loading commit data...
ie.css Loading commit data...
install-source.html Loading commit data...
install.html Loading commit data...
root.html Loading commit data...
security.html Loading commit data...
share.png Loading commit data...
tos.html Loading commit data...