File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
main/java/org/epics/util/stats
test/java/org/epics/util/stats Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -213,10 +213,16 @@ public int hashCode() {
213213 * @return the range
214214 */
215215 public static Range of (final double minValue , final double maxValue ) {
216- if (Double .isNaN (minValue ) || Double .isNaN (maxValue )) {
216+ if (Double .isNaN (minValue ) && Double .isNaN (maxValue )) {
217217 return Range .UNDEFINED ;
218218 }
219-
219+ else if (Double .isNaN (minValue )) {
220+ return new Range (Double .NEGATIVE_INFINITY , maxValue , false );
221+ }
222+ else if (Double .isNaN (maxValue )) {
223+ return new Range (minValue , Double .POSITIVE_INFINITY , false );
224+ }
225+
220226 if (minValue > maxValue ) {
221227 return new Range (maxValue , minValue , true );
222228 }
Original file line number Diff line number Diff line change @@ -44,7 +44,10 @@ public void range3() throws Exception {
4444 @ Test
4545 public void range4 () throws Exception {
4646 Range range = Range .of (0.0 , Double .NaN );
47- assertThat (range , sameInstance (Range .undefined ()));
47+ assertThat (range .getMinimum (), equalTo (0.0 ));
48+ assertThat (range .getMaximum (), equalTo (Double .POSITIVE_INFINITY ));
49+ assertThat (range .isReversed (), equalTo (false ));
50+ assertThat (range .toString (), equalTo ("[0.0 - Infinity]" ));
4851 }
4952
5053 @ Test
You can’t perform that action at this time.
0 commit comments