]> hackdaworld.org Git - physik/computational_physics.git/commitdiff
added general lib
authorhackbard <hackbard>
Wed, 25 Feb 2004 11:09:08 +0000 (11:09 +0000)
committerhackbard <hackbard>
Wed, 25 Feb 2004 11:09:08 +0000 (11:09 +0000)
general.c [new file with mode: 0644]
general.h [new file with mode: 0644]

diff --git a/general.c b/general.c
new file mode 100644 (file)
index 0000000..b92f8e8
--- /dev/null
+++ b/general.c
@@ -0,0 +1,20 @@
+/* general functions */
+
+double fak(int l) {
+       double result=1;
+       while(l--) result*=l;
+       return result;
+}
+
+double fak2(int l) {
+       double result=1;
+       while(l>0) {
+               result*=l;
+               l-=2;
+       }
+       return result;
+}
+
+double absolute_value(double l) {
+       return l<0?-l:l;
+}
diff --git a/general.h b/general.h
new file mode 100644 (file)
index 0000000..dd032a4
--- /dev/null
+++ b/general.h
@@ -0,0 +1,6 @@
+/* function prototypes */
+
+double fak(int l);
+double fak2(int l);
+double absolute_value(double l);
+