Fix sqrt[] graphing bug

This commit is contained in:
skylarmt 2015-01-21 15:27:29 -07:00
parent 3e24b379e0
commit 386852e83e
4 changed files with 11 additions and 10 deletions

2
src/Ubuntu-R info Normal file
View File

@ -0,0 +1,2 @@
The ubuntu.ttf font file was originally Ubuntu-R.ttf.
It was changed for several petty reasons.

View File

@ -49,12 +49,8 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.fife.ui.autocomplete.BasicCompletion;
import org.fife.ui.autocomplete.Completion;
import org.fife.ui.autocomplete.CompletionProvider;
import org.fife.ui.autocomplete.DefaultCompletionProvider;
import org.fife.ui.autocomplete.FunctionCompletion;
import org.fife.ui.autocomplete.MarkupTagCompletion;
import org.fife.ui.autocomplete.ShorthandCompletion;
import org.fife.ui.autocomplete.VariableCompletion;
/**

View File

@ -52,8 +52,6 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;

View File

@ -288,15 +288,20 @@ public class Graph extends javax.swing.JInternalFrame {
try {
cr.setVar("x", x);
res = solver.evaluate("$x=" + x + ";N[" + formula + "]").toString();
} catch (MathException | NumberFormatException ex) {
} catch (Exception ex) {
res = "0";
}
// Omit crazy numbers like 1/0 and stuff
if (Double.parseDouble(res) > Integer.MIN_VALUE) {
try {
if (Double.parseDouble(res) > Integer.MIN_VALUE) {
xx += String.valueOf(x) + " ";
yy += res + " ";
} else {
}
} catch (Exception ex) {
xx += String.valueOf(x) + " ";
yy += res + " ";
} else {
}
}
Debug.println(xx);