@Udf
  public Long trunc(@UdfParameter final Long val) {
    return val;
  }
@Test
  public void shouldTruncateDoubleWithDecimalPlacesPositive() {
    assertThat(udf.trunc(0d, 0), is(0d));
    assertThat(udf.trunc(1.0d, 0), is(1.0d));
    assertThat(udf.trunc(1.1d, 0), is(1.0d));
    assertThat(udf.trunc(1.5d, 0), is(1.0d));
    assertThat(udf.trunc(1.75d, 0), is(1.0d));
    assertThat(udf.trunc(100.1d, 0), is(100.0d));
    assertThat(udf.trunc(100.5d, 0), is(100.0d));
    assertThat(udf.trunc(100.75d, 0), is(100.0d));
    assertThat(udf.trunc(100.10d, 1), is(100.1d));
    assertThat(udf.trunc(100.11d, 1), is(100.1d));
    assertThat(udf.trunc(100.15d, 1), is(100.1d));
    assertThat(udf.trunc(100.17d, 1), is(100.1d));
    assertThat(udf.trunc(100.110d, 2), is(100.11d));
    assertThat(udf.trunc(100.111d, 2), is(100.11d));
    assertThat(udf.trunc(100.115d, 2), is(100.11d));
    assertThat(udf.trunc(100.117d, 2), is(100.11d));
    assertThat(udf.trunc(100.1110d, 3), is(100.111d));
    assertThat(udf.trunc(100.1111d, 3), is(100.111d));
    assertThat(udf.trunc(100.1115d, 3), is(100.111d));
    assertThat(udf.trunc(100.1117d, 3), is(100.111d));
    assertThat(udf.trunc(1.0d, 3), is(1.0d));
    assertThat(udf.trunc(1.1d, 3), is(1.1d));
    assertThat(udf.trunc(1.5d, 3), is(1.5d));
    assertThat(udf.trunc(1.7d, 3), is(1.7d));
    assertThat(udf.trunc(12345.67d, -1), is(12340d));
    assertThat(udf.trunc(12345.67d, -2), is(12300d));
    assertThat(udf.trunc(12345.67d, -3), is(12000d));
    assertThat(udf.trunc(12345.67d, -4), is(10000d));
    assertThat(udf.trunc(12345.67d, -5), is(0d));
  }