Fix sqrt[] graphing bug

master
skylarmt 9 years ago
parent 3e24b379e0
commit 386852e83e

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

@ -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;
/**

@ -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;

@ -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);

Loading…
Cancel
Save