summaryrefslogtreecommitdiffstats
path: root/src/com/android/calculator2/BoundedRational.java
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2015-04-27 18:07:47 -0700
committerHans Boehm <hboehm@google.com>2015-04-29 13:11:05 -0700
commitfbcef7005de4436682072927f83000b502928d25 (patch)
tree6eeb66694be681860c2719b5b5a22fc71090cb07 /src/com/android/calculator2/BoundedRational.java
parent08e8f322b0d93e06aaa2a15acc869dfd70791461 (diff)
downloadandroid_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/BoundedRational.java')
-rw-r--r--src/com/android/calculator2/BoundedRational.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/calculator2/BoundedRational.java b/src/com/android/calculator2/BoundedRational.java
index 04cf86c..d95b52b 100644
--- a/src/com/android/calculator2/BoundedRational.java
+++ b/src/com/android/calculator2/BoundedRational.java
@@ -170,10 +170,16 @@ public class BoundedRational {
return new BoundedRational(num,den).maybeReduce();
}
+ public static class ZeroDivisionException extends ArithmeticException {
+ public ZeroDivisionException() {
+ super("Division by zero");
+ }
+ }
+
static BoundedRational inverse(BoundedRational r) {
if (r == null) return null;
if (r.mNum.equals(BigInteger.ZERO)) {
- throw new ArithmeticException("Divide by Zero");
+ throw new ZeroDivisionException();
}
return new BoundedRational(r.mDen, r.mNum);
}