From 795b32c4b43866df8b9798912d59827e6d7c4347 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sat, 23 Jan 2016 22:11:11 +0200 Subject: [PATCH] Add `precision` helper on math ns. --- src/uxbox/util/math.cljs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/uxbox/util/math.cljs b/src/uxbox/util/math.cljs index a870fbdd9e..5c79e15af3 100644 --- a/src/uxbox/util/math.cljs +++ b/src/uxbox/util/math.cljs @@ -44,6 +44,10 @@ [^number v] (js/Math.ceil v)) +(defn precision + [^number v ^number n] + (js/parseFloat (.toFixed v n))) + (defn radians "Converts degrees to radians." [^number degrees]