Page MenuHomec4science

Utility.cpp
No OneTemporary

File Metadata

Created
Sun, Sep 29, 15:24

Utility.cpp

#include <Utility.hpp>
#include <cmath>
double round(double x, int n)
{ // should it be floored or ceiled
int d = 0 ;
if((x * pow(10, n+1)) - (floor(x * pow(10, n))) > 4)
{ d = 1 ; }
// rounding
x = (floor(x * pow(10, n)) + d) / pow(10, n) ;
return x ;
}

Event Timeline