On Jul 10, 9:01 am, Chouser <chou...@gmail.com> wrote:
> On Fri, Jul 10, 2009 at 7:14 AM, John Harrop<jharrop...@gmail.com> wrote:
> > It would be useful to have a *math-context* or similar that had a sensible
> > default and could be set with binding to affect bigdec calculations within
> > the temporal scope of said binding.
>
> user=> (binding [*math-context* (java.math.MathContext. 5)] (+ 2 
> 1.111111111M))
> 3.1111M
>
> Even works in 1.0.0!  Dunno if it's documented anywhere,
> though. :-/
>
> In git master (a.k.a. 1.1.0-alpha-SNAPSHOT), you can now
> also set it at the REPL:
>
> user=> (set! *math-context* (java.math.MathContext. 5))
> #<MathContext precision=5 roundingMode=HALF_UP>
>
> http://www.assembla.com/spaces/clojure/tickets/137
>

See also: with-precision

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