setScale returns a new BigDecimal with a given scale, it does not change the original value.
e.g.) user=> (def mybd (BigDecimal. 40)) #'user/mybd user=> (.setScale mybd 4) 40.0000M user=> mybd 40M --- Joseph Smith j...@uwcreations.com (402)601-5443 On Nov 30, 2009, at 12:00 AM, John Harrop wrote: > On Mon, Nov 30, 2009 at 12:22 AM, Joseph Smith <j...@uwcreations.com> > wrote: > What you want is to set the 'scale' of the BigDecimal. > > There doesn't seem to be a nice clojure macro for it, but this works: > user=> (.setScale (reduce + [15.00M 15.01M 3.00M 3.01M]) 3) > 36.020M > > That's what with-precision does, on a temporary basis. But for 36.02 > to be represented with-precision has to be at least 4 it seems. > Looks like with-precision is all the digits, scale is the ones right > of the decimal point. > > -- > 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 -- 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