Copy math package CL 12230 to cmplx package.
Change-Id: I3345b782b84b5b98e2b6a60d8774c7e7cede2891
Reviewed-on: https://go-review.googlesource.com/15500
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
d = -d
}
- if a != 0 {
- e = e * a
+ // note: b is correct (expected) value, a is actual value.
+ // make error tolerance a fraction of b, not a.
+ if b != 0 {
+ e = e * b
if e < 0 {
e = -e
}
func cTolerance(a, b complex128, e float64) bool {
d := Abs(a - b)
- if a != 0 {
- e = e * Abs(a)
+ if b != 0 {
+ e = e * Abs(b)
if e < 0 {
e = -e
}