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: Tue Apr 23 16:01:19 CEST 2024
Total time taken to generate the page: 0.03135 seconds
|