Hi,

a bit naive, but it seems to work…
user=> (defn round
         [x & {p :precision}]
         (if p
           (let [scale (Math/pow 10 p)]
             (-> x (* scale) Math/round (/ scale)))
           (Math/round x)))
#'user/round
user=> (round 78.37898794)
78
user=> (round 78.37898794 :precision 3)
78.379

There are probably thousand reasons not to do that…

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to