From fd1d6e142084e41049ef9b286ae0a27f174bd2a6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 20 Jan 2016 18:42:55 +0200 Subject: [PATCH] Add floor/ceil/round functions to math utils ns. --- src/uxbox/util/math.cljs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/uxbox/util/math.cljs b/src/uxbox/util/math.cljs index ff8c97fac..a870fbdd9 100644 --- a/src/uxbox/util/math.cljs +++ b/src/uxbox/util/math.cljs @@ -26,6 +26,24 @@ [^number v] (- v)) +(defn floor + "Returns the largest integer less than or + equal to a given number." + [^number v] + (js/Math.floor v)) + +(defn round + "Returns the value of a number rounded to + the nearest integer." + [^number v] + (js/Math.round v)) + +(defn ceil + "Returns the smallest integer greater than + or equal to a given number." + [^number v] + (js/Math.ceil v)) + (defn radians "Converts degrees to radians." [^number degrees]