Thanks Laurens That solved it. :)
On Monday, 13 October 2014 14:04:16 UTC+5:30, 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. > 1000000000000000N (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 <thisismy...@gmail.com <javascript:>> > 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)] > > > > > > (loop [num 1 toPow (int p) numDouble x] > > > > > > (if (= 0 toPow) > > > > num > > > > (let [numDouble2 (rem (* numDouble numDouble) ToMod) > > > > halfToPow > > (int (/ toPow 2))] > > > > > > (if (odd? toPow) > > > > > > (recur (rem (* num numDouble) ToMod) > > > > halfToPow > > numDouble2 > > ) > > > > > > (recur num halfToPow numDouble2)) > > > > > > > > )))) > > > > > > ) > > It seems to give me right answers for small Primes but when i am using > it in a problem with Bigger primes i am getting answers other than result > like : > > > > (= 2 (mod (* 4 (EulerDiv 2 (- 3 2))) 3)) > > This prints true > > > > (def ToMod (+ 10e8 7)) > > ( = 1 (int (mod (* 2 (EulerDiv 2 (- ToMod 2))) ToMod)) ) > > This prints false. > > > > Also there is rem and mod in clojure. mod makes the output positive and > hence i can not use it in between the calculations. > > > > The problem is that of programming calculator grammar for evaluating > evpressions like "4/-2/(2 + 8)" > > > > Thanks > > > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com > <javascript:> > > Note that posts from new members are moderated - please be patient with > your first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google > Groups "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to clojure+u...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.