Introduction to the GNU GMP Library
Salimova Diyora
Swiss Federal Institute of Technology sdiyora@student.ethz.ch
October 16, 2014
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 1 / 14
Introduction to the GNU GMP Library Salimova Diyora Swiss Federal - - PowerPoint PPT Presentation
Introduction to the GNU GMP Library Salimova Diyora Swiss Federal Institute of Technology sdiyora@student.ethz.ch October 16, 2014 Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 1 / 14 Overview Presentation,
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 1 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 2 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 3 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 4 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 5 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 6 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 7 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 8 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 9 / 14
#include "gmp.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> void fact(int n){ int i; mpz_t p; mpz_init_set_ui(p,1); /* p = 1 */ for (i=1; i <= n ; ++i){ mpz_mul_ui(p,p,i); /* p = p * i */ } printf ("%d! = ", n); mpz_out_str(stdout,10,p); mpz_clear(p); } int main(int argc, char * argv[]){ int n; if (argc <= 1){ printf ("Usage: %s <number> \n", argv[0]); return 2; } n = atoi(argv[1]); assert( n >= 0); fact(n); return 1; }
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 10 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 11 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 12 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 13 / 14
Salimova Diyora (ETHZ) Introduction to the GNU GMP Library October 16, 2014 14 / 14