Clojure has pretty decent support for the so-called numeric tower. But most of the math operations in Java's math library only work on doubles.
In PLT Scheme, I can do stuff like this: (sqrt 115792089237316195423570985008687907853269984665640564039457584007913129639936) and it outputs: 340282366920938463463374607431768211456 or (sqrt 16/9) which yields 4/3 and of course it can handle something like (sqrt 2) by outputting a double 1.4142135623730951 (sqrt -1) outputs a complex number: 0+1i In Clojure, most of these things won't work because the only sqrt function (I know of) is the one in Java's library that works on doubles only. Java's pow has been another particular source of frustration for me, because it's another one that I would expect to work on arbitrary Clojure numbers. It looks like Java's BigInteger library has its own pow function, and the standard Java pow works on doubles. Is there an easy way to make Clojure automatically do the right thing with its numbers? Is there any kind of math library that works a bit more intelligently with Clojure's numbers, or has anyone looked at bringing more of these math functions into the Clojure core or contrib so that these functions will dispatch correctly? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---