What is the best way to round numbers in Clojure?
clojure, rounding
Solution
You can java interop (Math/(floor|ceil). E.g.:
user=> (int (Math/floor (/ 3 2)))
1
user=> (int (Math/ceil (/ 3 2)))
2
Problem
This is an easy one. But anyway, I think it is a good idea to have this question answered here for a faster, easier reference. This operation: ``` (/ 3 2) ``` yields this: ``` 3/2 ``` I need one function to round up, which would yield 2 and another one to round down, which would yield 1.