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 bigi

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

2014-10-13 Thread Ashish Negi
nt to try with e.g. > 1000N (note the N; that makes it a bigint). I don’t know of any > nice syntax for describing extremely large bigints; e.g exponent notation. > > > hth > lvh > > > > On 13 Oct 2014, at 10:20, Ashish Negi > > wrote: > > > > >

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

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

2008-12-29 Thread Rich Hickey
gt; > > numbers). So really, 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 > > > > wrote: > > > > Anyone know why there is no modulo or mod fun

Re: Modulo

2008-12-29 Thread Achim Passen
from rem on negative > > numbers).  So really, 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 > > > wrote: > > > Anyone know why there is no modulo or mod func

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" wrote: > Anyone know why there is no modulo or mod function in Clojure's core? > I know there is a rem function, bu

Re: Modulo

2008-12-28 Thread Rich Hickey
mbers). So really, 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 > > wrote: > > Anyone know why there is no modulo or mod function in Clojure's core? > > I know the

Re: Modulo

2008-12-28 Thread Mark Engelberg
the shuffle of holiday time? On Mon, Dec 22, 2008 at 4:04 AM, Mark Engelberg 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 differently when the first numbe

Modulo

2008-12-22 Thread Mark Engelberg
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 differently when the first number is negative. (mod -2 5) -> 3 (rem -2 5) -> -2 modulo n is important for making things stay i