Problems with (low-level functions) mpn_.

Moises Deangelo lewris at ig.com.br
Tue Oct 5 05:23:25 CEST 2004


Hey people.

I am new in the forum, I program in C the little time, and the less time
still use GMP.

I have been trying use GMP low-level (mpn_), but I do not manage to do
run. I unfortunately do not know where I am being mistaken, I am reading
the documentation at every moment, but to did not yet get have success.

besides programing the little time, I have a larger difficulty, the
communication. The English is not my native language and that times
muddles me too much.

Please, evaluate the code that I send, if someone it can correct him for
me, or to indicate me some site with material on the subject I am
thankful.

/*****/

#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>

int main ( void )
{
    mpz_t   numero_00, numero_01, numero_03;
    unsigned int    ui_01;
    char    peg_rn[20];
    
    puts("\n n0: "); gets(peg_rn);  
    mpz_init_set_str(numero_00, peg_rn, 0);
    
    puts("\n n1: "); gets(peg_rn);
    mpz_init_set_str(numero_01, peg_rn, 0);
    
    puts("\n ui n: "); scanf("%d",&ui_01);
    
    mpz_init(numero_03);
    
    mpn_add_n(numero_03, numero_00, numero_01, ui_01);
    
    printf("\n ui n: %d",ui_01);
    gmp_printf("\n 00: %Zd",numero_00);
    gmp_printf("\n 01: %Zd",numero_01);
    gmp_printf("\n 03: %Zd",numero_03);
}   

/*****/

I am sending that fragment, but already I tried several options. Already
I changed that code without many times geting results. I just do not am
going to post all the forms that I tried to do that code work because
the e-mail would be very large, being that unnecessary.

what I wish, it is to comprehend mpn operation, that code that I created
is only a test to comprehend that. :-(

Please, comprehend,  is not laziness,  I do not wish anything chewed,
have me diligent, but it has been being hard.

I work cygwin. C and GMP 4.1.2.

Moises Deangelo
lewris at ig.com.br
ICQ:89529510
Brazil




More information about the gmp-discuss mailing list