summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2018-01-11 17:14:16 -0800
committerHans Boehm <hboehm@google.com>2018-01-11 17:14:16 -0800
commit5ee5a5919298a037f859e0f14bc058eb29710eb3 (patch)
tree6b50468a686bc19f08118e31d8fae1403797e882
parent568c8e610bdcd0ef141b2e00ff888553311e3a6c (diff)
downloadcrcalc-5ee5a5919298a037f859e0f14bc058eb29710eb3.tar.gz
Bug: 71686706 This one actually fixes the above issue in AOSP. Without this, sqrt() tended to force evaluation of the argument to twice the the requested precision, which clearly didn't scale. For some reason, that didn't seem to be reproducible for all calculator versions. Test: Calculator tests + CR tests Change-Id: I2cc0053f5e27d5d0364c707fe580aa246bbf99d0
-rw-r--r--src/com/hp/creals/CR.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/hp/creals/CR.java b/src/com/hp/creals/CR.java
index 9e10b51..e7cd26a 100644
--- a/src/com/hp/creals/CR.java
+++ b/src/com/hp/creals/CR.java
@@ -1502,7 +1502,7 @@ class sqrt_CR extends CR {
final int fp_op_prec = 60;
protected BigInteger approximate(int p) {
int max_op_prec_needed = 2*p - 1;
- int msd = op.msd(max_op_prec_needed);
+ int msd = op.iter_msd(max_op_prec_needed);
if (msd <= max_op_prec_needed) return big0;
int result_msd = msd/2; // +- 1
int result_digits = result_msd - p; // +- 2