From: hackbard Date: Wed, 25 Feb 2004 11:09:08 +0000 (+0000) Subject: added general lib X-Git-Url: https://www.hackdaworld.org/gitweb/?p=physik%2Fcomputational_physics.git;a=commitdiff_plain;h=1f172cee5738b87844ca151b22a62bdbdff7b7f5 added general lib --- diff --git a/general.c b/general.c new file mode 100644 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 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); +