Skip to content

Commit

Permalink
fix: number format exception in isFloatingPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jumanji144 committed Apr 15, 2024
1 parent c9b4e4a commit d2b9aca
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public boolean isWide() {
return !value.endsWith("f");
} else {
return value.endsWith("l") || value.endsWith("d") ||
value.equals("nan") || value.equals("nand") ||
value.equals("infinity") || value.equals("+infinity") || value.equals("-infinity") ||
value.equals("infinityd") || value.equals("+infinityd") || value.equals("-infinityd");
isNaN() || isInfinity();
}
}

Expand All @@ -77,10 +75,13 @@ public boolean isFloatingPoint() {
}

public boolean isNaN() {
return Double.isNaN(asDouble()) || Float.isNaN(asFloat());
String value = content().toLowerCase();
return value.equals("nan") || value.equals("nand");
}

public boolean isInfinity() {
return Double.isInfinite(asDouble()) || Float.isInfinite(asFloat());
String value = content().toLowerCase();
return value.equals("infinity") || value.equals("+infinity") || value.equals("-infinity") ||
value.equals("infinityd") || value.equals("+infinityd") || value.equals("-infinityd");
}
}

0 comments on commit d2b9aca

Please sign in to comment.