@@ -61,40 +61,52 @@ public static boolean ze(Number instance) {
6161 return instance .doubleValue () == 0.0 ;
6262 }
6363
64- public static boolean lt (Number instance , Number value ) {
65- // for big numbers, go slow
66- if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
67- return toBigDecimal (instance ).compareTo (toBigDecimal (value )) < 0 ;
64+ public static boolean lt (Number instance , Object value ) {
65+ if (value instanceof Number ) {
66+ // for big numbers, go slow
67+ if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
68+ return toBigDecimal (instance ).compareTo (toBigDecimal (((Number ) value ))) < 0 ;
69+ }
70+ // approx.
71+ return instance .doubleValue () < ((Number ) value ).doubleValue ();
6872 }
69- // approx.
70- return instance .doubleValue () < value .doubleValue ();
73+ return false ;
7174 }
7275
73- public static boolean lte (Number instance , Number value ) {
74- // for big numbers, go slow
75- if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
76- return toBigDecimal (instance ).compareTo (toBigDecimal (value )) <= 0 ;
76+ public static boolean lte (Number instance , Object value ) {
77+ if (value instanceof Number ) {
78+ // for big numbers, go slow
79+ if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
80+ return toBigDecimal (instance ).compareTo (toBigDecimal (((Number ) value ))) <= 0 ;
81+ }
82+ // approx.
83+ return instance .doubleValue () <= ((Number ) value ).doubleValue ();
7784 }
78- // approx.
79- return instance .doubleValue () <= value .doubleValue ();
85+ return false ;
8086 }
8187
82- public static boolean gt (Number instance , Number value ) {
83- // for big numbers, go slow
84- if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
85- return toBigDecimal (instance ).compareTo (toBigDecimal (value )) > 0 ;
88+ public static boolean gt (Number instance , Object value ) {
89+ if (value instanceof Number ) {
90+ // for big numbers, go slow
91+ if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
92+ return toBigDecimal (instance ).compareTo (toBigDecimal (((Number ) value ))) > 0 ;
93+ }
94+ // approx.
95+ return instance .doubleValue () > ((Number ) value ).doubleValue ();
8696 }
87- // approx.
88- return instance .doubleValue () > value .doubleValue ();
97+ return false ;
8998 }
9099
91- public static boolean gte (Number instance , Number value ) {
92- // for big numbers, go slow
93- if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
94- return toBigDecimal (instance ).compareTo (toBigDecimal (value )) >= 0 ;
100+ public static boolean gte (Number instance , Object value ) {
101+ if (value instanceof Number ) {
102+ // for big numbers, go slow
103+ if (instance instanceof BigDecimal || value instanceof BigDecimal || instance instanceof BigInteger || value instanceof BigInteger ) {
104+ return toBigDecimal (instance ).compareTo (toBigDecimal (((Number ) value ))) >= 0 ;
105+ }
106+ // approx.
107+ return instance .doubleValue () >= ((Number ) value ).doubleValue ();
95108 }
96- // approx.
97- return instance .doubleValue () >= value .doubleValue ();
109+ return false ;
98110 }
99111
100112 public static double remainder (Number instance , Number value ) {
0 commit comments