How to round off the value of decimal property to certain precision point?

This can be achieved through the custom java function.

Java Code:

  1. long factor = (long) Math.pow(10, PrecisionSize);
  2. Value = Value * factor;
  3. long tmp = Math.round(Value);
  4. return (double) tmp / factor;

Value and PrecisionSize are the parameters for this function.


Keep up to date on this post and subscribe to comments

November 1, 2018 - 8:28pm