Skip to content

Commit

Permalink
8288933: Improve the implementation of Double/Float.isInfinite
Browse files Browse the repository at this point in the history
Reviewed-by: redestad, darcy
  • Loading branch information
merykitty authored and jddarcy committed Sep 9, 2022
1 parent 00befdd commit a14c3a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/lang/Double.java
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ public static boolean isNaN(double v) {
*/
@IntrinsicCandidate
public static boolean isInfinite(double v) {
return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
return Math.abs(v) > MAX_VALUE;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/lang/Float.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public static boolean isNaN(float v) {
*/
@IntrinsicCandidate
public static boolean isInfinite(float v) {
return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
return Math.abs(v) > MAX_VALUE;
}


Expand Down

1 comment on commit a14c3a4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.