File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed
exist-core/src/main/java/org/exist/xquery/value Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -146,19 +146,21 @@ public boolean isPositive() {
146
146
147
147
@ Override
148
148
protected @ Nullable IntSupplier createComparisonWith (final NumericValue other ) {
149
- if (other instanceof IntegerValue ) {
150
- return () -> BigDecimal .valueOf (value ).compareTo (new BigDecimal (((IntegerValue ) other ).value ));
151
- }
152
- if (other instanceof DecimalValue ) {
153
- return () -> BigDecimal .valueOf (value ).compareTo (((DecimalValue ) other ).value );
154
- }
155
- if (other instanceof DoubleValue ) {
156
- return () -> Double .compare (value , ((DoubleValue ) other ).value );
157
- }
158
- if (other instanceof FloatValue ) {
159
- return () -> Double .compare (value , ((FloatValue ) other ).value );
160
- }
161
- return null ;
149
+ final IntSupplier comparison ;
150
+ if (isInfinite () && other .isInfinite () && isPositive () == other .isPositive ()) {
151
+ comparison = () -> Constants .EQUAL ;
152
+ } else if (other instanceof IntegerValue ) {
153
+ comparison = () -> BigDecimal .valueOf (value ).compareTo (new BigDecimal (((IntegerValue ) other ).value ));
154
+ } else if (other instanceof DecimalValue ) {
155
+ comparison = () -> BigDecimal .valueOf (value ).compareTo (((DecimalValue ) other ).value );
156
+ } else if (other instanceof DoubleValue ) {
157
+ comparison = () -> Double .compare (value , ((DoubleValue ) other ).value );
158
+ } else if (other instanceof FloatValue ) {
159
+ comparison = () -> Double .compare (value , ((FloatValue ) other ).value );
160
+ } else {
161
+ comparison = null ;
162
+ }
163
+ return comparison ;
162
164
}
163
165
164
166
@ Override
Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ public boolean isPositive() {
150
150
@ Override
151
151
protected @ Nullable IntSupplier createComparisonWith (final NumericValue other ) {
152
152
final IntSupplier comparison ;
153
- if (other instanceof IntegerValue ) {
153
+
154
+ if (isInfinite () && other .isInfinite () && isPositive () == other .isPositive ()) {
155
+ comparison = () -> Constants .EQUAL ;
156
+ } else if (other instanceof IntegerValue ) {
154
157
comparison = () -> BigDecimal .valueOf (value ).compareTo (new BigDecimal (((IntegerValue )other ).value ));
155
158
} else if (other instanceof DecimalValue ) {
156
159
final BigDecimal promoted = new BigDecimal (Float .toString (value ));
You can’t perform that action at this time.
0 commit comments