my Modulo Inverse in clojure Seems to give wrong answer

2014-10-13 Thread Ashish Negi
Hi I am programming in clojure and though the problem of modulo inverse has nothing to do with language i am stuck at this code - (defn EulerDiv [x p] (let [ToMod (+ p 2)] (loop [num 1 toPow (int p) numDouble x] (if (= 0 toPow) num (let [numDouble2 (rem

Re: my Modulo Inverse in clojure Seems to give wrong answer

2014-10-13 Thread Laurens Van Houtven
exponent notation. hth lvh On 13 Oct 2014, at 10:20, Ashish Negi thisismyidash...@gmail.com wrote: Hi I am programming in clojure and though the problem of modulo inverse has nothing to do with language i am stuck at this code - (defn EulerDiv [x p] (let [ToMod (+ p 2

Re: my Modulo Inverse in clojure Seems to give wrong answer

2014-10-13 Thread Ashish Negi
of modulo inverse has nothing to do with language i am stuck at this code - (defn EulerDiv [x p] (let [ToMod (+ p 2)] (loop [num 1 toPow (int p) numDouble x] (if (= 0 toPow) num (let [numDouble2 (rem (* numDouble numDouble

Re: my Modulo Inverse in clojure Seems to give wrong answer

2014-10-13 Thread Fluid Dynamics
On Monday, October 13, 2014 4:34:16 AM UTC-4, Laurens Van Houtven wrote: Hi Ashish, At first sight, this looks like a numerical precision problem. 1e80 is a floating point type, not an integer type. You may want to try with e.g. 1000N (note the N; that makes it a bigint). I

Re: Modulo

2008-12-29 Thread Rich Hickey
just lost in the shuffle of holiday time? On Mon, Dec 22, 2008 at 4:04 AM, Mark Engelberg mark.engelb...@gmail.com wrote: Anyone know why there is no modulo or mod function in Clojure's core? I know there is a rem function, but that's not the same thing. mod and rem behave

Re: Modulo

2008-12-28 Thread Rich Hickey
, no one else cares about this, or was the post just lost in the shuffle of holiday time? On Mon, Dec 22, 2008 at 4:04 AM, Mark Engelberg mark.engelb...@gmail.com wrote: Anyone know why there is no modulo or mod function in Clojure's core? I know there is a rem function, but that's

Re: Modulo

2008-12-28 Thread Vincent Foley
I suppose then that we would also need div. Using GHCi here: Prelude (-3) `div` 2 -2 Prelude (-3) `quot` 2 -1 On Dec 22, 7:04 am, Mark Engelberg mark.engelb...@gmail.com wrote: Anyone know why there is no modulo or mod function in Clojure's core? I know there is a rem function, but that's