home *** CD-ROM | disk | FTP | other *** search
- /*
- * mathutilities.h - global math definitions.
- *
- * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
- * University of Berne, Switzerland
- * All rights reserved.
- *
- * This software may be freely copied, modified, and redistributed
- * provided that this copyright notice is preserved on all copies.
- *
- * You may not distribute this software, in whole or in part, as part of
- * any commercial product without the express consent of the authors.
- *
- * There is no warranty or other guarantee of fitness of this software
- * for any purpose. It is provided solely "as is".
- *
- */
-
- #ifndef MathUtilities_H
- # define MathUtilities_H
-
- #include <math.h>
-
- #ifdef NO_DRAND48
- #include <stdlib.h>
- inline void srand48(long seed) { srand((int)seed); }
- inline double drand48() { return (double)( ((double)rand()) / ((double)(RAND_MAX)) ); }
- #else
- extern "C" void srand48(long);
- extern "C" double drand48();
- #endif
-
- typedef double real;
- //typedef float real;
-
- const real EPSILON = 0.00001;
-
- inline real dtor(real degree) { return degree*M_PI/180.0; }
- inline real rtod(real rad) { return rad*180.0/M_PI; }
- inline int equal(real a, real b) { return fabs(a-b) < EPSILON; }
-
- #endif // MathUtilities_H
-