]> Cypherpunks repositories - gostls13.git/commit
math: add RoundToEven function
authorMark Pulford <mark@kyne.com.au>
Sun, 3 Sep 2017 11:46:51 +0000 (21:46 +1000)
committerRobert Griesemer <gri@golang.org>
Tue, 24 Oct 2017 22:33:09 +0000 (22:33 +0000)
commita5c44f3e3f722187c5438da8468963b2f0b629ac
tree398db60c86303c67c70c4d89c1d708ff57266fd4
parentfcd32885dfd9f69d894f11e0802548071be5e326
math: add RoundToEven function

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/61211
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/math/all_test.go
src/math/bits.go
src/math/floor.go