Department of Scientific Computing   
Institute for Numerical Simulation   
University of Bonn   
Documentation
Download
Programming References
Bug Reports / Suggestions
FAQ
Authors
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Math.hpp

00001 #ifndef MyMATH_HPP
00002 # define MyMATH_HPP
00003 
00004 #include<stdio.h>
00005 #include<stdlib.h>
00006 #include<assert.h>
00007 #include<math.h>
00008 
00009 # ifndef MAXDOUBLE
00010 # define MAXDOUBLE 1.79769313486231500e+308
00011 # endif
00012 
00013 
00014 # ifndef MAXINT
00015 # define MAXINT  1000000000
00016 # endif
00017 
00018 # ifndef HUGE
00019 # define HUGE  1e+308
00020 # endif
00021 
00022 # ifndef PI
00023 # define PI 3.141592653589793
00024 # endif
00025 
00026 # define MNAN 1e+100
00027 
00028 inline int    min (const int    x, const int    y) { return x<y ? x : y ;} 
00029 inline int    max (const int    x, const int    y) { return x<y ? y : x ;}
00030 inline int    max (const int    x, const int    y, const int    z) { return max(x,max(y,z));}
00031 inline double min (const double x, const double y) { return x<y ? x : y ;} 
00032 inline double max (const double x, const double y) { return x<y ? y : x ;}
00033 inline double sign(const double x)                 { return x<0 ? -1 : ( x> 0 ? +1 : 0) ;}
00034 inline double sqr (const double x)                 { return x*x ;}
00035 
00036 inline size_t lmax(size_t x,size_t y) { return x<y ? y : x ;}
00037 inline int ceil2 (int x)     { return (x+(x>0))/2 ;} // integer division truncates any fractional part: K+R C Programming Language
00038 inline int floor2(int x)     { return (x-(x>0))/2 ;}
00039 
00040 inline double mydrand() { return ((double)random())/RAND_MAX ; }
00041 
00042 // little <-> big endian
00043 void swapbytes(void *p , int size, int nitem) ; 
00044 // various compares:  (*a)<(*b) then -1 , else +1 bzw. 0
00045 int  doublecmp(const void *a , const void *b) ;
00046 int  intcmp   (const void *a , const void *b) ;
00047 // (level,index) <-> x \in {0,...,2^jmx1} with Level0
00048 void code     (int  l,unsigned long  s , unsigned long *x , int jmx1, int L0) ; // (l,s)->x
00049 void decode   (int *l,unsigned long *s , unsigned long  x , int jmx1, int L0) ; // x->(l,s)
00050 
00051 // Integral Sinus/Cosinus function
00052 #ifdef _CLN_
00053  #define _CLN_DIGITS_ 70
00054  #include <cl_integer.h>
00055  #include <cl_rational.h>
00056  #include <cl_real.h>
00057  #include <cl_io.h>
00058  #include <cl_float_io.h>  
00059  
00060  cl_F   Si (cl_F x) ;
00061  cl_F   Ci (cl_F x) ;
00062  cl_F   CCi(cl_F x) ;
00063 
00064  double Si (double x) ;
00065  double Ci (double x) ;
00066  double CCi(double x) ; // Ci(x) - Ceuler -ln(x)
00067 #endif
00068 
00069 #endif

Generated at Mon Aug 19 10:02:31 2002 for AWFD by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001