mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
GP-4759 corrected BigFloat formatting of -0.0 (Closes #6677)
This commit is contained in:
parent
76923e15b3
commit
282c6b698a
@ -1042,6 +1042,9 @@ public class BigFloat implements Comparable<BigFloat> {
|
||||
if (isInfinite()) {
|
||||
return sign < 0 ? NEGATIVE_INFINITY : POSITIVE_INFINITY;
|
||||
}
|
||||
if (isZero()) {
|
||||
return sign < 0 ? "-0.0" : "0.0";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1480,7 +1480,11 @@ public class FloatFormatTest extends AbstractGenericTest {
|
||||
@Test
|
||||
public void testValueOfBigInteger() {
|
||||
FloatFormat ff = FloatFormatFactory.getFloatFormat(8);
|
||||
assertEquals("0.0", ff.toDecimalString(ff.getBigFloat(BigInteger.ZERO)));
|
||||
|
||||
assertFalse(ff.getBigZero(true).equals(ff.getBigZero(false)));
|
||||
|
||||
assertEquals("-0.0", ff.toDecimalString(ff.getBigZero(true)));
|
||||
assertEquals("0.0", ff.toDecimalString(ff.getBigZero(false)));
|
||||
assertEquals("1.0", ff.toDecimalString(ff.getBigFloat(BigInteger.ONE)));
|
||||
assertEquals("2.0", ff.toDecimalString(ff.getBigFloat(BigInteger.TWO)));
|
||||
assertEquals("-1.0", ff.toDecimalString(ff.getBigFloat(BigInteger.ONE.negate())));
|
||||
|
Loading…
Reference in New Issue
Block a user