go/src/math/big
Juraj Sukop 1d992f2e36 math/big: better initial guess for nat.sqrt
The proposed change introduces a better initial guess which is closer to the final value and therefore converges in fewer steps. Consider for example sqrt(8): previously the guess was 8, whereas now it is 4 (and the result is 2). All this change does is it computes the division by two more accurately while it keeps the guess ≥ √x.

Change-Id: I917248d734a7b0488d14a647a063f674e56c4e30
GitHub-Last-Rev: c06d9d4876
GitHub-Pull-Request: golang/go#28981
Reviewed-on: https://go-review.googlesource.com/c/163866
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-02-27 18:48:56 +00:00
..
accuracy_string.go all: regenerate stringer files 2018-05-29 20:35:41 +00:00
arith.go math/big: fix a formula used as documentation 2018-10-28 16:58:20 +00:00
arith_386.s all: this big patch remove whitespace from assembly files 2018-10-03 15:28:51 +00:00
arith_amd64.go
arith_amd64.s all: this big patch remove whitespace from assembly files 2018-10-03 15:28:51 +00:00
arith_amd64p32.s
arith_arm.s all: this big patch remove whitespace from assembly files 2018-10-03 15:28:51 +00:00
arith_arm64.s
arith_decl.go
arith_decl_pure.go
arith_decl_s390x.go
arith_mips64x.s
arith_mipsx.s
arith_ppc64x.s
arith_s390x.s all: this big patch remove whitespace from assembly files 2018-10-03 15:28:51 +00:00
arith_s390x_test.go
arith_test.go
arith_wasm.s math, math/big: add wasm architecture 2018-05-08 13:29:22 +00:00
bits_test.go
calibrate_test.go math/big: specialize Karatsuba implementation for squaring 2018-05-23 20:46:02 +00:00
decimal.go
decimal_test.go
doc.go
example_rat_test.go
example_test.go
float.go all: use "reports whether" consistently in the few places that didn't 2018-11-02 22:47:58 +00:00
float_test.go math/big: round x + (-x) to -0 for mode ToNegativeInf 2018-06-14 21:07:01 +00:00
floatconv.go math/big: permit upper-case 'P' binary exponent (not just 'p') 2019-02-11 23:22:35 +00:00
floatconv_test.go math/big: add %x float format 2019-02-26 19:39:11 +00:00
floatexample_test.go
floatmarsh.go
floatmarsh_test.go
ftoa.go math/big: add %x float format 2019-02-26 19:39:11 +00:00
gcd_test.go
hilbert_test.go
int.go math/big: handle alias of cofactor inputs in GCD 2019-02-27 00:11:17 +00:00
int_test.go math/big: handle alias of cofactor inputs in GCD 2019-02-27 00:11:17 +00:00
intconv.go math/big: add %#b and %O integer formats 2019-02-26 19:39:19 +00:00
intconv_test.go math/big: add %#b and %O integer formats 2019-02-26 19:39:19 +00:00
intmarsh.go
intmarsh_test.go
nat.go math/big: better initial guess for nat.sqrt 2019-02-27 18:48:56 +00:00
nat_test.go math/big: specialize Karatsuba implementation for squaring 2018-05-23 20:46:02 +00:00
natconv.go
natconv_test.go
prime.go math/big: fix incorrect comment variable reference 2018-12-26 05:21:41 +00:00
prime_test.go all: update comment URLs from HTTP to HTTPS, where possible 2018-06-01 21:52:00 +00:00
rat.go math/big: shallow copies of Int/Rat/Float are not supported (documentation) 2018-10-29 18:23:31 +00:00
rat_test.go
ratconv.go math/big: permit upper-case 'P' binary exponent (not just 'p') 2019-02-11 23:22:35 +00:00
ratconv_test.go all: update comment URLs from HTTP to HTTPS, where possible 2018-06-01 21:52:00 +00:00
ratmarsh.go
ratmarsh_test.go
roundingmode_string.go all: regenerate stringer files 2018-05-29 20:35:41 +00:00
sqrt.go math/big: optimize multiplication by 2 and 1/2 in float Sqrt 2018-08-22 21:02:21 +00:00
sqrt_test.go