• Mark Pulford's avatar
    math: add RoundToEven function · a5c44f3e
    Mark Pulford authored
    Rounding ties to even is statistically useful for some applications.
    This implementation completes IEEE float64 rounding mode support (in
    addition to Round, Ceil, Floor, Trunc).
    
    This function avoids subtle faults found in ad-hoc implementations, and
    is simple enough to be inlined by the compiler.
    
    Fixes #21748
    
    Change-Id: I09415df2e42435f9e7dabe3bdc0148e9b9ebd609
    Reviewed-on: https://go-review.googlesource.com/61211Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    Run-TryBot: Robert Griesemer <gri@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    a5c44f3e
floor.go 3.09 KB