• Brian Kessler's avatar
    math/big: round x + (-x) to -0 for mode ToNegativeInf · d31cad7c
    Brian Kessler authored
    Handling of sign bit as defined by IEEE 754-2008, section 6.3:
    
    When the sum of two operands with opposite signs (or the difference of
    two operands with like signs) is exactly zero, the sign of that sum (or
    difference) shall be +0 in all rounding-direction attributes except
    roundTowardNegative; under that attribute, the sign of an exact zero
    sum (or difference) shall be −0. However, x+x = x−(−x) retains the same
    sign as x even when x is zero.
    
    This change handles the special case of Add/Sub resulting in exactly zero
    when the rounding mode is ToNegativeInf setting the sign bit accordingly.
    
    Fixes #25798
    
    Change-Id: I4d0715fa3c3e4a3d8a4d7861dc1d6423c8b1c68c
    Reviewed-on: https://go-review.googlesource.com/117495
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    d31cad7c
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...