Forum Discussion
2 Replies
- tstackFormer Employee
Your research is correct, we are using setScale() with ROUND_HALF_UP.
As to the rounding behavior, web browsers seem to round up on ‘5’ in some cases as well. If you try toFixed() on the value ‘2.35’, it will return 2.4 in Chrome and FireFox. I’m not sure what causes the difference at the moment, but it might be due to the differences between using floating point numbers and BigDecimals. The BigDecimals will be more accurate in their results since floating point is more of an approximation.
- aleungContributor III
or you can use this in the mapper
Math.trunc(($[FIELD]++0.005)*100)/100