Home » U++ Library support » U++ Library : Other (not classified elsewhere) » rounding to decimals implementation
Re: rounding to decimals implementation [message #44430 is a reply to message #44429] |
Wed, 11 March 2015 11:43  |
|
aftershock wrote on Wed, 11 March 2015 11:24I have not found that in the library.
Here is the implementation.
double roundd ( double n, int decimals )
{
double p = ipow10 ( decimals );
return floor ( n*p + 0.5 ) / p;
}
Hi Aftershock,
It is not in the library, but you exactly reinvented what is written in documentation See About rounding double values.
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Mon May 12 06:05:19 CEST 2025
Total time taken to generate the page: 0.03093 seconds
|