@Test
    public void shouldDivideForceFloatingPointAndReturnCorrectType() {
        // BYTE
        assertEquals(1F, div((byte) 1, (byte) 1, true));
        assertEquals(1F, div((byte) 1, (short) 1, true));
        assertEquals(1F, div((byte) 1, 1, true));
        assertEquals(1D, div((byte) 1, 1L, true));
        assertEquals(1F, div((byte) 1, 1F, true));
        assertEquals(1D, div((byte) 1, 1D, true));
        assertEquals(BigDecimal.ONE, div((byte) 1, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE, div((byte) 1, BigDecimal.ONE, true));

        // SHORT
        assertEquals(1F, div((short) 1, (short) 1, true));
        assertEquals(1F, div((short) 1, 1, true));
        assertEquals(1D, div((short) 1, 1L, true));
        assertEquals(1F, div((short) 1, 1F, true));
        assertEquals(1D, div((short) 1, 1D, true));
        assertEquals(BigDecimal.ONE, div((short) 1, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE, div((short) 1, BigDecimal.ONE, true));

        // INTEGER
        assertEquals(1F, div(1, 1, true));
        assertEquals(1D, div(1, 1L, true));
        assertEquals(1F, div(1, 1F, true));
        assertEquals(1D, div(1, 1D, true));
        assertEquals(BigDecimal.ONE, div(1, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE, div(1, BigDecimal.ONE, true));

        // LONG
        assertEquals(1D, div(1L, 1L, true));
        assertEquals(1D, div(1L, 1F, true));
        assertEquals(1D, div(1L, 1D, true));
        assertEquals(BigDecimal.ONE, div(1L, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE, div(1L, BigDecimal.ONE, true));

        // FLOAT
        assertEquals(1F, div(1F, 1F, true));
        assertEquals(1D, div(1F, 1D, true));
        assertEquals(BigDecimal.ONE.setScale(1, RoundingMode.HALF_UP), div(1F, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE.setScale(1, RoundingMode.HALF_UP), div(1F, BigDecimal.ONE, true));

        // DOUBLE
        assertEquals(1D, div(1D, 1D, true));
        assertEquals(BigDecimal.ONE.setScale(1, RoundingMode.HALF_UP), div(1D, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE.setScale(1, RoundingMode.HALF_UP), div(1D, BigDecimal.ONE, true));

        // BIG INTEGER
        assertEquals(BigDecimal.ONE, div(BigInteger.ONE, BigInteger.ONE, true));
        assertEquals(BigDecimal.ONE, div(BigInteger.ONE, BigDecimal.ONE, true));

        // BIG DECIMAL
        assertEquals(BigDecimal.ONE, div(BigDecimal.ONE, BigDecimal.ONE, true));
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/NumberHelperTest.java