]> Cypherpunks repositories - gostls13.git/commit
math: add a testcase for Mod and Remainder respectively
authorerifan01 <eric.fang@arm.com>
Tue, 28 Nov 2017 03:38:03 +0000 (03:38 +0000)
committerRobert Griesemer <gri@golang.org>
Tue, 17 Apr 2018 03:17:22 +0000 (03:17 +0000)
commit6d5ebc70225aeb71a60061e5cf755c5852ac13da
tree4a91625e79af77a9df750988a248bb1a32c27557
parenta2ffe3e625b05217e8d44dcda43138fc61390666
math: add a testcase for Mod and Remainder respectively

One might try to implement the Mod or Remainder function with the expression
x - TRUNC(x/y + 0.5)*y, but in fact this method is wrong, because the rounding
of (x/y + 0.5) to initialize the argument of TRUNC may lose too much precision.
However, the current test cases can not detect this error. This CL adds two
test cases to prevent people from continuing to do such attempts.

Change-Id: I6690f5cffb21bf8ae06a314b7a45cafff8bcee13
Reviewed-on: https://go-review.googlesource.com/84275
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/all_test.go