gmp_and operation ???

Sisyphus sisyphus1 at optusnet.com.au
Sat Feb 6 00:54:29 CET 2010


----- Original Message ----- 
From: "Priti Solanki" <pritiatwork at gmail.com>

> Am i wrong somewhere?

I think so. The following yields 0 for me, not 9 (using gmp-5.0.0):

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

int main(void) {
    mpz_t x, y, z;

    printf("%s\n", gmp_version);
    mpz_init_set_str(x, "0000", 2);
    mpz_init_set_str(y, "0011", 2);
    mpz_init(z);
    mpz_and(z, x, y);
    mpz_out_str(stdout, 10, z);
    return 0;
}

##############################

What output do you get ?

Cheers,
Rob


More information about the gmp-discuss mailing list