First commit

This commit is contained in:
2026-04-08 20:11:20 +02:00
parent 10fe469c10
commit 79f15536a1
861 changed files with 135610 additions and 0 deletions

110
IUT/Info2/multiprecision.h Normal file
View File

@@ -0,0 +1,110 @@
/*
multiprecision.h by Noam HACHE
This file contains the type definition of lentier, representing an integer of over 64bits,
and functions related to the addition, substraction, multiplication, division and comparaison of this lentier type.
*/
// Type definition of a "long int"
typedef struct {
unsigned int *p;
unsigned int size;
} lentier;
/*
Add 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the addition of the 2 operands
*/
struct lentier Add_lentier(struct lentier a, struct lentier b);
/*
Substract 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the substraction of the 2 operands
*/
struct lentier Sub_lentier(struct lentier a, struct lentier b);
/*
Compare 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
a char, 0 if the operands are identical
1 if a is greater than b
-1 if a is lower than b
*/
char Cmp_lentier(struct lentier a, struct lentier b);
/*
Multiply 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the multiplication of the 2 operands
*/
struct lentier Mult_classique(struct lentier a, struct lentier b);
/*
Euclidean division of 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the rest of the euclidean division of the 2 operands
*/
struct lentier Div_eucl(struct lentier a, struct lentier b);
/*
Modular multiplication of 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the modular multiplication of the 2 operands
*/
struct lentier Mul_mod(struct lentier a, struct lentier b);
/*
Modular exponentiation of 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the modular exponentiation of the 2 operands
*/
struct lentier Exp_mod(struct lentier a, struct lentier x, struct lentier N);
/*
Modular exponentiation of 2 lentier
Args:
a (lentier): the first operand
b (lentier): the second operand
Returns:
an lentier, the modular exponentiation of the 2 operands
*/