diff options
author | Hans Boehm <hboehm@google.com> | 2015-04-27 18:07:47 -0700 |
---|---|---|
committer | Hans Boehm <hboehm@google.com> | 2015-04-29 13:11:05 -0700 |
commit | fbcef7005de4436682072927f83000b502928d25 (patch) | |
tree | 6eeb66694be681860c2719b5b5a22fc71090cb07 /src/com/android/calculator2/Evaluator.java | |
parent | 08e8f322b0d93e06aaa2a15acc869dfd70791461 (diff) | |
download | android_packages_apps_ExactCalculator-fbcef7005de4436682072927f83000b502928d25.tar.gz android_packages_apps_ExactCalculator-fbcef7005de4436682072927f83000b502928d25.tar.bz2 android_packages_apps_ExactCalculator-fbcef7005de4436682072927f83000b502928d25.zip |
Fix strings, stability bug, easy UI & correctness issues
Bug: 20625562
Bug: 20649711
Bug: 20561890
Bug: 20561528
Bug: 20442590
Bug: 15473140
Bug: 20503008
Bug: 20503007
- Improve timeout text.
- Recalculate when Calculator is rotated, e.g. in error state, thus
reproducing message. It's unclear this is good enough, but it's
better.
- Fix square root parsing.
- Fix concatenation of numbers when pasting by adding explicit
multiplication.
- Display divide by zero error differently from other domain errors.
- Improved advanced keypad layout of portrait-mode tablet calculator.
- Improved overflow menu order. (More to be done.)
- Report zero division as zero division when we can recognize it.
- Switch to floating menus for copy/paste.
Change-Id: I3875414f293e62a59b0e41f0de822f29bd5ac6a6
Diffstat (limited to 'src/com/android/calculator2/Evaluator.java')
-rw-r--r-- | src/com/android/calculator2/Evaluator.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/calculator2/Evaluator.java b/src/com/android/calculator2/Evaluator.java index b4a73c6..25da744 100644 --- a/src/com/android/calculator2/Evaluator.java +++ b/src/com/android/calculator2/Evaluator.java @@ -343,7 +343,6 @@ class Evaluator { protected InitialResult doInBackground(Void... nothing) { try { CalculatorExpr.EvalResult res = mExpr.eval(mDm); - if (res == null) return null; int prec = 3; // Enough for short representation String initCache = res.mVal.toString(prec); int msd = getMsdPos(initCache); @@ -365,6 +364,10 @@ class Evaluator { initCache, prec, initDisplayPrec); } catch (CalculatorExpr.SyntaxError e) { return new InitialResult(R.string.error_syntax); + } catch (BoundedRational.ZeroDivisionException e) { + // Division by zero caught by BoundedRational; + // the easy and more common case. + return new InitialResult(R.string.error_zero_divide); } catch(ArithmeticException e) { return new InitialResult(R.string.error_nan); } catch(PrecisionOverflowError e) { |