cljs.math/round
function | since v1.11.50 | Edit |
(round a)
Source docstring:
Returns the closest long to a. If equally close to two values, return the one
closer to ##Inf.
If a is ##NaN => 0
If a is ##-Inf => js/Number.MIN_SAFE_INTEGER
If a is ##Inf => js/Number.MAX_SAFE_INTEGER
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
(defn ^number round
{:added "1.11.10"}
[a]
(cond
^boolean (js/isNaN a) 0
^boolean (js/isFinite a) (Math/round a)
(== ##Inf a) js/Number.MAX_SAFE_INTEGER
:default js/Number.MIN_SAFE_INTEGER))