public static boolean areNumericEqual(Number n1, Number n2) {
        return n1.getClass() != n2.getClass() || n1 instanceof Comparable ?
                asBigDecimal(n1).compareTo(asBigDecimal(n2)) == 0 : // BigDecimal.equals() returns false for different scales
                Objects.equals(n1, n2);
    }
@Test
    public void areNumericEqualWithNumbers() {
        assertThat(OperatorUtils.areNumericEqual(1, 1)).isTrue();
        assertThat(OperatorUtils.areNumericEqual(1L, 1L)).isTrue();
        assertThat(OperatorUtils.areNumericEqual(1.0f, 1.0f)).isTrue();
        assertThat(OperatorUtils.areNumericEqual(1.0, 1.0)).isTrue();

        assertThat(OperatorUtils.areNumericEqual(1, 2)).isFalse();
        assertThat(OperatorUtils.areNumericEqual(1L, 2L)).isFalse();
        assertThat(OperatorUtils.areNumericEqual(1.0f, 2.0f)).isFalse();
        assertThat(OperatorUtils.areNumericEqual(1.0, 2.0)).isFalse();

        assertThat(OperatorUtils.areNumericEqual(1, new BigDecimal("1"))).isTrue();
        assertThat(OperatorUtils.areNumericEqual(1, new BigDecimal("1.0"))).isTrue();
        assertThat(OperatorUtils.areNumericEqual(1, new BigDecimal("1.00"))).isTrue();

        assertThat(OperatorUtils.areNumericEqual(BigDecimal.valueOf(0.1), BigDecimal.valueOf(0.1))).isTrue();
        assertThat(OperatorUtils.areNumericEqual(BigDecimal.valueOf(0.1), BigDecimal.valueOf(0.100000001))).isFalse();

        assertThat(OperatorUtils.areNumericEqual(new BigDecimal("1.0"), new BigDecimal("1.00"))).isTrue();
    }