mirror of
https://github.com/golang/go
synced 2024-11-15 05:20:21 -07:00
math/rand/v2: use max builtin in tests
Change-Id: I6d0050319c66fb62c817206e646e1a9449dc444c Reviewed-on: https://go-review.googlesource.com/c/go/+/585715 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
1ffc296717
commit
63a0a905fa
@ -31,13 +31,6 @@ type statsResults struct {
|
|||||||
maxError float64
|
maxError float64
|
||||||
}
|
}
|
||||||
|
|
||||||
func max(a, b float64) float64 {
|
|
||||||
if a > b {
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func nearEqual(a, b, closeEnough, maxError float64) bool {
|
func nearEqual(a, b, closeEnough, maxError float64) bool {
|
||||||
absDiff := math.Abs(a - b)
|
absDiff := math.Abs(a - b)
|
||||||
if absDiff < closeEnough { // Necessary when one value is zero and one value is close to zero.
|
if absDiff < closeEnough { // Necessary when one value is zero and one value is close to zero.
|
||||||
|
Loading…
Reference in New Issue
Block a user