Java polynomial root search
I am new to Java and have created a Polynomial Root Finder with a GUI. One of the problems I'm currently running into and don't quite understand is the value that comes from perfect squares like (x + 5) ^ 2.
int y = 0;
for(int x = -100000; x < 100000; x++) {
int math = (A * (x * x)) + (B * x) + C;
if(math == 0) {
Zeros[y] = x;
y++;
}
}
Now for some reason Zeros [0] returns -65541 and I'm not sure why. Now if I make x bounds from -10000 to 10000 the problem goes away and shows the correct roots. I'm just asking why -65541 gets as root.
Here is a photo of my problem.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: