From d2b9acaf9cfbe43cb3597e3b70af7fc149155219 Mon Sep 17 00:00:00 2001 From: Justus Garbe Date: Mon, 15 Apr 2024 21:59:52 +0200 Subject: [PATCH] fix: number format exception in `isFloatingPoint` --- .../me/darknet/assembler/ast/primitive/ASTNumber.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jasm-core/src/main/java/me/darknet/assembler/ast/primitive/ASTNumber.java b/jasm-core/src/main/java/me/darknet/assembler/ast/primitive/ASTNumber.java index dc286427..7b361c84 100644 --- a/jasm-core/src/main/java/me/darknet/assembler/ast/primitive/ASTNumber.java +++ b/jasm-core/src/main/java/me/darknet/assembler/ast/primitive/ASTNumber.java @@ -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(); } } @@ -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"); } }