aboutsummaryrefslogtreecommitdiff
path: root/src/base/math/round.c
blob: a8151523405298e60b7b54cd17c7f7372fd3d249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <u.h>
#include <base.h>

double
math·round(double x)
{
    double f;

    f = math·floor(x);
    if((x-f) > 0.5)
        return f+1;
    return f;
}