# Xlythe/Calculator forked from CyanogenMod/android_packages_apps_Calculator

tweaked graph ranges

1 parent e6f4a2b commit 8f291ab2d61ecdaa67fe5db3226cb1c52566e206 committed Sep 19, 2012
Showing with 4 additions and 4 deletions.
1. +4 −4 src/com/android2/calculator3/Logic.java
8 src/com/android2/calculator3/Logic.java
 @@ -477,7 +477,7 @@ public void run() { mSymbols.define(mX, x); double y = mSymbols.eval(equation[1]); - if(y>(maxY+((maxY-minY)*4)) || y<(minY-((maxY-minY)*4)) || y==Double.NaN) { + if(y>(2*maxY-minY) || y<(2*minY-maxY) || y==Double.NaN) { //If we're not exactly on the mark with a break in the graph, we get lines where we shouldn't like with y=1/x //Better to be safe and just treat anything a lot larger than the min/max height to be a break then pray we're perfect and get NaN series.add(x, MathHelper.NULL_VALUE); @@ -502,7 +502,7 @@ else if(equation[0].equals(mX) && !equation[1].contains(mX)) { mSymbols.define(mY, y); double x = mSymbols.eval(equation[1]); - if(x>(maxX+((maxX-minX)*4)) || x<(minX-((maxX-minX)*4)) || x==Double.NaN) { + if(x>(2*maxX-minX) || x<(2*minX-maxX) || x==Double.NaN) { series.add(MathHelper.NULL_VALUE, y); } else{ @@ -525,7 +525,7 @@ else if(equation[1].equals(mY) && !equation[0].contains(mY)) { mSymbols.define(mX, x); double y = mSymbols.eval(equation[0]); - if(y>(maxY+((maxY-minY)*4)) || y<(minY-((maxY-minY)*4)) || y==Double.NaN) { + if(y>(2*maxY-minY) || y<(2*minY-maxY) || y==Double.NaN) { series.add(x, MathHelper.NULL_VALUE); } else{ @@ -548,7 +548,7 @@ else if(equation[1].equals(mX) && !equation[0].contains(mX)) { mSymbols.define(mY, y); double x = mSymbols.eval(equation[0]); - if(x>(maxX+((maxX-minX)*4)) || x<(minX-((maxX-minX)*4)) || x==Double.NaN) { + if(x>(2*maxX-minX) || x<(2*minX-maxX) || x==Double.NaN) { series.add(MathHelper.NULL_VALUE, y); } else{