Change the comparison method for doubles.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
sigonasr2 2022-08-20 21:08:35 -05:00
parent 0b879d044e
commit 92efb3da51
2 changed files with 7 additions and 3 deletions

View File

@ -301,7 +301,11 @@ public abstract class Reader{
} }
} }
} }
try {
return Double.parseDouble(Integer.toString(numb)+"."+Integer.toString(decimal)); return Double.parseDouble(Integer.toString(numb)+"."+Integer.toString(decimal));
} catch (NumberFormatException e) {
return 0;
}
} }
int convertToInt(String[]data){return convertToInt("",data);} int convertToInt(String[]data){return convertToInt("",data);}
@ -438,7 +442,7 @@ public abstract class Reader{
if (this.other.length()>0 && other.other.length()>0 && !this.other.equals(other.other)) { if (this.other.length()>0 && other.other.length()>0 && !this.other.equals(other.other)) {
return false; return false;
} }
if (Double.doubleToLongBits(pct) != Double.doubleToLongBits(other.pct)) { if (Double.compare(pct,other.pct)!=0) {
System.out.println("Doubles don't match!"); System.out.println("Doubles don't match!");
return false; return false;
} }

View File

@ -107,7 +107,7 @@ public class sigPlace {
Reader lastReader = null; Reader lastReader = null;
Reader lastSubmittedReader = null; Reader lastSubmittedReader = null;
int matches=0; int matches=0;
final int EXPECTED_MATCHES=7; final int EXPECTED_MATCHES=5;
boolean submitted=false; boolean submitted=false;
while (true) { while (true) {
BufferedImage screenshot = r.createScreenCapture(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); BufferedImage screenshot = r.createScreenCapture(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());