summaryrefslogtreecommitdiff
path: root/include/scalaires.h
blob: 8ae90c3879a8c79d13138038174bf8614477a741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __SCALAIRES_H__
#define __SCALAIRES_H__

typedef struct {
    long long num;
    unsigned long long denom;
} rationnel;

typedef enum typedisplay {
    HEX,
    DEC,
    OCT,
    FLT
} typedisplay;

extern typedisplay display;

rationnel rat_constr_zero(void);	/*

					 * renvoie 0 
					 */
rationnel rat_constr(long long num, long long denom);	/*

									 * cree une fraction 
									 */
rationnel rat_constr_from_double(double flt);	/*

						 * cree une fraction a partir d un double 
						 */
void rat_destruct(rationnel rat);	/*

					 * destructeur 
					 */
double rat_to_double(rationnel rat);	/*

					 * obtention du double correspondant a un rationnel 
					 */
rationnel rat_addition(rationnel rat1, rationnel rat2);	/*

							 * addition 
							 */
rationnel rat_soustraction(rationnel rat1, rationnel rat2);	/*

								 * soustraction 
								 */
rationnel rat_moinsunaire(rationnel rat1);	/*

						 * moins unaire 
						 */
rationnel rat_multiplication(rationnel rat1, rationnel rat2);	/*

								 * multiplication 
								 */
rationnel rat_division(rationnel rat, rationnel rat2);	/*

							 * division 
							 */
rationnel rat_pow(rationnel rat, unsigned int p);	/*

							 * puissance 
							 */
char *rat_to_string(rationnel rat, int first);

#endif