summaryrefslogtreecommitdiffstats
path: root/src/com/android/calculator2/BoundedRational.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/calculator2/BoundedRational.java')
-rw-r--r--src/com/android/calculator2/BoundedRational.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/com/android/calculator2/BoundedRational.java b/src/com/android/calculator2/BoundedRational.java
index ee2ee92..a6dd6d9 100644
--- a/src/com/android/calculator2/BoundedRational.java
+++ b/src/com/android/calculator2/BoundedRational.java
@@ -229,6 +229,14 @@ public class BoundedRational {
return null;
}
+ private static BoundedRational map0to1(BoundedRational r) {
+ if (r == null) return null;
+ if (r.mNum.equals(BigInteger.ZERO)) {
+ return ONE;
+ }
+ return null;
+ }
+
private static BoundedRational map1to0(BoundedRational r) {
if (r == null) return null;
if (r.mNum.equals(r.mDen)) {
@@ -345,12 +353,7 @@ public class BoundedRational {
}
public static BoundedRational cos(BoundedRational r) {
- // Maps 0 to 1, null otherwise
- if (r == null) return null;
- if (r.mNum.equals(BigInteger.ZERO)) {
- return ONE;
- }
- return null;
+ return map0to1(r);
}
public static BoundedRational degreeCos(BoundedRational r) {
@@ -403,6 +406,10 @@ public class BoundedRational {
return map1to0(r);
}
+ public static BoundedRational exp(BoundedRational r) {
+ return map0to1(r);
+ }
+
// Return the base 10 log of n, if n is a power of 10, -1 otherwise.
// n must be positive.
private static long b10Log(BigInteger n) {