Removing NumberUtils.compare(float,float) and NumberUtils.compare(double,double). These are now foud in Float and Double respectively. Keeping the unit tests, but pointing to the JDK methods as a regression. LANG-492

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@770078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-04-30 06:03:16 +00:00
parent 574493d175
commit 0904ecd4fa
6 changed files with 171 additions and 295 deletions

View File

@ -589,7 +589,7 @@ public class CompareToBuilder {
if (comparison != 0) {
return this;
}
comparison = NumberUtils.compare(lhs, rhs);
comparison = Double.compare(lhs, rhs);
return this;
}
@ -610,7 +610,7 @@ public class CompareToBuilder {
if (comparison != 0) {
return this;
}
comparison = NumberUtils.compare(lhs, rhs);
comparison = Float.compare(lhs, rhs);
return this;
}

View File

@ -1178,131 +1178,6 @@ public class NumberUtils {
return Math.max(Math.max(a, b), c);
}
//-----------------------------------------------------------------------
/**
* <p>Compares two <code>doubles</code> for order.</p>
*
* <p>This method is more comprehensive than the standard Java greater
* than, less than and equals operators.</p>
* <ul>
* <li>It returns <code>-1</code> if the first value is less than the second.</li>
* <li>It returns <code>+1</code> if the first value is greater than the second.</li>
* <li>It returns <code>0</code> if the values are equal.</li>
* </ul>
*
* <p>
* The ordering is as follows, largest to smallest:
* <ul>
* <li>NaN
* <li>Positive infinity
* <li>Maximum double
* <li>Normal positive numbers
* <li>+0.0
* <li>-0.0
* <li>Normal negative numbers
* <li>Minimum double (<code>-Double.MAX_VALUE</code>)
* <li>Negative infinity
* </ul>
* </p>
*
* <p>Comparing <code>NaN</code> with <code>NaN</code> will
* return <code>0</code>.</p>
*
* @param lhs the first <code>double</code>
* @param rhs the second <code>double</code>
* @return <code>-1</code> if lhs is less, <code>+1</code> if greater,
* <code>0</code> if equal to rhs
*/
public static int compare(double lhs, double rhs) {
if (lhs < rhs) {
return -1;
}
if (lhs > rhs) {
return +1;
}
// Need to compare bits to handle 0.0 == -0.0 being true
// compare should put -0.0 < +0.0
// Two NaNs are also == for compare purposes
// where NaN == NaN is false
long lhsBits = Double.doubleToLongBits(lhs);
long rhsBits = Double.doubleToLongBits(rhs);
if (lhsBits == rhsBits) {
return 0;
}
// Something exotic! A comparison to NaN or 0.0 vs -0.0
// Fortunately NaN's long is > than everything else
// Also negzeros bits < poszero
// NAN: 9221120237041090560
// MAX: 9218868437227405311
// NEGZERO: -9223372036854775808
if (lhsBits < rhsBits) {
return -1;
} else {
return +1;
}
}
/**
* <p>Compares two floats for order.</p>
*
* <p>This method is more comprehensive than the standard Java greater than,
* less than and equals operators.</p>
* <ul>
* <li>It returns <code>-1</code> if the first value is less than the second.
* <li>It returns <code>+1</code> if the first value is greater than the second.
* <li>It returns <code>0</code> if the values are equal.
* </ul>
*
* <p> The ordering is as follows, largest to smallest:
* <ul>
* <li>NaN
* <li>Positive infinity
* <li>Maximum float
* <li>Normal positive numbers
* <li>+0.0
* <li>-0.0
* <li>Normal negative numbers
* <li>Minimum float (<code>-Float.MAX_VALUE</code>)
* <li>Negative infinity
* </ul>
*
* <p>Comparing <code>NaN</code> with <code>NaN</code> will return
* <code>0</code>.</p>
*
* @param lhs the first <code>float</code>
* @param rhs the second <code>float</code>
* @return <code>-1</code> if lhs is less, <code>+1</code> if greater,
* <code>0</code> if equal to rhs
*/
public static int compare(float lhs, float rhs) {
if (lhs < rhs) {
return -1;
}
if (lhs > rhs) {
return +1;
}
//Need to compare bits to handle 0.0 == -0.0 being true
// compare should put -0.0 < +0.0
// Two NaNs are also == for compare purposes
// where NaN == NaN is false
int lhsBits = Float.floatToIntBits(lhs);
int rhsBits = Float.floatToIntBits(rhs);
if (lhsBits == rhsBits) {
return 0;
}
//Something exotic! A comparison to NaN or 0.0 vs -0.0
//Fortunately NaN's int is > than everything else
//Also negzeros bits < poszero
//NAN: 2143289344
//MAX: 2139095039
//NEGZERO: -2147483648
if (lhsBits < rhsBits) {
return -1;
} else {
return +1;
}
}
//-----------------------------------------------------------------------
/**
* <p>Checks whether the <code>String</code> contains only

View File

@ -267,8 +267,8 @@ public abstract class Range {
* range by <code>double</code> comparison
*/
public boolean containsDouble(double value) {
int compareMin = NumberUtils.compare(getMinimumDouble(), value);
int compareMax = NumberUtils.compare(getMaximumDouble(), value);
int compareMin = Double.compare(getMinimumDouble(), value);
int compareMax = Double.compare(getMaximumDouble(), value);
return compareMin <= 0 && compareMax >= 0;
}
@ -303,8 +303,8 @@ public abstract class Range {
* range by <code>float</code> comparison
*/
public boolean containsFloat(float value) {
int compareMin = NumberUtils.compare(getMinimumFloat(), value);
int compareMax = NumberUtils.compare(getMaximumFloat(), value);
int compareMin = Float.compare(getMinimumFloat(), value);
int compareMax = Float.compare(getMaximumFloat(), value);
return compareMin <= 0 && compareMax >= 0;
}

View File

@ -303,7 +303,7 @@ public class MutableDouble extends Number implements Comparable, Mutable {
public int compareTo(Object obj) {
MutableDouble other = (MutableDouble) obj;
double anotherVal = other.value;
return NumberUtils.compare(value, anotherVal);
return Double.compare(value, anotherVal);
}
/**

View File

@ -304,7 +304,7 @@ public class MutableFloat extends Number implements Comparable, Mutable {
public int compareTo(Object obj) {
MutableFloat other = (MutableFloat) obj;
float anotherVal = other.value;
return NumberUtils.compare(value, anotherVal);
return Float.compare(value, anotherVal);
}
/**

View File

@ -775,188 +775,189 @@ public class NumberUtilsTest extends TestCase {
assertEquals(high, NumberUtils.max(high, mid, high), 0.0001f);
}
// Testing JDK against old Lang functionality
public void testCompareDouble() {
assertTrue(NumberUtils.compare(Double.NaN, Double.NaN) == 0);
assertTrue(NumberUtils.compare(Double.NaN, Double.POSITIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Double.NaN, Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Double.NaN, 1.2d) == +1);
assertTrue(NumberUtils.compare(Double.NaN, 0.0d) == +1);
assertTrue(NumberUtils.compare(Double.NaN, -0.0d) == +1);
assertTrue(NumberUtils.compare(Double.NaN, -1.2d) == +1);
assertTrue(NumberUtils.compare(Double.NaN, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Double.NaN, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(Double.NaN, Double.NaN) == 0);
assertTrue(Double.compare(Double.NaN, Double.POSITIVE_INFINITY) == +1);
assertTrue(Double.compare(Double.NaN, Double.MAX_VALUE) == +1);
assertTrue(Double.compare(Double.NaN, 1.2d) == +1);
assertTrue(Double.compare(Double.NaN, 0.0d) == +1);
assertTrue(Double.compare(Double.NaN, -0.0d) == +1);
assertTrue(Double.compare(Double.NaN, -1.2d) == +1);
assertTrue(Double.compare(Double.NaN, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(Double.NaN, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.NaN) == -1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) == 0);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, 1.2d) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, 0.0d) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, -0.0d) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, -1.2d) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.NaN) == -1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) == 0);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.MAX_VALUE) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, 1.2d) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, 0.0d) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -0.0d) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -1.2d) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.NaN) == -1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.MAX_VALUE) == 0);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, 1.2d) == +1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, 0.0d) == +1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, -0.0d) == +1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, -1.2d) == +1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(Double.MAX_VALUE, Double.NaN) == -1);
assertTrue(Double.compare(Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(Double.MAX_VALUE, Double.MAX_VALUE) == 0);
assertTrue(Double.compare(Double.MAX_VALUE, 1.2d) == +1);
assertTrue(Double.compare(Double.MAX_VALUE, 0.0d) == +1);
assertTrue(Double.compare(Double.MAX_VALUE, -0.0d) == +1);
assertTrue(Double.compare(Double.MAX_VALUE, -1.2d) == +1);
assertTrue(Double.compare(Double.MAX_VALUE, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(1.2d, Double.NaN) == -1);
assertTrue(NumberUtils.compare(1.2d, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(1.2d, Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(1.2d, 1.2d) == 0);
assertTrue(NumberUtils.compare(1.2d, 0.0d) == +1);
assertTrue(NumberUtils.compare(1.2d, -0.0d) == +1);
assertTrue(NumberUtils.compare(1.2d, -1.2d) == +1);
assertTrue(NumberUtils.compare(1.2d, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(1.2d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(1.2d, Double.NaN) == -1);
assertTrue(Double.compare(1.2d, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(1.2d, Double.MAX_VALUE) == -1);
assertTrue(Double.compare(1.2d, 1.2d) == 0);
assertTrue(Double.compare(1.2d, 0.0d) == +1);
assertTrue(Double.compare(1.2d, -0.0d) == +1);
assertTrue(Double.compare(1.2d, -1.2d) == +1);
assertTrue(Double.compare(1.2d, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(1.2d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(0.0d, Double.NaN) == -1);
assertTrue(NumberUtils.compare(0.0d, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(0.0d, Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(0.0d, 1.2d) == -1);
assertTrue(NumberUtils.compare(0.0d, 0.0d) == 0);
assertTrue(NumberUtils.compare(0.0d, -0.0d) == +1);
assertTrue(NumberUtils.compare(0.0d, -1.2d) == +1);
assertTrue(NumberUtils.compare(0.0d, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(0.0d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(0.0d, Double.NaN) == -1);
assertTrue(Double.compare(0.0d, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(0.0d, Double.MAX_VALUE) == -1);
assertTrue(Double.compare(0.0d, 1.2d) == -1);
assertTrue(Double.compare(0.0d, 0.0d) == 0);
assertTrue(Double.compare(0.0d, -0.0d) == +1);
assertTrue(Double.compare(0.0d, -1.2d) == +1);
assertTrue(Double.compare(0.0d, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(0.0d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(-0.0d, Double.NaN) == -1);
assertTrue(NumberUtils.compare(-0.0d, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(-0.0d, Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(-0.0d, 1.2d) == -1);
assertTrue(NumberUtils.compare(-0.0d, 0.0d) == -1);
assertTrue(NumberUtils.compare(-0.0d, -0.0d) == 0);
assertTrue(NumberUtils.compare(-0.0d, -1.2d) == +1);
assertTrue(NumberUtils.compare(-0.0d, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(-0.0d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(-0.0d, Double.NaN) == -1);
assertTrue(Double.compare(-0.0d, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(-0.0d, Double.MAX_VALUE) == -1);
assertTrue(Double.compare(-0.0d, 1.2d) == -1);
assertTrue(Double.compare(-0.0d, 0.0d) == -1);
assertTrue(Double.compare(-0.0d, -0.0d) == 0);
assertTrue(Double.compare(-0.0d, -1.2d) == +1);
assertTrue(Double.compare(-0.0d, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(-0.0d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(-1.2d, Double.NaN) == -1);
assertTrue(NumberUtils.compare(-1.2d, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(-1.2d, Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(-1.2d, 1.2d) == -1);
assertTrue(NumberUtils.compare(-1.2d, 0.0d) == -1);
assertTrue(NumberUtils.compare(-1.2d, -0.0d) == -1);
assertTrue(NumberUtils.compare(-1.2d, -1.2d) == 0);
assertTrue(NumberUtils.compare(-1.2d, -Double.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(-1.2d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(-1.2d, Double.NaN) == -1);
assertTrue(Double.compare(-1.2d, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(-1.2d, Double.MAX_VALUE) == -1);
assertTrue(Double.compare(-1.2d, 1.2d) == -1);
assertTrue(Double.compare(-1.2d, 0.0d) == -1);
assertTrue(Double.compare(-1.2d, -0.0d) == -1);
assertTrue(Double.compare(-1.2d, -1.2d) == 0);
assertTrue(Double.compare(-1.2d, -Double.MAX_VALUE) == +1);
assertTrue(Double.compare(-1.2d, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.NaN) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, 1.2d) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, 0.0d) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, -0.0d) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, -1.2d) == -1);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, -Double.MAX_VALUE) == 0);
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
assertTrue(Double.compare(-Double.MAX_VALUE, Double.NaN) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, Double.MAX_VALUE) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, 1.2d) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, 0.0d) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, -0.0d) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, -1.2d) == -1);
assertTrue(Double.compare(-Double.MAX_VALUE, -Double.MAX_VALUE) == 0);
assertTrue(Double.compare(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.NaN) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, 1.2d) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, 0.0d) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, -0.0d) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, -1.2d) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) == 0);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.NaN) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.MAX_VALUE) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, 1.2d) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, 0.0d) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -0.0d) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -1.2d) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE) == -1);
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) == 0);
}
public void testCompareFloat() {
assertTrue(NumberUtils.compare(Float.NaN, Float.NaN) == 0);
assertTrue(NumberUtils.compare(Float.NaN, Float.POSITIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Float.NaN, Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Float.NaN, 1.2f) == +1);
assertTrue(NumberUtils.compare(Float.NaN, 0.0f) == +1);
assertTrue(NumberUtils.compare(Float.NaN, -0.0f) == +1);
assertTrue(NumberUtils.compare(Float.NaN, -1.2f) == +1);
assertTrue(NumberUtils.compare(Float.NaN, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Float.NaN, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(Float.NaN, Float.NaN) == 0);
assertTrue(Float.compare(Float.NaN, Float.POSITIVE_INFINITY) == +1);
assertTrue(Float.compare(Float.NaN, Float.MAX_VALUE) == +1);
assertTrue(Float.compare(Float.NaN, 1.2f) == +1);
assertTrue(Float.compare(Float.NaN, 0.0f) == +1);
assertTrue(Float.compare(Float.NaN, -0.0f) == +1);
assertTrue(Float.compare(Float.NaN, -1.2f) == +1);
assertTrue(Float.compare(Float.NaN, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(Float.NaN, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.NaN) == -1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY) == 0);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, 1.2f) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, 0.0f) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, -0.0f) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, -1.2f) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.NaN) == -1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY) == 0);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.MAX_VALUE) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, 1.2f) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, 0.0f) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -0.0f) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -1.2f) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.NaN) == -1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.MAX_VALUE) == 0);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, 1.2f) == +1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, 0.0f) == +1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, -0.0f) == +1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, -1.2f) == +1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(Float.MAX_VALUE, Float.NaN) == -1);
assertTrue(Float.compare(Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(Float.MAX_VALUE, Float.MAX_VALUE) == 0);
assertTrue(Float.compare(Float.MAX_VALUE, 1.2f) == +1);
assertTrue(Float.compare(Float.MAX_VALUE, 0.0f) == +1);
assertTrue(Float.compare(Float.MAX_VALUE, -0.0f) == +1);
assertTrue(Float.compare(Float.MAX_VALUE, -1.2f) == +1);
assertTrue(Float.compare(Float.MAX_VALUE, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(1.2f, Float.NaN) == -1);
assertTrue(NumberUtils.compare(1.2f, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(1.2f, Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(1.2f, 1.2f) == 0);
assertTrue(NumberUtils.compare(1.2f, 0.0f) == +1);
assertTrue(NumberUtils.compare(1.2f, -0.0f) == +1);
assertTrue(NumberUtils.compare(1.2f, -1.2f) == +1);
assertTrue(NumberUtils.compare(1.2f, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(1.2f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(1.2f, Float.NaN) == -1);
assertTrue(Float.compare(1.2f, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(1.2f, Float.MAX_VALUE) == -1);
assertTrue(Float.compare(1.2f, 1.2f) == 0);
assertTrue(Float.compare(1.2f, 0.0f) == +1);
assertTrue(Float.compare(1.2f, -0.0f) == +1);
assertTrue(Float.compare(1.2f, -1.2f) == +1);
assertTrue(Float.compare(1.2f, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(1.2f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(0.0f, Float.NaN) == -1);
assertTrue(NumberUtils.compare(0.0f, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(0.0f, Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(0.0f, 1.2f) == -1);
assertTrue(NumberUtils.compare(0.0f, 0.0f) == 0);
assertTrue(NumberUtils.compare(0.0f, -0.0f) == +1);
assertTrue(NumberUtils.compare(0.0f, -1.2f) == +1);
assertTrue(NumberUtils.compare(0.0f, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(0.0f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(0.0f, Float.NaN) == -1);
assertTrue(Float.compare(0.0f, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(0.0f, Float.MAX_VALUE) == -1);
assertTrue(Float.compare(0.0f, 1.2f) == -1);
assertTrue(Float.compare(0.0f, 0.0f) == 0);
assertTrue(Float.compare(0.0f, -0.0f) == +1);
assertTrue(Float.compare(0.0f, -1.2f) == +1);
assertTrue(Float.compare(0.0f, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(0.0f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(-0.0f, Float.NaN) == -1);
assertTrue(NumberUtils.compare(-0.0f, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(-0.0f, Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(-0.0f, 1.2f) == -1);
assertTrue(NumberUtils.compare(-0.0f, 0.0f) == -1);
assertTrue(NumberUtils.compare(-0.0f, -0.0f) == 0);
assertTrue(NumberUtils.compare(-0.0f, -1.2f) == +1);
assertTrue(NumberUtils.compare(-0.0f, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(-0.0f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(-0.0f, Float.NaN) == -1);
assertTrue(Float.compare(-0.0f, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(-0.0f, Float.MAX_VALUE) == -1);
assertTrue(Float.compare(-0.0f, 1.2f) == -1);
assertTrue(Float.compare(-0.0f, 0.0f) == -1);
assertTrue(Float.compare(-0.0f, -0.0f) == 0);
assertTrue(Float.compare(-0.0f, -1.2f) == +1);
assertTrue(Float.compare(-0.0f, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(-0.0f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(-1.2f, Float.NaN) == -1);
assertTrue(NumberUtils.compare(-1.2f, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(-1.2f, Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(-1.2f, 1.2f) == -1);
assertTrue(NumberUtils.compare(-1.2f, 0.0f) == -1);
assertTrue(NumberUtils.compare(-1.2f, -0.0f) == -1);
assertTrue(NumberUtils.compare(-1.2f, -1.2f) == 0);
assertTrue(NumberUtils.compare(-1.2f, -Float.MAX_VALUE) == +1);
assertTrue(NumberUtils.compare(-1.2f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(-1.2f, Float.NaN) == -1);
assertTrue(Float.compare(-1.2f, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(-1.2f, Float.MAX_VALUE) == -1);
assertTrue(Float.compare(-1.2f, 1.2f) == -1);
assertTrue(Float.compare(-1.2f, 0.0f) == -1);
assertTrue(Float.compare(-1.2f, -0.0f) == -1);
assertTrue(Float.compare(-1.2f, -1.2f) == 0);
assertTrue(Float.compare(-1.2f, -Float.MAX_VALUE) == +1);
assertTrue(Float.compare(-1.2f, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.NaN) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, 1.2f) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, 0.0f) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, -0.0f) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, -1.2f) == -1);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, -Float.MAX_VALUE) == 0);
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
assertTrue(Float.compare(-Float.MAX_VALUE, Float.NaN) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, Float.MAX_VALUE) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, 1.2f) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, 0.0f) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, -0.0f) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, -1.2f) == -1);
assertTrue(Float.compare(-Float.MAX_VALUE, -Float.MAX_VALUE) == 0);
assertTrue(Float.compare(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.NaN) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, 1.2f) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, 0.0f) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, -0.0f) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, -1.2f) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE) == -1);
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY) == 0);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.NaN) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.MAX_VALUE) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, 1.2f) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, 0.0f) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -0.0f) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -1.2f) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE) == -1);
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY) == 0);
}
public void testIsDigits() {