summaryrefslogtreecommitdiff
path: root/scalaires.h
diff options
context:
space:
mode:
Diffstat (limited to 'scalaires.h')
-rw-r--r--scalaires.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/scalaires.h b/scalaires.h
new file mode 100644
index 0000000..a13b96a
--- /dev/null
+++ b/scalaires.h
@@ -0,0 +1,24 @@
+#ifndef __SCALAIRES_H__
+#define __SCALAIRES_H__
+
+typedef struct {
+ int num;
+ unsigned int denom;
+} rationnel;
+
+rationnel rat_constr_zero(void); /* renvoie 0 */
+
+
+rationnel rat_constr(int num, int 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 */
+
+#endif