Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac8af098 authored by Hans Boehm's avatar Hans Boehm Committed by Android Git Automerger
Browse files

am 19e93c98: Reflect conversion of CR to unchecked exceptions

* commit '19e93c98':
  Reflect conversion of CR to unchecked exceptions
parents 221559d2 19e93c98
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ package com.android.calculator2;

import java.math.BigInteger;
import com.hp.creals.CR;
import com.hp.creals.AbortedError;

public class BoundedRational {
    // TODO: Maybe eventually make this extend Number?
@@ -386,7 +385,7 @@ public class BoundedRational {
        }
        BoundedRational tmp = pow(exp.shiftRight(1));
        if (Thread.interrupted()) {
            throw new AbortedError();
            throw new CR.AbortedException();
        }
        return multiply(tmp, tmp);
    }
@@ -453,11 +452,11 @@ public class BoundedRational {
        if (n > 4 * step) {
            BigInteger prod1 = genFactorial(n, 2 * step);
            if (Thread.interrupted()) {
                throw new AbortedError();
                throw new CR.AbortedException();
            }
            BigInteger prod2 = genFactorial(n - step, 2 * step);
            if (Thread.interrupted()) {
                throw new AbortedError();
                throw new CR.AbortedException();
            }
            return prod1.multiply(prod2);
        } else {
+5 −7
Original line number Diff line number Diff line
@@ -88,9 +88,7 @@ import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;

import com.hp.creals.AbortedError;
import com.hp.creals.CR;
import com.hp.creals.PrecisionOverflowError;

import java.io.DataInput;
import java.io.DataOutput;
@@ -233,9 +231,9 @@ class Evaluator {
                return new ReevalResult(mVal.toString(eval_prec), eval_prec);
            } catch(ArithmeticException e) {
                return null;
            } catch(PrecisionOverflowError e) {
            } catch(CR.PrecisionOverflowException e) {
                return null;
            } catch(AbortedError e) {
            } catch(CR.AbortedException e) {
                // Should only happen if the task was cancelled,
                // in which case we don't look at the result.
                return null;
@@ -252,7 +250,7 @@ class Evaluator {
                mCalculator.onError(R.string.error_nan);
            } else {
                if (result.mNewCacheDigs < mCacheDigs) {
                    throw new Error("Unexpected onPostExecute timing");
                    throw new AssertionError("Unexpected onPostExecute timing");
                }
                mCache = result.mNewCache;
                mCacheDigs = result.mNewCacheDigs;
@@ -411,11 +409,11 @@ class Evaluator {
                return new InitialResult(R.string.error_zero_divide);
            } catch(ArithmeticException e) {
                return new InitialResult(R.string.error_nan);
            } catch(PrecisionOverflowError e) {
            } catch(CR.PrecisionOverflowException e) {
                // Extremely unlikely unless we're actually dividing by
                // zero or the like.
                return new InitialResult(R.string.error_overflow);
            } catch(AbortedError e) {
            } catch(CR.AbortedException e) {
                return new InitialResult(R.string.error_aborted);
            }
        }