Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-NaN is a thing, but up to commit bb4853e414 has not been represented. #7389

Open
Wall-AF opened this issue Jan 19, 2025 · 0 comments
Open

Comments

@Wall-AF
Copy link

Wall-AF commented Jan 19, 2025

Below details the commit and the fix.

D:\GIT_Sources\Ghidra.Latest\ghidra>git branch -a -vv
* master                     bb4853e414 [origin/master] Merge remote-tracking branch 'origin/Ghidra_11.3'

D:\GIT_Sources\Ghidra.Latest\ghidra>git diff -w **/BigFloat.java
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/floatformat/BigFloat.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/floatformat/BigFloat.java
index 63967c0761..97269e0937 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/floatformat/BigFloat.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/floatformat/BigFloat.java
@@ -38,6 +38,8 @@ public class BigFloat implements Comparable<BigFloat> {
        public static final String POSITIVE_INFINITY = "+" + INFINITY;
        public static final String NEGATIVE_INFINITY = "-" + INFINITY;
        public static final String NAN = "NaN";
+       public static final String POSITIVE_NAN = "+" + NAN;
+       public static final String NEGATIVE_NAN = "-" + NAN;

        private static final int INFINITE_SCALE = -(64 * 1024);
        public static final BigDecimal BIG_POSITIVE_INFINITY =
@@ -1037,7 +1039,7 @@ public class BigFloat implements Comparable<BigFloat> {

        private String formatSpecialCase() {
                if (isNaN()) {
-                       return NAN;
+                       return sign < 0 ? NEGATIVE_NAN : POSITIVE_NAN;
                }
                if (isInfinite()) {
                        return sign < 0 ? NEGATIVE_INFINITY : POSITIVE_INFINITY;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant