Quote Originally Posted by sunil.thaha View Post
you will get exactly that, all you have to do is to try it out
round( 8.925, 2 ); and see what you get
from the debug..

value = 8.925 result = 8.92
the function..
Qt Code:
  1. double bankround(double value, int precision = 2){
  2. double rv = long( value * pow(10, precision) + 0.5 )/ pow(10, precision );
  3. qDebug() << "value = " << value << " result = " << rv;
  4. return rv ;
  5. }
To copy to clipboard, switch view to plain text mode