Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//! Rounding of \p v to the number of digit \p digit_count.
double round (double v, int digit_count = 0)
{
assert (digit_count >= 0);//positive_digit_count
double dec_place = 1;
for (int i = 1; i <= digit_count; i++)
dec_place = dec_place * 10;
int sign = v > 0 ? 1 : -1;
double Result = (abs (v) * dec_place) + 0.5;
int new_integer = (int) Result;
Result = sign * (((double) new_integer) / dec_place);
return Result;
}