On Tue, Jun 26, 2012 at 1:30 AM, dennis zhuang <killme2...@gmail.com> wrote:
> Added a postfix "M" to make the number as BigDecimal or "N" as a BigInteger:

That doesn't work here. It's not double literals that are the problem,
but computed values that are coming out as doubles. Furthermore, I'd
like the code to use BigDecimals when it must, but use doubles when it
can, so coercing everything with bigdec is not ideal.

With int/BigInt it would be easy enough, as one BigInt would spread to
everything it touched. But for some reason doubles and BigDecimals
don't behave the same way. Perhaps because they figured any double
clobbers any reliability to the extra precision in a BigDecimal
calculation. But that didn't consider that someone might be doing
calculations where they don't need a wider mantissa but do need
exponents bigger than 10^308. In that situation, BigDecimal contagion
is desirable. So I'd like to know of some way to switch it on for a
particular chunk of code, or operators analogous to the primed
operators that favor BigDecimal over double. (It's worse than just the
lack of /', by the way. +' and friends favor double over BigDecimal
the same as + and friends. Arrrgh!)

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