diff options
Diffstat (limited to 'src/base/math')
-rw-r--r-- | src/base/math/round.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/base/math/round.c b/src/base/math/round.c new file mode 100644 index 0000000..a815152 --- /dev/null +++ b/src/base/math/round.c @@ -0,0 +1,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; +} |