> On May 30, 2014, 7 a.m., Mehant Baid wrote:
> > exec/java-exec/src/main/codegen/data/MathFunc.tdd, line 87
> > <https://reviews.apache.org/r/21985/diff/1/?file=597748#file597748line87>
> >
> > Wouldn't this cause a loss of data? Double can represent approximately
> > 1.8 * (10 ^ 308), simply casting it to long (which can represent only 19
> > digits) will cause loss of integer digits. Your change specifically isn't
> > introducing this problem, seems like this issue always existed.
> >
> > Might be better to use a java function to truncate the fractional
> > digits but still return double / float depending on the input.
> >
> >
Are you suggesting to use truncation code like below in our function
implementation:
BigDecimal formatted = new BigDecimal(String.valueOf(num)).setScale(0,
BigDecimal.ROUND_FLOOR);
Or,
DecimalFormat format = new DecimalFormat("#");
format.setRoundingMode(RoundingMode.FLOOR);
String formatted = format.format(num);
- Yash
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/21985/#review44338
-----------------------------------------------------------
On May 28, 2014, 7:05 p.m., Yash Sharma wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/21985/
> -----------------------------------------------------------
>
> (Updated May 28, 2014, 7:05 p.m.)
>
>
> Review request for drill, Aditya Kishore, Mehant Baid, and Timothy Chen.
>
>
> Repository: drill-git
>
>
> Description
> -------
>
> Drill-708: trunc(num) bugfix
>
>
> Diffs
> -----
>
> exec/java-exec/src/main/codegen/data/MathFunc.tdd 228d207
>
> Diff: https://reviews.apache.org/r/21985/diff/
>
>
> Testing
> -------
>
> Yes. On Sqlline.
>
>
> Thanks,
>
> Yash Sharma
>
>