@Test
public void testDivisonWithLoss() {

    DivisionResult result;
    result = NumberUtils.divideWithLoss(-100d, 3, true);
    Assert.assertEquals(Double.valueOf(-33.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(-50d, 3, true);
    Assert.assertEquals(Double.valueOf(-16.67d), result.getResult());
    Assert.assertEquals(Double.valueOf(0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(-100d, 3, false);
    Assert.assertEquals(Double.valueOf(33.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(-50d, 3, false);
    Assert.assertEquals(Double.valueOf(16.67d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    // True
    result = NumberUtils.divideWithLoss(100d, 3, true);
    Assert.assertEquals(Double.valueOf(-33.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(50d, 3, true);
    Assert.assertEquals(Double.valueOf(-16.67d), result.getResult());
    Assert.assertEquals(Double.valueOf(0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(10000d, 3, true);
    Assert.assertEquals(Double.valueOf(-3333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(100000d, 3, true);
    Assert.assertEquals(Double.valueOf(-33333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(1000000d, 3, true);
    Assert.assertEquals(Double.valueOf(-333333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(10000000d, 3, true);
    Assert.assertEquals(Double.valueOf(-3333333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(100000000d, 3, true);
    Assert.assertEquals(Double.valueOf(-33333333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0.01d), result.getLoss());
    result = NumberUtils.divideWithLoss(999999999999d, 3, true);
    Assert.assertEquals(Double.valueOf(-333333333333d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0d), result.getLoss());
    result = NumberUtils.divideWithLoss(999999999.99d, 3, true);
    Assert.assertEquals(Double.valueOf(-333333333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(-0d), result.getLoss());
    result = NumberUtils.divideWithLoss(999999999.98d, 3, true);
    Assert.assertEquals(Double.valueOf(-333333333.33d), result.getResult());
    Assert.assertEquals(Double.valueOf(0.01d), result.getLoss());
}