Thanks, online calculator is very good.

On Fri, Nov 23, 2012 at 4:19 PM, Bill Hart <goodwillh...@googlemail.com>wrote:

> I Googled "online bignum calculator" and this popped up:
>
> https://defuse.ca/big-number-calculator.htm
>
> Python is fine of course.
>
> Bill.
>
> On 23 November 2012 13:59, mgundes <mg...@hotmail.com> wrote:
> >
> >    By the way I use python for not too big number verification.
> >    Is there any application or web site to easily verify big number
> > multiplications?
> >
> >
> > On Fri, Nov 23, 2012 at 3:51 PM, mgundes <mg...@hotmail.com> wrote:
> >>
> >>
> >>      Opps, sorry Bill, I have miscalculated the expected result, I
> checked
> >> again and found my mistake. Thank for your concern.
> >>
> >> Regards
> >>
> >>
> >>
> >> On Fri, Nov 23, 2012 at 3:26 PM, Bill Hart <goodwillh...@googlemail.com
> >
> >> wrote:
> >>>
> >>> You must have a 32 bit system then.
> >>>
> >>> Perhaps if you tell us what result you are getting and what result you
> >>> were expecting, we can help you more.
> >>>
> >>> Bill.
> >>>
> >>> On 23 November 2012 13:24, mgundes <mg...@hotmail.com> wrote:
> >>> >
> >>> >   I changed but the result are same as previous, since both are in
> same
> >>> > size
> >>> > in my system I guess.
> >>> >
> >>> >
> >>> > On Fri, Nov 23, 2012 at 3:14 PM, Bill Hart
> >>> > <goodwillh...@googlemail.com>
> >>> > wrote:
> >>> >>
> >>> >> One problem is that you are using unsigned int, instead of mp_limb_t
> >>> >> (which is probably unsigned long or unsigned long long on your
> >>> >> machine).
> >>> >>
> >>> >> Bill.
> >>> >>
> >>> >> On 23 November 2012 13:12, mgundes <mg...@hotmail.com> wrote:
> >>> >> >
> >>> >> >    Hi Bill, thanks for reply.
> >>> >> >
> >>> >> >    I run simple code below for different lengths of array
> >>> >> > muıltiplication
> >>> >> > and I got weird results with gmp_printf(). I also printed c array
> >>> >> > and it
> >>> >> > seems true but printed result is weird. What is wrong or missing
> in
> >>> >> > function
> >>> >> > below?
> >>> >> >
> >>> >> > int main() {
> >>> >> >
> >>> >> >   unsigned int a[4] = {100, 20, 30, 40};
> >>> >> >   unsigned int b[4] = {200, 10, 5, 120};
> >>> >> >   unsigned int c[8];
> >>> >> >
> >>> >> >   memset(c, 0, 8 * sizeof(unsigned int));
> >>> >> >   mpn_mul((mp_limb_t *) c,
> >>> >> >           (mp_limb_t *) a, 1,
> >>> >> >           (mp_limb_t *) b, 1);
> >>> >> >
> >>> >> >   for (int i=0; i<8; i++)
> >>> >> >     printf("c[%d]: %u\n", i, c[i]);
> >>> >> >   gmp_printf("\nresult: %Nu\n\n\n", c, 8);
> >>> >> >
> >>> >> >
> >>> >> >   memset(c, 0, 8 * sizeof(unsigned int));
> >>> >> >   mpn_mul((mp_limb_t *) c,
> >>> >> >           (mp_limb_t *) a, 2,
> >>> >> >           (mp_limb_t *) b, 3);
> >>> >> >
> >>> >> >   for (int i=0; i<8; i++)
> >>> >> >     printf("c[%d]: %u\n", i, c[i]);
> >>> >> >   gmp_printf("\nresult: %Nu\n\n\n", c, 8);
> >>> >> >
> >>> >> >   memset(c, 0, 8 * sizeof(unsigned int));
> >>> >> >   mpn_mul((mp_limb_t *) c,
> >>> >> >           (mp_limb_t *) a, 4,
> >>> >> >           (mp_limb_t *) b, 4);
> >>> >> >
> >>> >> >   for (int i=0; i<8; i++)
> >>> >> >     printf("c[%d]: %u\n", i, c[i]);
> >>> >> >   gmp_printf("\nresult: %Nu\n\n\n", c, 8);
> >>> >> >
> >>> >> >
> >>> >> >   return 0;
> >>> >> > }
> >>> >> >
> >>> >> > Kind Regards,
> >>> >> > Thanks
> >>> >> >
> >>> >> > MahmutG
> >>> >> >
> >>> >> >
> >>> >> > On Fri, Nov 23, 2012 at 3:09 AM, Bill Hart
> >>> >> > <goodwillh...@googlemail.com>
> >>> >> > wrote:
> >>> >> >>
> >>> >> >> The result could be up to 8 limbs, which is why you should
> allocate
> >>> >> >> 8
> >>> >> >> limbs for c. The top limb might turn out to be zero of course.
> >>> >> >>
> >>> >> >> The easiest way to print the result is to use gmp_printf with the
> >>> >> >> %N
> >>> >> >> option for mpn's. You need to also give it the number of limbs,
> as
> >>> >> >> documented on pages 67-68 of our documentation.
> >>> >> >>
> >>> >> >> Bill.
> >>> >> >>
> >>> >> >> On 23 November 2012 00:55, mgundes <mg...@hotmail.com> wrote:
> >>> >> >> >
> >>> >> >> > Hi,
> >>> >> >> >
> >>> >> >> > I am not good at arithmetic but I need to calculate
> >>> >> >> > multiplication of
> >>> >> >> > big
> >>> >> >> > numbers. I will try to explain my need:
> >>> >> >> >
> >>> >> >> > For instance, if I have two 128 bit numbers represented with
> >>> >> >> > arrays
> >>> >> >> > below:
> >>> >> >> >
> >>> >> >> >        unsigned int a[4] = {100, 20, 30, 40};
> >>> >> >> >        unsigned int b[4] = {200, 10, 5, 120};
> >>> >> >> >        unsigned int c[4] = {0,0,0,0};
> >>> >> >> >
> >>> >> >> > I want to multiply a and b, then assign the result to the c:
> >>> >> >> >
> >>> >> >> >        mpn_mul_n((mp_limb_t *)c, (const mp_limb_t *)a, (const
> >>> >> >> > mp_limb_t
> >>> >> >> > *)b,
> >>> >> >> > 4);
> >>> >> >> >
> >>> >> >> > Since mpn_mul takes result pointer as mp_limb_t type, then what
> >>> >> >> > if
> >>> >> >> > result
> >>> >> >> > exceeds? I mean the result of two integer multiplication
> probably
> >>> >> >> > exceeds
> >>> >> >> > integer size. Is there any example for multiplication of big
> >>> >> >> > numbers?
> >>> >> >> > I
> >>> >> >> > tried mpn_mul_n() as above and used mpn_get_str to see the
> result
> >>> >> >> > but
> >>> >> >> > I
> >>> >> >> > guess I could not use correctly.
> >>> >> >> >
> >>> >> >> > Kind regards,
> >>> >> >> > Thanks
> >>> >> >> >
> >>> >> >> > --
> >>> >> >> > MahmutG
> >>> >> >> >
> >>> >> >> > --
> >>> >> >> > You received this message because you are subscribed to the
> >>> >> >> > Google
> >>> >> >> > Groups
> >>> >> >> > "mpir-devel" group.
> >>> >> >> > To post to this group, send email to
> mpir-devel@googlegroups.com.
> >>> >> >> > To unsubscribe from this group, send email to
> >>> >> >> > mpir-devel+unsubscr...@googlegroups.com.
> >>> >> >> > For more options, visit this group at
> >>> >> >> > http://groups.google.com/group/mpir-devel?hl=en.
> >>> >> >>
> >>> >> >> --
> >>> >> >> You received this message because you are subscribed to the
> Google
> >>> >> >> Groups
> >>> >> >> "mpir-devel" group.
> >>> >> >> To post to this group, send email to mpir-devel@googlegroups.com
> .
> >>> >> >> To unsubscribe from this group, send email to
> >>> >> >> mpir-devel+unsubscr...@googlegroups.com.
> >>> >> >> For more options, visit this group at
> >>> >> >> http://groups.google.com/group/mpir-devel?hl=en.
> >>> >> >>
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> > --
> >>> >> > MahmutG
> >>> >> >
> >>> >> > --
> >>> >> > You received this message because you are subscribed to the Google
> >>> >> > Groups
> >>> >> > "mpir-devel" group.
> >>> >> > To post to this group, send email to mpir-devel@googlegroups.com.
> >>> >> > To unsubscribe from this group, send email to
> >>> >> > mpir-devel+unsubscr...@googlegroups.com.
> >>> >> > For more options, visit this group at
> >>> >> > http://groups.google.com/group/mpir-devel?hl=en.
> >>> >>
> >>> >> --
> >>> >> You received this message because you are subscribed to the Google
> >>> >> Groups
> >>> >> "mpir-devel" group.
> >>> >> To post to this group, send email to mpir-devel@googlegroups.com.
> >>> >> To unsubscribe from this group, send email to
> >>> >> mpir-devel+unsubscr...@googlegroups.com.
> >>> >> For more options, visit this group at
> >>> >> http://groups.google.com/group/mpir-devel?hl=en.
> >>> >>
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > MahmutG
> >>> >
> >>> > --
> >>> > You received this message because you are subscribed to the Google
> >>> > Groups
> >>> > "mpir-devel" group.
> >>> > To post to this group, send email to mpir-devel@googlegroups.com.
> >>> > To unsubscribe from this group, send email to
> >>> > mpir-devel+unsubscr...@googlegroups.com.
> >>> > For more options, visit this group at
> >>> > http://groups.google.com/group/mpir-devel?hl=en.
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "mpir-devel" group.
> >>> To post to this group, send email to mpir-devel@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> mpir-devel+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/mpir-devel?hl=en.
> >>>
> >>
> >>
> >>
> >> --
> >> MahmutG
> >
> >
> >
> >
> > --
> > MahmutG
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "mpir-devel" group.
> > To post to this group, send email to mpir-devel@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mpir-devel+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/mpir-devel?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mpir-devel" group.
> To post to this group, send email to mpir-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> mpir-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mpir-devel?hl=en.
>
>


-- 
MahmutG

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-devel@googlegroups.com.
To unsubscribe from this group, send email to 
mpir-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to