You may also consider using java interop here.

(defn round [s n]
  (.setScale (bigdec n) s java.math.RoundingMode/HALF_EVEN))

=> (round 3 78.37898794)
=> 78.379

see

http://download.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html

Brenton

On Mar 23, 11:08 am, JDuPreez <jacques...@gmail.com> wrote:
> I'm trying to round a decimal number like 78.37898794 to say 78.379,
> without converting it to a string. I've been struggling to get this
> right and to get info on it. The closest that I've found is to use:
> format "%.3f". But format converts the number to a string. Not exactly
> what I'm trying to do.
>
> How can I do this in Clojure, or where is info on how to do it? Thanks
> for your help.

-- 
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